[gtk+/wip/wayland-tablet: 1865/1865] wayland: Hook tablets to GdkSeat



commit 3bfec575079e4d0eca52683e856b8d210951443a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jan 26 19:25:19 2016 +0100

    wayland: Hook tablets to GdkSeat
    
    Those are now also grabbed togetther with other master pointers,
    so everything is able to interoperate on eg. popups triggered by
    other devices.

 gdk/wayland/gdkdevice-wayland.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 561ade6..8fc6364 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -3545,6 +3545,7 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
   guint32 evtime = event ? gdk_event_get_time (event) : GDK_CURRENT_TIME;
   GdkDisplay *display = gdk_seat_get_display (seat);
   GdkWindow *native;
+  GList *l;
 
   native = gdk_window_get_toplevel (window);
 
@@ -3644,6 +3645,29 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
                                     FALSE);
     }
 
+  for (l = wayland_seat->tablets; l; l = l->next)
+    {
+      GdkWaylandTabletData *tablet = l->data;
+      GdkWindow *prev_focus = gdk_wayland_device_get_focus (tablet->master);
+
+      if (prev_focus != window)
+        device_emit_grab_crossing (tablet->master, prev_focus,
+                                   window, GDK_CROSSING_GRAB, evtime);
+
+      _gdk_display_add_device_grab (display,
+                                    tablet->master,
+                                    window,
+                                    native,
+                                    GDK_OWNERSHIP_NONE,
+                                    owner_events,
+                                    GDK_ALL_EVENTS_MASK,
+                                    _gdk_display_get_next_serial (display),
+                                    evtime,
+                                    FALSE);
+
+      gdk_wayland_device_update_window_cursor (tablet->master);
+    }
+
   return GDK_GRAB_SUCCESS;
 }
 
@@ -3653,6 +3677,7 @@ gdk_wayland_seat_ungrab (GdkSeat *seat)
   GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
   GdkDisplay *display = gdk_seat_get_display (seat);
   GdkDeviceGrabInfo *grab;
+  GList *l;
 
   g_clear_object (&wayland_seat->grab_cursor);
 
@@ -3695,6 +3720,16 @@ gdk_wayland_seat_ungrab (GdkSeat *seat)
       if (grab)
         grab->serial_end = grab->serial_start;
     }
+
+  for (l = wayland_seat->tablets; l; l = l->next)
+    {
+      GdkWaylandTabletData *tablet = l->data;
+
+      grab = _gdk_display_get_last_device_grab (display, tablet->master);
+
+      if (grab)
+        grab->serial_end = grab->serial_start;
+    }
 }
 
 static GdkDevice *


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