wayland: Check correct interface
authorBenjamin Otte <otte@redhat.com>
Fri, 31 Mar 2023 23:39:47 +0000 (01:39 +0200)
committerBenjamin Otte <otte@redhat.com>
Sat, 1 Apr 2023 00:22:21 +0000 (02:22 +0200)
buffer scale is a surface property, so check the version of the surface
interface, not the compositor one.

gdk/wayland/gdkseat-wayland.c
gdk/wayland/gdksurface-wayland.c

index 9f9cc57df1aeb34b445fdbac066e66fadc7f8d9d..fedfd5b5deb57ea547902afdd686a9cf43f757aa 100644 (file)
@@ -3771,7 +3771,7 @@ pointer_surface_update_scale (GdkDevice *device)
   guint32 scale;
   GSList *l;
 
-  if (wl_compositor_get_version (display_wayland->compositor) < WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
+  if (wl_surface_get_version (pointer->pointer_surface) < WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
     {
       /* We can't set the scale on this surface */
       return;
index 9374685dbd7873c5a126e17414cf627518d8c483..38d3cb54e0dd6fa13495d7b52d44976118a74791 100644 (file)
@@ -426,7 +426,8 @@ gdk_wayland_surface_update_scale (GdkSurface *surface)
   guint32 scale;
   GSList *l;
 
-  if (wl_compositor_get_version (display_wayland->compositor) < WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
+  if (!impl->display_server.wl_surface ||
+      wl_surface_get_version (impl->display_server.wl_surface) < WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
     {
       /* We can't set the scale on this surface */
       return;
@@ -782,7 +783,6 @@ static void
 gdk_wayland_surface_sync_buffer_scale (GdkSurface *surface)
 {
   GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
-  GdkWaylandDisplay *display;
 
   if (!impl->display_server.wl_surface)
     return;
@@ -791,8 +791,7 @@ gdk_wayland_surface_sync_buffer_scale (GdkSurface *surface)
     return;
 
   /* Only set the buffer scale if supported by the compositor */
-  display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
-  if (wl_compositor_get_version (display->compositor) >= WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
+  if (wl_surface_get_version (impl->display_server.wl_surface) >= WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
     wl_surface_set_buffer_scale (impl->display_server.wl_surface, impl->scale);
 
   impl->buffer_scale_dirty = FALSE;