From 933fdc24f2e09566139a375dc45d188faacdbbbb Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 19 Apr 2019 23:08:24 +0000 Subject: [PATCH] gdk: Remove remnants of client-side windows Now that all surfaces are native, we don't need to separately keep track of grab surfaces and their native ancestor anymore. --- gdk/broadway/gdkdevice-broadway.c | 2 +- gdk/gdkdevice.c | 10 +++---- gdk/gdkdisplay.c | 3 --- gdk/gdkdisplayprivate.h | 2 -- gdk/wayland/gdkdevice-wayland.c | 44 +++++++++++++------------------ gdk/x11/gdkmain-x11.c | 2 +- 6 files changed, 24 insertions(+), 39 deletions(-) diff --git a/gdk/broadway/gdkdevice-broadway.c b/gdk/broadway/gdkdevice-broadway.c index a51ecc416d..6b3621d7d8 100644 --- a/gdk/broadway/gdkdevice-broadway.c +++ b/gdk/broadway/gdkdevice-broadway.c @@ -215,7 +215,7 @@ _gdk_broadway_surface_grab_check_destroy (GdkSurface *surface) /* Make sure there is no lasting grab in this native surface */ grab = _gdk_display_get_last_device_grab (display, d->data); - if (grab && grab->native_surface == surface) + if (grab && grab->surface == surface) { grab->serial_end = grab->serial_start; grab->implicit_ungrab = TRUE; diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c index a919bd2814..8e99f2e6c2 100644 --- a/gdk/gdkdevice.c +++ b/gdk/gdkdevice.c @@ -1237,7 +1237,7 @@ get_native_grab_event_mask (GdkEventMask grab_mask) GdkGrabStatus gdk_device_grab (GdkDevice *device, - GdkSurface *surface, + GdkSurface *surface, GdkGrabOwnership grab_ownership, gboolean owner_events, GdkEventMask event_mask, @@ -1245,19 +1245,16 @@ gdk_device_grab (GdkDevice *device, guint32 time_) { GdkGrabStatus res; - GdkSurface *native; g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_GRAB_FAILED); g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_GRAB_FAILED); g_return_val_if_fail (gdk_surface_get_display (surface) == gdk_device_get_display (device), GDK_GRAB_FAILED); - native = surface; - - if (GDK_SURFACE_DESTROYED (native)) + if (GDK_SURFACE_DESTROYED (surface)) return GDK_GRAB_NOT_VIEWABLE; res = GDK_DEVICE_GET_CLASS (device)->grab (device, - native, + surface, owner_events, get_native_grab_event_mask (event_mask), NULL, @@ -1275,7 +1272,6 @@ gdk_device_grab (GdkDevice *device, _gdk_display_add_device_grab (display, device, surface, - native, grab_ownership, owner_events, event_mask, diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index b623593fe4..3e7cb2c847 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -336,7 +336,6 @@ static void free_device_grab (GdkDeviceGrabInfo *info) { g_object_unref (info->surface); - g_object_unref (info->native_surface); g_free (info); } @@ -558,7 +557,6 @@ GdkDeviceGrabInfo * _gdk_display_add_device_grab (GdkDisplay *display, GdkDevice *device, GdkSurface *surface, - GdkSurface *native_surface, GdkGrabOwnership grab_ownership, gboolean owner_events, GdkEventMask event_mask, @@ -572,7 +570,6 @@ _gdk_display_add_device_grab (GdkDisplay *display, info = g_new0 (GdkDeviceGrabInfo, 1); info->surface = g_object_ref (surface); - info->native_surface = g_object_ref (native_surface); info->serial_start = serial_start; info->serial_end = G_MAXULONG; info->owner_events = owner_events; diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h index 986a18b575..8a16a28f42 100644 --- a/gdk/gdkdisplayprivate.h +++ b/gdk/gdkdisplayprivate.h @@ -41,7 +41,6 @@ typedef struct _GdkDisplayClass GdkDisplayClass; typedef struct { GdkSurface *surface; - GdkSurface *native_surface; gulong serial_start; gulong serial_end; /* exclusive, i.e. not active on serial_end */ guint event_mask; @@ -200,7 +199,6 @@ GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display, GdkDeviceGrabInfo * _gdk_display_add_device_grab (GdkDisplay *display, GdkDevice *device, GdkSurface *surface, - GdkSurface *native_surface, GdkGrabOwnership grab_ownership, gboolean owner_events, GdkEventMask event_mask, diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 5e3fca5b7b..5b4e17d552 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -728,20 +728,20 @@ device_maybe_emit_grab_crossing (GdkDevice *device, GdkSurface *window, guint32 time) { - GdkSurface *native = gdk_wayland_device_get_focus (device); + GdkSurface *surface = gdk_wayland_device_get_focus (device); GdkSurface *focus = window; - if (focus != native) + if (focus != surface) device_emit_grab_crossing (device, focus, window, GDK_CROSSING_GRAB, time); } static GdkSurface* -device_maybe_emit_ungrab_crossing (GdkDevice *device, - guint32 time) +device_maybe_emit_ungrab_crossing (GdkDevice *device, + guint32 time_) { GdkDeviceGrabInfo *grab; GdkSurface *focus = NULL; - GdkSurface *native = NULL; + GdkSurface *surface = NULL; GdkSurface *prev_focus = NULL; focus = gdk_wayland_device_get_focus (device); @@ -751,21 +751,21 @@ device_maybe_emit_ungrab_crossing (GdkDevice *device, { grab->serial_end = grab->serial_start; prev_focus = grab->surface; - native = grab->native_surface; + surface = grab->surface; } - if (focus != native) - device_emit_grab_crossing (device, prev_focus, focus, GDK_CROSSING_UNGRAB, time); + if (focus != surface) + device_emit_grab_crossing (device, prev_focus, focus, GDK_CROSSING_UNGRAB, time_); return prev_focus; } static GdkGrabStatus gdk_wayland_device_grab (GdkDevice *device, - GdkSurface *surface, + GdkSurface *surface, gboolean owner_events, GdkEventMask event_mask, - GdkSurface *confine_to, + GdkSurface *confine_to, GdkCursor *cursor, guint32 time_) { @@ -787,7 +787,7 @@ gdk_wayland_device_grab (GdkDevice *device, { /* Device is a keyboard */ gdk_wayland_surface_inhibit_shortcuts (surface, - gdk_device_get_seat (device)); + gdk_device_get_seat (device)); return GDK_GRAB_SUCCESS; } else @@ -4614,7 +4614,7 @@ gdk_wayland_seat_set_grab_surface (GdkWaylandSeat *seat, static GdkGrabStatus gdk_wayland_seat_grab (GdkSeat *seat, - GdkSurface *surface, + GdkSurface *surface, GdkSeatCapabilities capabilities, gboolean owner_events, GdkCursor *cursor, @@ -4625,15 +4625,12 @@ gdk_wayland_seat_grab (GdkSeat *seat, GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat); guint32 evtime = event ? gdk_event_get_time (event) : GDK_CURRENT_TIME; GdkDisplay *display = gdk_seat_get_display (seat); - GdkSurface *native; GList *l; - native = surface; - - if (native == NULL || GDK_SURFACE_DESTROYED (native)) + if (surface == NULL || GDK_SURFACE_DESTROYED (surface)) return GDK_GRAB_NOT_VIEWABLE; - gdk_wayland_seat_set_grab_surface (wayland_seat, native); + gdk_wayland_seat_set_grab_surface (wayland_seat, surface); wayland_seat->grab_time = evtime; if (prepare_func) @@ -4651,12 +4648,11 @@ gdk_wayland_seat_grab (GdkSeat *seat, capabilities & GDK_SEAT_CAPABILITY_POINTER) { device_maybe_emit_grab_crossing (wayland_seat->master_pointer, - native, evtime); + surface, evtime); _gdk_display_add_device_grab (display, wayland_seat->master_pointer, surface, - native, GDK_OWNERSHIP_NONE, owner_events, GDK_ALL_EVENTS_MASK, @@ -4673,12 +4669,11 @@ gdk_wayland_seat_grab (GdkSeat *seat, capabilities & GDK_SEAT_CAPABILITY_TOUCH) { device_maybe_emit_grab_crossing (wayland_seat->touch_master, - native, evtime); + surface, evtime); _gdk_display_add_device_grab (display, wayland_seat->touch_master, surface, - native, GDK_OWNERSHIP_NONE, owner_events, GDK_ALL_EVENTS_MASK, @@ -4691,12 +4686,11 @@ gdk_wayland_seat_grab (GdkSeat *seat, capabilities & GDK_SEAT_CAPABILITY_KEYBOARD) { device_maybe_emit_grab_crossing (wayland_seat->master_keyboard, - native, evtime); + surface, evtime); _gdk_display_add_device_grab (display, wayland_seat->master_keyboard, surface, - native, GDK_OWNERSHIP_NONE, owner_events, GDK_ALL_EVENTS_MASK, @@ -4716,12 +4710,12 @@ gdk_wayland_seat_grab (GdkSeat *seat, { GdkWaylandTabletData *tablet = l->data; - device_maybe_emit_grab_crossing (tablet->master, native, evtime); + device_maybe_emit_grab_crossing (tablet->master, + surface, evtime); _gdk_display_add_device_grab (display, tablet->master, surface, - native, GDK_OWNERSHIP_NONE, owner_events, GDK_ALL_EVENTS_MASK, diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index 5082e05ff3..0ce77b3048 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -177,7 +177,7 @@ _gdk_x11_surface_grab_check_destroy (GdkSurface *surface) /* Make sure there is no lasting grab in this native surface */ grab = _gdk_display_get_last_device_grab (display, d->data); - if (grab && grab->native_surface == surface) + if (grab && grab->surface == surface) { /* We don't know the actual serial to end, but it doesn't really matter as this only happens