[Spice-commits] src/spice-widget.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 9 15:54:45 UTC 2023
src/spice-widget.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
New commits:
commit 5e88a10dc891e3693cab76533506af0425770901
Author: msizanoen1 <msizanoen at qtmlabs.xyz>
Date: Sat Dec 10 17:47:21 2022 +0700
spice-widget: fix hotspot position on Wayland/HiDPI
Same as a945a3c24b11de017a3b22acb5085fec59efa662 but for Wayland.
Fixes breakage caused by GTK behavior change in
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5159.
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 5f7c061..7b5b5c1 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -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;
}
More information about the Spice-commits
mailing list