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:46:24 -0500
commita8a348185b2237443c8125f9d19ef59507640160 (patch)
tree76c42e1bbd1e539bac2bd72e263fb37a0031aff5
parenta63755bdad7d8bffdbbc649178d759c37dacce01 (diff)
downloadmutter-a8a348185b2237443c8125f9d19ef59507640160.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 351bc589c..ce4384006 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -1071,19 +1071,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)
{