gdk: Drop GdkGrabOwnership

We no longer expose such low level tweaks, this is essentially
unused.
This commit is contained in:
Carlos Garnacho 2020-06-22 23:54:46 +02:00
parent 59a8106373
commit 5f29b8fcec
11 changed files with 11 additions and 104 deletions

View File

@ -1108,7 +1108,6 @@ 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,

View File

@ -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,

View File

@ -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)

View File

@ -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,

View File

@ -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,

View File

@ -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);

View File

@ -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,

View File

@ -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),

View File

@ -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;

View File

@ -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);

View File

@ -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;