summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2023-02-13 20:24:54 -0500
committerJonas Ã…dahl <jadahl@gmail.com>2023-02-14 10:47:24 -0500
commit0ea24e068c0bbde4cbc0c6b0ffc62a6820ef2c5f (patch)
treeecddf8823bf74feb7e4d5b4a2d45e81044a7c4fe
parent98fc661de463bd5e8693176dd2693e7b005a426f (diff)
downloadmutter-0ea24e068c0bbde4cbc0c6b0ffc62a6820ef2c5f.tar.gz
wayland: Don't overwrite surface offsets
The intention when the offset request was added to protocol was that the attach request in a new enough protocol version should require dx/dy to be zero, but ignore them otherwise. The current code checks for 0, but then overwrites the existing dx/dy with it, which renders an earlier wl_surface_offset() call ineffective. Fixes: #2622 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2843> (cherry picked from commit ea373cb0590dbf5f857f6d96b10759f005b4fc93)
-rw-r--r--src/wayland/meta-wayland-surface.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index e8fb8fd08..d0ab61e65 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -1062,19 +1062,24 @@ wl_surface_attach (struct wl_client *client,
}
if (wl_resource_get_version (surface_resource) >=
- WL_SURFACE_OFFSET_SINCE_VERSION &&
- (dx != 0 || dy != 0))
+ WL_SURFACE_OFFSET_SINCE_VERSION)
{
- wl_resource_post_error (surface_resource,
- WL_SURFACE_ERROR_INVALID_OFFSET,
- "Attaching with an offset is no longer allowed");
- return;
+ if (dx != 0 || dy != 0)
+ {
+ wl_resource_post_error (surface_resource,
+ WL_SURFACE_ERROR_INVALID_OFFSET,
+ "Attaching with an offset is no longer allowed");
+ return;
+ }
+ }
+ else
+ {
+ pending->dx = dx;
+ pending->dy = dy;
}
pending->newly_attached = TRUE;
pending->buffer = buffer;
- pending->dx = dx;
- pending->dy = dy;
if (buffer)
{