[gtk/wip/carlosg/input-cleanups: 5/26] gdk: Drop GdkGrabOwnership



commit 5f29b8fcecd3acba012e1bc50d2af35fdbd3590f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Jun 22 23:54:46 2020 +0200

    gdk: Drop GdkGrabOwnership
    
    We no longer expose such low level tweaks, this is essentially
    unused.

 gdk/broadway/gdksurface-broadway.c | 13 ++++-----
 gdk/gdkdevice.c                    |  2 --
 gdk/gdkdisplay.c                   | 57 --------------------------------------
 gdk/gdkdisplayprivate.h            |  5 ----
 gdk/gdkinternals.h                 | 16 -----------
 gdk/gdkseatdefault.c               |  4 +--
 gdk/gdksurface.c                   |  8 ------
 gdk/wayland/gdkdevice-wayland.c    |  4 ---
 gdk/win32/gdkdrag-win32.c          |  2 +-
 gdk/win32/gdksurface-win32.c       |  2 +-
 gdk/x11/gdkdrag-x11.c              |  2 +-
 11 files changed, 11 insertions(+), 104 deletions(-)
---
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index f8702247f6..5b278ce7c3 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -1107,13 +1107,12 @@ create_moveresize_surface (MoveResizeData *mv_resize,
 
   G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
   status = gdk_device_grab (pointer,
-                             mv_resize->moveresize_emulation_surface,
-                             GDK_OWNERSHIP_APPLICATION,
-                             FALSE,
-                             GDK_BUTTON_RELEASE_MASK |
-                             GDK_POINTER_MOTION_MASK,
-                             NULL,
-                             timestamp);
+                            mv_resize->moveresize_emulation_surface,
+                            FALSE,
+                            GDK_BUTTON_RELEASE_MASK |
+                            GDK_POINTER_MOTION_MASK,
+                            NULL,
+                            timestamp);
   G_GNUC_END_IGNORE_DEPRECATIONS;
 
   if (status != GDK_GRAB_SUCCESS)
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index a18d4d76b5..29a1fcab47 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -924,7 +924,6 @@ get_native_grab_event_mask (GdkEventMask grab_mask)
 GdkGrabStatus
 gdk_device_grab (GdkDevice        *device,
                  GdkSurface       *surface,
-                 GdkGrabOwnership  grab_ownership,
                  gboolean          owner_events,
                  GdkEventMask      event_mask,
                  GdkCursor        *cursor,
@@ -958,7 +957,6 @@ gdk_device_grab (GdkDevice        *device,
       _gdk_display_add_device_grab (display,
                                     device,
                                     surface,
-                                    grab_ownership,
                                     owner_events,
                                     event_mask,
                                     serial,
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index db13ea52c6..b06f412caf 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -521,7 +521,6 @@ GdkDeviceGrabInfo *
 _gdk_display_add_device_grab (GdkDisplay       *display,
                               GdkDevice        *device,
                               GdkSurface        *surface,
-                              GdkGrabOwnership  grab_ownership,
                               gboolean          owner_events,
                               GdkEventMask      event_mask,
                               unsigned long     serial_start,
@@ -540,7 +539,6 @@ _gdk_display_add_device_grab (GdkDisplay       *display,
   info->event_mask = event_mask;
   info->time = time;
   info->implicit = implicit;
-  info->ownership = grab_ownership;
 
   grabs = g_hash_table_lookup (display->device_grabs, device);
 
@@ -816,61 +814,6 @@ _gdk_display_end_device_grab (GdkDisplay *display,
   return FALSE;
 }
 
-/* Returns TRUE if device events are not blocked by any grab */
-gboolean
-_gdk_display_check_grab_ownership (GdkDisplay *display,
-                                   GdkDevice  *device,
-                                   gulong      serial)
-{
-  GHashTableIter iter;
-  gpointer key, value;
-  GdkGrabOwnership higher_ownership, device_ownership;
-  gboolean device_is_keyboard;
-
-  g_hash_table_iter_init (&iter, display->device_grabs);
-  higher_ownership = device_ownership = GDK_OWNERSHIP_NONE;
-  device_is_keyboard = (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD);
-
-  while (g_hash_table_iter_next (&iter, &key, &value))
-    {
-      GdkDeviceGrabInfo *grab;
-      GdkDevice *dev;
-      GList *grabs;
-
-      dev = key;
-      grabs = value;
-      grabs = grab_list_find (grabs, serial);
-
-      if (!grabs)
-        continue;
-
-      /* Discard device if it's not of the same type */
-      if ((device_is_keyboard && gdk_device_get_source (dev) != GDK_SOURCE_KEYBOARD) ||
-          (!device_is_keyboard && gdk_device_get_source (dev) == GDK_SOURCE_KEYBOARD))
-        continue;
-
-      grab = grabs->data;
-
-      if (dev == device)
-        device_ownership = grab->ownership;
-      else
-        {
-          if (grab->ownership > higher_ownership)
-            higher_ownership = grab->ownership;
-        }
-    }
-
-  if (higher_ownership > device_ownership)
-    {
-      /* There's a higher priority ownership
-       * going on for other device(s)
-       */
-      return FALSE;
-    }
-
-  return TRUE;
-}
-
 GdkPointerSurfaceInfo *
 _gdk_display_get_pointer_info (GdkDisplay *display,
                                GdkDevice  *device)
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index d29cf2ebed..8a50d3cd3a 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -45,7 +45,6 @@ typedef struct
   gulong serial_end; /* exclusive, i.e. not active on serial_end */
   guint event_mask;
   guint32 time;
-  GdkGrabOwnership ownership;
 
   guint activated : 1;
   guint implicit_ungrab : 1;
@@ -187,7 +186,6 @@ GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
 GdkDeviceGrabInfo * _gdk_display_add_device_grab      (GdkDisplay       *display,
                                                        GdkDevice        *device,
                                                        GdkSurface        *surface,
-                                                       GdkGrabOwnership  grab_ownership,
                                                        gboolean          owner_events,
                                                        GdkEventMask      event_mask,
                                                        gulong            serial_start,
@@ -201,9 +199,6 @@ gboolean            _gdk_display_end_device_grab      (GdkDisplay       *display
                                                        gulong            serial,
                                                        GdkSurface        *if_child,
                                                        gboolean          implicit);
-gboolean            _gdk_display_check_grab_ownership (GdkDisplay       *display,
-                                                       GdkDevice        *device,
-                                                       gulong            serial);
 GdkPointerSurfaceInfo * _gdk_display_get_pointer_info  (GdkDisplay       *display,
                                                        GdkDevice        *device);
 void                _gdk_display_pointer_info_foreach (GdkDisplay       *display,
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index b26aac73eb..c42728573e 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -229,21 +229,6 @@ typedef enum
   GDK_GRAB_FAILED          = 5
 } GdkGrabStatus;
 
-/**
- * GdkGrabOwnership:
- * @GDK_OWNERSHIP_NONE: All other devices’ events are allowed.
- * @GDK_OWNERSHIP_SURFACE: Other devices’ events are blocked for the grab surface.
- * @GDK_OWNERSHIP_APPLICATION: Other devices’ events are blocked for the whole application.
- *
- * Defines how device grabs interact with other devices.
- */
-typedef enum
-{
-  GDK_OWNERSHIP_NONE,
-  GDK_OWNERSHIP_SURFACE,
-  GDK_OWNERSHIP_APPLICATION
-} GdkGrabOwnership;
-
 typedef enum
 {
   GDK_EXPOSURE_MASK             = 1 << 1,
@@ -274,7 +259,6 @@ typedef enum
 
 GdkGrabStatus gdk_device_grab (GdkDevice        *device,
                                GdkSurface        *surface,
-                               GdkGrabOwnership  grab_ownership,
                                gboolean          owner_events,
                                GdkEventMask      event_mask,
                                GdkCursor        *cursor,
diff --git a/gdk/gdkseatdefault.c b/gdk/gdkseatdefault.c
index ef0fe299d4..822c8d2e64 100644
--- a/gdk/gdkseatdefault.c
+++ b/gdk/gdkseatdefault.c
@@ -149,7 +149,7 @@ gdk_seat_default_grab (GdkSeat                *seat,
         pointer_evmask |= TOUCH_EVENTS;
 
       status = gdk_device_grab (priv->logical_pointer, surface,
-                                GDK_OWNERSHIP_NONE, owner_events,
+                                owner_events,
                                 pointer_evmask, cursor,
                                 evtime);
     }
@@ -158,7 +158,7 @@ gdk_seat_default_grab (GdkSeat                *seat,
       capabilities & GDK_SEAT_CAPABILITY_KEYBOARD)
     {
       status = gdk_device_grab (priv->logical_keyboard, surface,
-                                GDK_OWNERSHIP_NONE, owner_events,
+                                owner_events,
                                 KEYBOARD_EVENTS, cursor,
                                 evtime);
 
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 93662b8b63..6eac19ac37 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -2245,13 +2245,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
         }
 
       _gdk_display_device_grab_update (display, device, source_device, serial);
-
-      if (!_gdk_display_check_grab_ownership (display, device, serial))
-        {
-          /* Device events are blocked by another device grab */
-          unlink_event = TRUE;
-          goto out;
-        }
     }
 
   event_surface = gdk_event_get_surface (event);
@@ -2274,7 +2267,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
           _gdk_display_add_device_grab (display,
                                         device,
                                         event_surface,
-                                        GDK_OWNERSHIP_NONE,
                                         FALSE,
                                         GDK_ALL_EVENTS_MASK,
                                         serial,
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index b18006b0c6..d9b3ee8fa5 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -4582,7 +4582,6 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
       _gdk_display_add_device_grab (display,
                                     wayland_seat->logical_pointer,
                                     surface,
-                                    GDK_OWNERSHIP_NONE,
                                     owner_events,
                                     GDK_ALL_EVENTS_MASK,
                                     _gdk_display_get_next_serial (display),
@@ -4603,7 +4602,6 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
       _gdk_display_add_device_grab (display,
                                     wayland_seat->logical_touch,
                                     surface,
-                                    GDK_OWNERSHIP_NONE,
                                     owner_events,
                                     GDK_ALL_EVENTS_MASK,
                                     _gdk_display_get_next_serial (display),
@@ -4620,7 +4618,6 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
       _gdk_display_add_device_grab (display,
                                     wayland_seat->logical_keyboard,
                                     surface,
-                                    GDK_OWNERSHIP_NONE,
                                     owner_events,
                                     GDK_ALL_EVENTS_MASK,
                                     _gdk_display_get_next_serial (display),
@@ -4646,7 +4643,6 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
           _gdk_display_add_device_grab (display,
                                         tablet->logical_device,
                                         surface,
-                                        GDK_OWNERSHIP_NONE,
                                         owner_events,
                                         GDK_ALL_EVENTS_MASK,
                                         _gdk_display_get_next_serial (display),
diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c
index a893401bd8..04169bedeb 100644
--- a/gdk/win32/gdkdrag-win32.c
+++ b/gdk/win32/gdkdrag-win32.c
@@ -2048,7 +2048,7 @@ gdk_win32_drag_set_cursor (GdkDrag *drag,
       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
       gdk_device_grab (gdk_seat_get_pointer (drag_win32->grab_seat),
                        drag_win32->grab_surface,
-                       GDK_OWNERSHIP_APPLICATION, FALSE,
+                       FALSE,
                        GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
                        cursor, GDK_CURRENT_TIME);
       G_GNUC_END_IGNORE_DEPRECATIONS;
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 5edb59e9a8..3b26a475ab 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -3762,7 +3762,7 @@ setup_drag_move_resize_context (GdkSurface                   *window,
    * This is why we first do the grab, *then* set the op.
    */
   gdk_device_grab (device, pointer_window,
-                   GDK_OWNERSHIP_NONE, FALSE,
+                   FALSE,
                    GDK_ALL_EVENTS_MASK,
                    context->cursor,
                    timestamp);
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index 7e730e7993..5a08c3af64 100644
--- a/gdk/x11/gdkdrag-x11.c
+++ b/gdk/x11/gdkdrag-x11.c
@@ -2077,7 +2077,7 @@ gdk_x11_drag_set_cursor (GdkDrag   *drag,
       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
       gdk_device_grab (gdk_seat_get_pointer (x11_drag->grab_seat),
                        x11_drag->ipc_surface,
-                       GDK_OWNERSHIP_APPLICATION, FALSE,
+                       FALSE,
                        GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
                        cursor, GDK_CURRENT_TIME);
       G_GNUC_END_IGNORE_DEPRECATIONS;


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