[mutter/wip/multitouch: 67/73] device-map: Implement passive touch grabs in XI2 backend



commit 0eefb6b30624feb53fd8f08627b28cfb50154060
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Sep 2 21:35:40 2011 +0200

    device-map: Implement passive touch grabs in XI2 backend

 src/core/device-map-xi2.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/src/core/device-map-xi2.c b/src/core/device-map-xi2.c
index 10690df..7a3bb21 100644
--- a/src/core/device-map-xi2.c
+++ b/src/core/device-map-xi2.c
@@ -189,6 +189,45 @@ meta_device_map_xi2_constructed (GObject *object)
 }
 
 static void
+meta_device_map_xi2_grab_touch (MetaDeviceMap *device_map,
+                                Window         xwindow)
+{
+  XIGrabModifiers unused = { 0 };
+  MetaDisplay *display;
+  XIEventMask mask;
+
+  display = meta_device_map_get_display (device_map);
+
+  g_message ("Grabbing passively on touch begin\n");
+
+  mask.deviceid = XIAllMasterDevices;
+  mask.mask = meta_device_xi2_translate_event_mask (META_INPUT_TOUCH_EVENTS_MASK |
+                                                    ButtonPressMask |
+                                                    ButtonReleaseMask |
+                                                    PointerMotionMask |
+                                                    KeyPressMask |
+                                                    KeyReleaseMask,
+                                                    &mask.mask_len);
+  XIGrabTouchBegin (display->xdisplay,
+                    XIAllMasterDevices,
+                    xwindow, True,
+                    &mask, 1, &unused);
+}
+
+static void
+meta_device_map_xi2_ungrab_touch (MetaDeviceMap *device_map,
+                                  Window         xwindow)
+{
+  XIGrabModifiers unused = { 0 };
+  MetaDisplay *display;
+
+  display = meta_device_map_get_display (device_map);
+  XIUngrabTouchBegin (display->xdisplay,
+                      XIAllMasterDevices,
+                      xwindow, 0, &unused);
+}
+
+static void
 meta_device_map_xi2_class_init (MetaDeviceMapXI2Class *klass)
 {
   MetaDeviceMapClass *device_map_class = META_DEVICE_MAP_CLASS (klass);
@@ -200,6 +239,8 @@ meta_device_map_xi2_class_init (MetaDeviceMapXI2Class *klass)
   device_map_class->ungrab_key = meta_device_map_xi2_ungrab_key;
   device_map_class->grab_button = meta_device_map_xi2_grab_button;
   device_map_class->ungrab_button = meta_device_map_xi2_ungrab_button;
+  device_map_class->grab_touch = meta_device_map_xi2_grab_touch;
+  device_map_class->ungrab_touch = meta_device_map_xi2_ungrab_touch;
 }
 
 static void



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