wayland: Move reposition_token to GdkWaylandPopup
authorMatthias Clasen <mclasen@redhat.com>
Tue, 15 Nov 2022 12:37:18 +0000 (12:37 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 6 Jan 2023 18:47:34 +0000 (13:47 -0500)
This is only used for popups, so move it there.

gdk/wayland/gdksurface-wayland-private.h
gdk/wayland/gdksurface-wayland.c

index b348d9d7a63b00917b3bbb5e3dded12be0aad8b2..72f7cab658e2a6cdbcd8034e5677da363929c15e 100644 (file)
@@ -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;
index 9334df6c113fa6a26e67e89439f274ad85b03f45..13c39ff64d80db825d16d4a68be644658513232d 100644 (file)
@@ -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;
 }