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)
This commit is contained in:
Isaac Freund 2024-04-19 13:42:16 +02:00
parent dbfaa05a67
commit b2c4d38e09
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -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