From 63e69131bde3f533db2844a7e6f3d1300cbdad64 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 15 Nov 2022 13:07:13 +0000 Subject: [PATCH] wayland: Move input_grab_seat to GdkWaylandPopup This is popup-only functionality. --- gdk/wayland/gdksurface-wayland-private.h | 2 -- gdk/wayland/gdksurface-wayland.c | 25 ++++++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland-private.h b/gdk/wayland/gdksurface-wayland-private.h index 72f7cab658..1de8c9d463 100644 --- a/gdk/wayland/gdksurface-wayland-private.h +++ b/gdk/wayland/gdksurface-wayland-private.h @@ -54,8 +54,6 @@ struct _GdkWaylandSurface int pending_buffer_offset_x; int pending_buffer_offset_y; - GdkSeat *grab_input_seat; - gint64 pending_frame_counter; guint32 scale; diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 13c39ff64d..0ad9d50240 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -168,6 +168,8 @@ struct _GdkWaylandPopup uint32_t reposition_token; uint32_t received_reposition_token; + + GdkSeat *grab_input_seat; }; typedef struct @@ -2775,22 +2777,25 @@ static GdkWaylandSeat * find_grab_input_seat (GdkSurface *surface, GdkSurface *parent) { - GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface); - GdkWaylandSurface *tmp_impl; + GdkWaylandPopup *popup = GDK_WAYLAND_POPUP (surface); + GdkWaylandPopup *tmp_popup; /* Use the device that was used for the grab as the device for * the popup surface setup - so this relies on GTK taking the * grab before showing the popup surface. */ - if (impl->grab_input_seat) - return GDK_WAYLAND_SEAT (impl->grab_input_seat); + if (popup->grab_input_seat) + return GDK_WAYLAND_SEAT (popup->grab_input_seat); while (parent) { - tmp_impl = GDK_WAYLAND_SURFACE (parent); + if (!GDK_IS_WAYLAND_POPUP (parent)) + break; - if (tmp_impl->grab_input_seat) - return GDK_WAYLAND_SEAT (tmp_impl->grab_input_seat); + tmp_popup = GDK_WAYLAND_POPUP (parent); + + if (tmp_popup->grab_input_seat) + return GDK_WAYLAND_SEAT (tmp_popup->grab_input_seat); parent = parent->parent; } @@ -4348,12 +4353,12 @@ void _gdk_wayland_surface_set_grab_seat (GdkSurface *surface, GdkSeat *seat) { - GdkWaylandSurface *impl; + GdkWaylandPopup *popup; g_return_if_fail (surface != NULL); - impl = GDK_WAYLAND_SURFACE (surface); - impl->grab_input_seat = seat; + popup = GDK_WAYLAND_POPUP (surface); + popup->grab_input_seat = seat; } /** -- 2.30.2