[gtk+] wayland: Implement GdkDevice::window_at_position for touch



commit d221119d149b74fd2a998196f3719fb4779a3ac4
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 19 20:23:44 2015 +0100

    wayland: Implement GdkDevice::window_at_position for touch
    
    This goes through its own master pointer, so look up the pointer
    emulating touch focus window and coordinates.

 gdk/wayland/gdkdevice-wayland.c |   41 +++++++++++++++++++++++++++++++++-----
 1 files changed, 35 insertions(+), 6 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 58f5b9e..cce562e 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -595,16 +595,45 @@ gdk_wayland_device_window_at_position (GdkDevice       *device,
                                        gboolean         get_toplevel)
 {
   GdkWaylandDeviceData *wd;
+  GdkWindow *window = NULL;
 
   wd = GDK_WAYLAND_DEVICE(device)->device;
-  if (win_x)
-    *win_x = wd->surface_x;
-  if (win_y)
-    *win_y = wd->surface_y;
+
+  if (device == wd->master_pointer)
+    {
+      if (win_x)
+        *win_x = wd->surface_x;
+      if (win_y)
+        *win_y = wd->surface_y;
+
+      if (mask)
+        *mask |= wd->button_modifiers;
+
+      window = wd->pointer_focus;
+    }
+  else if (device == wd->touch_master)
+    {
+      GdkWaylandTouchData *touch;
+
+      touch = GDK_WAYLAND_DEVICE(device)->emulating_touch;
+
+      if (touch)
+        {
+          if (win_x)
+            *win_x = touch->x;
+          if (win_y)
+            *win_y = touch->y;
+          if (mask)
+            *mask |= GDK_BUTTON1_MASK;
+
+          window = touch->window;
+        }
+    }
+
   if (mask)
-    *mask = wd->button_modifiers | wd->key_modifiers;
+    *mask = wd->key_modifiers;
 
-  return wd->pointer_focus;
+  return window;
 }
 
 static void


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