Skip to content
Snippets Groups Projects
Commit 5e88a10d authored by msizanoen1's avatar msizanoen1 Committed by Marc-André Lureau
Browse files

spice-widget: fix hotspot position on Wayland/HiDPI

Same as a945a3c2 but for Wayland.

Fixes breakage caused by GTK behavior change in
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5159.
parent f5cc0ca4
No related branches found
No related tags found
1 merge request!114spice-widget: fix hotspot position on Wayland/HiDPI
Pipeline #779409 passed
......@@ -3044,6 +3044,11 @@ static void update_mouse_cursor(SpiceDisplay *display)
gint scale_factor;
gint hotspot_x, hotspot_y;
#if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND)
GdkDisplay *gdk_display = gtk_widget_get_display(GTK_WIDGET(display));
bool should_unscale_hotspot = false;
#endif
if (G_UNLIKELY(!d->mouse_pixbuf)) {
return;
}
......@@ -3080,9 +3085,17 @@ static void update_mouse_cursor(SpiceDisplay *display)
hotspot_x = d->mouse_hotspot.x * scale;
hotspot_y = d->mouse_hotspot.y * scale;
#ifdef GDK_WINDOWING_X11
#if defined(GDK_WINDOWING_X11)
should_unscale_hotspot |= GDK_IS_X11_DISPLAY(gdk_display);
#endif
#if defined(GDK_WINDOWING_WAYLAND)
should_unscale_hotspot |= GDK_IS_WAYLAND_DISPLAY(gdk_display);
#endif
#if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND)
/* undo hotspot scaling in gdkcursor */
if (GDK_IS_X11_DISPLAY(gtk_widget_get_display(GTK_WIDGET(display)))) {
if (should_unscale_hotspot) {
hotspot_x /= scale_factor;
hotspot_y /= scale_factor;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment