From 2943bfef4635f10ecf6d09dc215ca771e341e8a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 20 Jul 2015 16:01:32 +0800 Subject: [PATCH] wayland: Always apply scaling factor to cursor hotspot and dimension Prior to this patch, the hotspot would be passed in buffer coordinate space. Where this were ever tested, i.e. in a patched mutter, the server interpreted them incorrectly, which meant it went undiscovered. In the updated mutter patches the incorrect behavior in GTK+ was discovered due to the behavior in mutter was corrected. In the themed cursor case, the dimensions were not correctly scaled either, but this had no negative visible effect because the dimension is only used for reporting damage tracking, and passing a bigger damage region than surface has no negative visible effects. https://bugzilla.gnome.org/show_bug.cgi?id=752616 --- gdk/wayland/gdkcursor-wayland.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gdk/wayland/gdkcursor-wayland.c b/gdk/wayland/gdkcursor-wayland.c index 13263cde03..8aee5ae0a9 100644 --- a/gdk/wayland/gdkcursor-wayland.c +++ b/gdk/wayland/gdkcursor-wayland.c @@ -220,19 +220,21 @@ _gdk_wayland_cursor_get_buffer (GdkCursor *cursor, image = wayland_cursor->wl_cursor->images[image_index]; - *hotspot_x = image->hotspot_x; - *hotspot_y = image->hotspot_y; + *hotspot_x = image->hotspot_x / wayland_cursor->scale; + *hotspot_y = image->hotspot_y / wayland_cursor->scale; - *w = image->width; - *h = image->height; + *w = image->width / wayland_cursor->scale; + *h = image->height / wayland_cursor->scale; *scale = wayland_cursor->scale; return wl_cursor_image_get_buffer (image); } else if (wayland_cursor->name == NULL) /* From surface */ { - *hotspot_x = wayland_cursor->surface.hotspot_x; - *hotspot_y = wayland_cursor->surface.hotspot_y; + *hotspot_x = + wayland_cursor->surface.hotspot_x / wayland_cursor->surface.scale; + *hotspot_y = + wayland_cursor->surface.hotspot_y / wayland_cursor->surface.scale; *w = wayland_cursor->surface.width / wayland_cursor->surface.scale; *h = wayland_cursor->surface.height / wayland_cursor->surface.scale;