[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 1/6] ui/gtk: Consider the scaling factor when getting the root
From: |
Vivek Kasireddy |
Subject: |
[PATCH v2 1/6] ui/gtk: Consider the scaling factor when getting the root coordinates |
Date: |
Thu, 17 Nov 2022 17:44:21 -0800 |
Since gdk_window_get_root_coords() expects a position within the window,
we need to translate Guest's cooridinates to window local coordinates
by multiplying them with the scaling factor.
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Dongwon Kim <dongwon.kim@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
---
ui/gtk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index 92daaa6a6e..6c23903173 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -456,7 +456,8 @@ static void gd_mouse_set(DisplayChangeListener *dcl,
dpy = gtk_widget_get_display(vc->gfx.drawing_area);
gdk_window_get_root_coords(gtk_widget_get_window(vc->gfx.drawing_area),
- x, y, &x_root, &y_root);
+ x * vc->gfx.scale_x, y * vc->gfx.scale_y,
+ &x_root, &y_root);
gdk_device_warp(gd_get_pointer(dpy),
gtk_widget_get_screen(vc->gfx.drawing_area),
x_root, y_root);
--
2.37.2
- [PATCH v2 0/6] ui/gtk: Add a new parameter to assign connectors/monitors (v2), Vivek Kasireddy, 2022/11/17
- [PATCH v2 1/6] ui/gtk: Consider the scaling factor when getting the root coordinates,
Vivek Kasireddy <=
- [PATCH v2 2/6] ui/gtk-gl-area: Don't forget to calculate the scaling factors in draw, Vivek Kasireddy, 2022/11/17
- [PATCH v2 4/6] ui/gtk: Disable the scanout when a detached tab is closed, Vivek Kasireddy, 2022/11/17
- [PATCH v2 3/6] ui/gtk: Handle relative mode events correctly with Wayland compositors, Vivek Kasireddy, 2022/11/17
- [PATCH v2 5/6] ui/gtk: Factor out tab window creation into a separate function, Vivek Kasireddy, 2022/11/17
- [PATCH v2 6/6] ui/gtk: Add a new parameter to assign connectors/monitors to GFX VCs (v2), Vivek Kasireddy, 2022/11/17