From 3183a213472067534ba907d78edf57af96f277a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 17 Feb 2023 11:59:14 +0100 Subject: [PATCH 1/2] wayland/glcontext: Don't call wl_surface.offset on old objects The availability of wl_surface.offset depends on the compositor, so we can't call it unconditionally. Add a version check to so we only call offset if we know we won't raise a protocol error. Fixes: 0eb791eaaa ("Make mask nodes more versatile") --- gdk/wayland/gdkglcontext-wayland.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c index 44e15fa0fd..7becec5ed5 100644 --- a/gdk/wayland/gdkglcontext-wayland.c +++ b/gdk/wayland/gdkglcontext-wayland.c @@ -68,7 +68,9 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context, gdk_wayland_surface_sync (surface); gdk_wayland_surface_request_frame (surface); - wl_surface_offset (impl->display_server.wl_surface, dx, dy); + if (wl_surface_get_version (impl->display_server.wl_surface) >= + WL_SURFACE_OFFSET_SINCE_VERSION) + wl_surface_offset (impl->display_server.wl_surface, dx, dy); GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->end_frame (draw_context, painted); From 53c3f497f1542c09d07cb19e6678b16354261dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 17 Feb 2023 12:03:58 +0100 Subject: [PATCH 2/2] wayland: Clean up some dead code --- gdk/wayland/gdksurface-wayland.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 8e34132bcc..7571c6aa55 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -579,35 +579,12 @@ gdk_wayland_surface_attach_image (GdkSurface *surface, } } -static void -gdk_wayland_surface_sync_offset (GdkSurface *surface) -{ - GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface); - - if (wl_surface_get_version (impl->display_server.wl_surface) < - WL_SURFACE_OFFSET_SINCE_VERSION) - return; - -#if 0 - if (impl->pending_buffer_offset_x == 0 && - impl->pending_buffer_offset_y == 0) - return; - - wl_surface_offset (impl->display_server.wl_surface, - impl->pending_buffer_offset_x, - impl->pending_buffer_offset_y); - impl->pending_buffer_offset_x = 0; - impl->pending_buffer_offset_y = 0; -#endif -} - void gdk_wayland_surface_sync (GdkSurface *surface) { gdk_wayland_surface_sync_shadow (surface); gdk_wayland_surface_sync_opaque_region (surface); gdk_wayland_surface_sync_input_region (surface); - gdk_wayland_surface_sync_offset (surface); } static gboolean