[gtk: 1/2] gdk/broadway: correct gdk_broadway_device_query_state() to return pointer coordinates relative to th




commit 2acd10d7b0b1be2cbb6eefb0a6254cd3caad3ffa
Author: Maxim Zakharov <dp maxime gmail com>
Date:   Wed Sep 21 15:20:03 2022 +1000

    gdk/broadway: correct gdk_broadway_device_query_state() to return pointer
    coordinates relative to the upper left corner of surface

 gdk/broadway/gdkdevice-broadway.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gdk/broadway/gdkdevice-broadway.c b/gdk/broadway/gdkdevice-broadway.c
index 37be4fa1ef..da4bc256de 100644
--- a/gdk/broadway/gdkdevice-broadway.c
+++ b/gdk/broadway/gdkdevice-broadway.c
@@ -84,6 +84,7 @@ gdk_broadway_device_query_state (GdkDevice         *device,
   gint32 device_root_x, device_root_y;
   guint32 mouse_toplevel_id;
   guint32 mask32;
+  int origin_x, origin_y;
 
   if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
     return;
@@ -97,10 +98,12 @@ gdk_broadway_device_query_state (GdkDevice         *device,
                                     &device_root_y,
                                     &mask32);
 
+  gdk_surface_get_origin (surface, &origin_x, &origin_y);
+
   if (win_x)
-    *win_x = device_root_x;
+    *win_x = device_root_x - origin_x;
   if (win_y)
-    *win_y = device_root_y;
+    *win_y = device_root_y - origin_y;
   if (mask)
     *mask = mask32;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]