[gtk/wip/synthetic-motion2: 27/30] broadway: Fix up surface_at_position




commit 76fa8b700cd8fd6fe7295945dc9c15e896d853b6
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Aug 26 16:52:03 2020 -0400

    broadway: Fix up surface_at_position

 gdk/broadway/gdkdevice-broadway.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/gdk/broadway/gdkdevice-broadway.c b/gdk/broadway/gdkdevice-broadway.c
index 1a815c278c..37be4fa1ef 100644
--- a/gdk/broadway/gdkdevice-broadway.c
+++ b/gdk/broadway/gdkdevice-broadway.c
@@ -233,10 +233,32 @@ gdk_broadway_device_surface_at_position (GdkDevice       *device,
                                          double          *win_y,
                                          GdkModifierType *mask)
 {
-  GdkSurface *surface = NULL;
+  GdkDisplay *display;
+  GdkBroadwayDisplay *broadway_display;
+  gint32 device_root_x, device_root_y;
+  guint32 mouse_toplevel_id;
+  guint32 mask32;
+
+  if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
+    return NULL;
+
+  display = gdk_device_get_display (device);
+  broadway_display = GDK_BROADWAY_DISPLAY (display);
+
+  _gdk_broadway_server_query_mouse (broadway_display->server,
+                                    &mouse_toplevel_id,
+                                    &device_root_x,
+                                    &device_root_y,
+                                    &mask32);
 
-  gdk_broadway_device_query_state (device, NULL, win_x, win_y, mask);
+  if (win_x)
+    *win_x = device_root_x;
+  if (win_y)
+    *win_y = device_root_y;
+  if (mask)
+    *mask = mask32;
 
-  return surface;
+  return g_hash_table_lookup (broadway_display->id_ht,
+                              GUINT_TO_POINTER (mouse_toplevel_id));
 }
 


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