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

commita68b9ee462396d364e8643b2cbe53b92065ab821
parente208bd33a9
authorIsaac Freund <[email protected]>
date2020-05-08 17:06
Better handle transactions with xwayland views

 src/XwaylandView.zig | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/XwaylandView.zig b/src/XwaylandView.zig
index 56beec8..2530f19 100644
--- a/src/XwaylandView.zig
+++ b/src/XwaylandView.zig
@@ -66,6 +66,12 @@ pub fn configure(self: Self, pending_box: Box) void {
         @intCast(u16, pending_box.width),
         @intCast(u16, pending_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;
 }
 
 /// Inform the xwayland surface that it has gained focus
@@ -145,7 +151,13 @@ fn handleUnmap(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
 }
 
 /// Called when the surface is comitted
+/// TODO: check for unexpected change in size and react as needed
 fn handleCommit(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
     const self = @fieldParentPtr(Self, "listen_commit", listener.?);
-    // TODO: check for unexpected change in size and react as needed
+    const view = self.view;
+    // See comment in XwaylandView.configure()
+    if (view.pending_serial != null) {
+        view.output.root.notifyConfigured();
+        view.pending_serial = null;
+    }
 }