From d42a34b0b3a1ad20bb4b0f1e2f5fbc1180cb03d7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 15 Nov 2022 12:37:18 +0000 Subject: [PATCH] wayland: Move reposition_token to GdkWaylandPopup This is only used for popups, so move it there. --- gdk/wayland/gdksurface-wayland-private.h | 3 --- gdk/wayland/gdksurface-wayland.c | 17 ++++++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland-private.h b/gdk/wayland/gdksurface-wayland-private.h index b348d9d7a6..72f7cab658 100644 --- a/gdk/wayland/gdksurface-wayland-private.h +++ b/gdk/wayland/gdksurface-wayland-private.h @@ -45,9 +45,6 @@ struct _GdkWaylandSurface struct wl_event_queue *event_queue; - uint32_t reposition_token; - uint32_t received_reposition_token; - unsigned int initial_configure_received : 1; unsigned int has_uncommitted_ack_configure : 1; unsigned int mapped : 1; diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 9334df6c11..13c39ff64d 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -165,6 +165,9 @@ struct _GdkWaylandPopup uint32_t repositioned_token; gboolean has_repositioned_token; } pending; + + uint32_t reposition_token; + uint32_t received_reposition_token; }; typedef struct @@ -1508,12 +1511,12 @@ gdk_wayland_surface_configure_popup (GdkWaylandPopup *wayland_popup) } if (wayland_popup->pending.has_repositioned_token) - wayland_surface->received_reposition_token = wayland_popup->pending.repositioned_token; + wayland_popup->received_reposition_token = wayland_popup->pending.repositioned_token; switch (wayland_popup->state) { case POPUP_STATE_WAITING_FOR_REPOSITIONED: - if (wayland_surface->received_reposition_token != wayland_surface->reposition_token) + if (wayland_popup->received_reposition_token != wayland_popup->reposition_token) return; else gdk_surface_thaw_updates (surface); @@ -3093,7 +3096,7 @@ do_queue_relayout (GdkWaylandPopup *wayland_popup, TRUE); xdg_popup_reposition (wayland_surface->display_server.xdg_popup, positioner, - ++wayland_surface->reposition_token); + ++wayland_popup->reposition_token); xdg_positioner_destroy (positioner); gdk_surface_freeze_updates (GDK_SURFACE (wayland_popup)); @@ -3122,8 +3125,12 @@ is_relayout_finished (GdkSurface *surface) if (!impl->initial_configure_received) return FALSE; - if (impl->reposition_token != impl->received_reposition_token) - return FALSE; + if (GDK_IS_WAYLAND_POPUP (surface)) + { + GdkWaylandPopup *popup = GDK_WAYLAND_POPUP (surface); + if (popup->reposition_token != popup->received_reposition_token) + return FALSE; + } return TRUE; } -- 2.30.2