From ae2c28af89376f69438100f1409042ec78d0ebc2 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 1 Apr 2023 01:39:47 +0200 Subject: [PATCH] wayland: Check correct interface buffer scale is a surface property, so check the version of the surface interface, not the compositor one. --- gdk/wayland/gdkseat-wayland.c | 2 +- gdk/wayland/gdksurface-wayland.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gdk/wayland/gdkseat-wayland.c b/gdk/wayland/gdkseat-wayland.c index 9f9cc57df1..fedfd5b5de 100644 --- a/gdk/wayland/gdkseat-wayland.c +++ b/gdk/wayland/gdkseat-wayland.c @@ -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; diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 9374685dbd..38d3cb54e0 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -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;