summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-08-26 16:52:03 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-08-26 17:56:41 -0400
commit75915bc782906d600f952f13eaec3d7b375420ac (patch)
treea1724bfc646ee1f7bb17a0bc86cec68b5f019527
parent618891a41a5e8b8fc2064d8d2f5850862fc54683 (diff)
downloadgtk+-75915bc782906d600f952f13eaec3d7b375420ac.tar.gz
broadway: Fix up surface_at_position
-rw-r--r--gdk/broadway/gdkdevice-broadway.c28
1 files 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));
}