From b2c4d38e09bbfdda24b3bc7a1612202e9affabf8 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Fri, 19 Apr 2024 13:42:16 +0200 Subject: [PATCH] XdgToplevel: update clip on geometry x/y change Currently if a client commits a geometry with a different x/y value but does not change the width/height we might not update the clip coordinates of the surface tree, potentially causing part of the surface to be unintentionally clipped off. To fix this, check for change in geometry x/y as well as width/height on commit if the client is not currently part of an ongoing transaction. Firefox for example it seems may respond to a configure non-atomically with multiple commits: 1. commit new buffer and new geometry of a new width/height. 2. commit again with the same width/height but a new geometry x/y. I don't think this is technically a bug but it doesn't seem like the most efficient way to do things. I think this may also cause imperfect frames. In any case, this should no longer cause river to crop off part of firefox's surface. (cherry picked from commit 9bbd34a0e31b6d429df2d39a59d8990a9585e186) --- river/XdgToplevel.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/river/XdgToplevel.zig b/river/XdgToplevel.zig index 438794c..909845a 100644 --- a/river/XdgToplevel.zig +++ b/river/XdgToplevel.zig @@ -352,6 +352,11 @@ fn handleCommit(listener: *wl.Listener(*wlr.Surface), _: *wlr.Surface) void { view.pending.box.height = toplevel.geometry.height; view.current = view.inflight; view.updateSceneState(); + } else if (old_geometry.x != toplevel.geometry.x or + old_geometry.y != toplevel.geometry.y) + { + // We need to update the surface clip box to reflect the geometry change. + view.updateSceneState(); } }, // If the client has not yet acked our configure, we need to send a