summaryrefslogtreecommitdiff
path: root/gdk/wayland/gdkdevice-wayland.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-11-19 20:23:44 +0100
committerCarlos Garnacho <carlosg@gnome.org>2015-11-19 23:26:48 +0100
commitd221119d149b74fd2a998196f3719fb4779a3ac4 (patch)
treec42c9a67a9fa225357dfdbba7338386abda386bd /gdk/wayland/gdkdevice-wayland.c
parentc405f810cdc8f1de7d60dde4f5e31ee81a88a382 (diff)
downloadgtk+-d221119d149b74fd2a998196f3719fb4779a3ac4.tar.gz
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.
Diffstat (limited to 'gdk/wayland/gdkdevice-wayland.c')
-rw-r--r--gdk/wayland/gdkdevice-wayland.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 58f5b9ef77..cce562e905 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