From 67a6f343a0ec361bafeedb7883819601f6d3c75d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 19 Mar 2024 20:45:43 -0400 Subject: [PATCH] wayland: Keep pointer_output_scale as double We can round up to the next integer when we need to. --- gdk/wayland/gdkdevice-wayland-private.h | 2 +- gdk/wayland/gdkdevice-wayland.c | 2 +- gdk/wayland/gdkseat-wayland.c | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gdk/wayland/gdkdevice-wayland-private.h b/gdk/wayland/gdkdevice-wayland-private.h index ed45016c73..01ed67dfa8 100644 --- a/gdk/wayland/gdkdevice-wayland-private.h +++ b/gdk/wayland/gdkdevice-wayland-private.h @@ -69,7 +69,7 @@ struct _GdkWaylandPointerData { guint cursor_image_delay; guint touchpad_event_sequence; - guint current_output_scale; + double current_output_scale; GSList *pointer_surface_outputs; /* Accumulated event data for a pointer frame */ diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 2df94d1516..fd03d4fcaa 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -271,7 +271,7 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device) { buffer = _gdk_wayland_cursor_get_buffer (GDK_WAYLAND_DISPLAY (seat->display), pointer->cursor, - pointer->current_output_scale, + (int) ceil (pointer->current_output_scale), pointer->cursor_image_index, &x, &y, &w, &h, &scale); } diff --git a/gdk/wayland/gdkseat-wayland.c b/gdk/wayland/gdkseat-wayland.c index e6bb9441af..268df2abe3 100644 --- a/gdk/wayland/gdkseat-wayland.c +++ b/gdk/wayland/gdkseat-wayland.c @@ -3767,8 +3767,7 @@ pointer_surface_update_scale (GdkDevice *device) GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device); GdkWaylandPointerData *pointer = gdk_wayland_device_get_pointer (wayland_device); - GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display); - guint32 scale; + double scale; GSList *l; if (wl_surface_get_version (pointer->pointer_surface) < WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION) @@ -3783,8 +3782,8 @@ pointer_surface_update_scale (GdkDevice *device) scale = 1; for (l = pointer->pointer_surface_outputs; l != NULL; l = l->next) { - guint32 output_scale = gdk_wayland_display_get_output_scale (display_wayland, l->data); - scale = MAX (scale, output_scale); + GdkMonitor *monitor = gdk_wayland_display_get_monitor_for_output (seat->display, l->data); + scale = MAX (scale, gdk_monitor_get_scale (monitor)); } if (pointer->current_output_scale == scale)