wayland/glcontext: Don't call wl_surface.offset on old objects
authorJonas Ådahl <jadahl@gmail.com>
Fri, 17 Feb 2023 10:59:14 +0000 (11:59 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Fri, 17 Feb 2023 11:03:27 +0000 (12:03 +0100)
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

index 44e15fa0fd87162e1144fd50d053b1964a87eb68..7becec5ed56df3e6ac5c914880ab6352220371c4 100644 (file)
@@ -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);