git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commitff66767c123179a83658981cf419305c0eae2e86
parent4abb263177
authorIsaac Freund <[email protected]>
date2020-12-29 20:38
root: stop tracking xwayland views in transactions

Frame perfection for xwayland views would require too much complexity
to support and would bleed all over the codebase.

 river/Root.zig         |  2 +-
 river/View.zig         |  3 +++
 river/XwaylandView.zig | 18 +++---------------
 3 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/river/Root.zig b/river/Root.zig
index 0d42f96..896ddc5 100644
--- a/river/Root.zig
+++ b/river/Root.zig
@@ -355,7 +355,7 @@ fn commitTransaction(self: *Self) void {
             }
             defer view_it = view_node.next;
 
-            if (!view.shouldTrackConfigure() and view.pending_serial != null) continue;
+            if (view.pending_serial != null and !view.shouldTrackConfigure()) continue;
 
             // Apply pending state of the view
             view.pending_serial = null;
diff --git a/river/View.zig b/river/View.zig
index 323904a..af913f0 100644
--- a/river/View.zig
+++ b/river/View.zig
@@ -419,6 +419,9 @@ pub fn fromWlrSurface(surface: *wlr.Surface) ?*Self {
 }
 
 pub fn shouldTrackConfigure(self: Self) bool {
+    // We don't give a damn about frame perfection for xwayland views
+    if (build_options.xwayland and self.impl == .xwayland_view) return false;
+
     // There are exactly three cases in which we do not track configures
     // 1. the view was and remains floating
     // 2. the view is changing from float/layout to fullscreen
diff --git a/river/XwaylandView.zig b/river/XwaylandView.zig
index f3f0474..09da843 100644
--- a/river/XwaylandView.zig
+++ b/river/XwaylandView.zig
@@ -77,7 +77,8 @@ pub fn needsConfigure(self: Self) bool {
         self.xwayland_surface.height != self.view.pending.box.height;
 }
 
-/// Apply pending state
+/// Apply pending state. Note: we don't set View.serial as
+/// shouldTrackConfigure() is always false for xwayland views.
 pub fn configure(self: Self) void {
     const state = &self.view.pending;
     self.xwayland_surface.setFullscreen(state.fullscreen);
@@ -87,12 +88,6 @@ pub fn configure(self: Self) void {
         @intCast(u16, state.box.width),
         @intCast(u16, state.box.height),
     );
-    // Xwayland surfaces don't use serials, so we will just assume they have
-    // configured the next time they commit. Set pending serial to a dummy
-    // value to indicate that a transaction has started. Note: we can't just
-    // call notifyConfigured() here as the transaction has not yet been fully
-    // initiated.
-    self.view.pending_serial = 0x66666666;
 }
 
 /// Close the view. This will lead to the unmap and destroy events being sent
@@ -225,19 +220,12 @@ fn handleUnmap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface: *
 /// TODO: check for unexpected change in size and react as needed
 fn handleCommit(listener: *wl.Listener(*wlr.Surface), surface: *wlr.Surface) void {
     const self = @fieldParentPtr(Self, "commit", listener);
-    const view = self.view;
-
-    view.surface_box = Box{
+    self.view.surface_box = Box{
         .x = 0,
         .y = 0,
         .width = @intCast(u32, surface.current.width),
         .height = @intCast(u32, surface.current.height),
     };
-
-    // See comment in XwaylandView.configure()
-    if (view.pending_serial != null) {
-        view.notifyConfiguredOrApplyPending();
-    }
 }
 
 /// Called then the window updates its title