From 149b608bfc246b635dc9e6b95e6b840593a3f407 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 15 Nov 2022 14:47:23 +0000 Subject: [PATCH] wayland: Move next_layout into popup and toplevel This is where it belongs. --- gdk/wayland/gdksurface-wayland-private.h | 20 ------------- gdk/wayland/gdksurface-wayland.c | 36 +++++++++++++++--------- 2 files changed, 23 insertions(+), 33 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland-private.h b/gdk/wayland/gdksurface-wayland-private.h index 1de8c9d463..3020da1dd5 100644 --- a/gdk/wayland/gdksurface-wayland-private.h +++ b/gdk/wayland/gdksurface-wayland-private.h @@ -74,32 +74,12 @@ struct _GdkWaylandSurface int saved_height; struct { - struct { - int width; - int height; - GdkToplevelState state; - gboolean is_resizing; - - int bounds_width; - int bounds_height; - gboolean has_bounds; - } toplevel; - gboolean is_initial_configure; - uint32_t serial; gboolean is_dirty; } pending; struct { - struct { - gboolean should_constrain; - gboolean size_is_fixed; - } toplevel; - struct { - int x; - int y; - } popup; int configured_width; int configured_height; gboolean surface_geometry_dirty; diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 93c8180315..952ccc9340 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -103,6 +103,11 @@ struct _GdkWaylandToplevel gboolean has_bounds; } pending; + struct { + gboolean should_constrain; + gboolean size_is_fixed; + } next_layout; + struct { GdkWaylandToplevelExported callback; gpointer user_data; @@ -177,6 +182,11 @@ struct _GdkWaylandPopup gboolean has_repositioned_token; } pending; + struct { + int x; + int y; + } next_layout; + uint32_t reposition_token; uint32_t received_reposition_token; @@ -549,8 +559,8 @@ configure_popup_geometry (GdkWaylandPopup *wayland_popup) int x, y; int width, height; - x = wayland_surface->next_layout.popup.x - wayland_surface->shadow_left; - y = wayland_surface->next_layout.popup.y - wayland_surface->shadow_top; + x = wayland_popup->next_layout.x - wayland_surface->shadow_left; + y = wayland_popup->next_layout.y - wayland_surface->shadow_top; width = wayland_surface->next_layout.configured_width + (wayland_surface->shadow_left + wayland_surface->shadow_right); @@ -1349,7 +1359,7 @@ configure_toplevel_geometry (GdkWaylandToplevel *wayland_toplevel) height = wayland_surface->next_layout.configured_height + wayland_surface->shadow_top + wayland_surface->shadow_bottom; - if (wayland_surface->next_layout.toplevel.should_constrain) + if (wayland_toplevel->next_layout.should_constrain) { gdk_surface_constrain_size (&wayland_toplevel->geometry_hints, wayland_toplevel->geometry_mask, @@ -1358,9 +1368,9 @@ configure_toplevel_geometry (GdkWaylandToplevel *wayland_toplevel) } gdk_wayland_surface_update_size (surface, width, height, wayland_surface->scale); - if (!wayland_surface->next_layout.toplevel.size_is_fixed) + if (!wayland_toplevel->next_layout.size_is_fixed) { - wayland_surface->next_layout.toplevel.should_constrain = FALSE; + wayland_toplevel->next_layout.should_constrain = FALSE; wayland_surface->next_layout.configured_width = 0; wayland_surface->next_layout.configured_height = 0; } @@ -1450,28 +1460,28 @@ gdk_wayland_surface_configure_toplevel (GdkWaylandToplevel *wayland_toplevel) { if (!saved_size) { - wayland_surface->next_layout.toplevel.should_constrain = TRUE; + wayland_toplevel->next_layout.should_constrain = TRUE; /* Save size for next time we get 0x0 */ _gdk_wayland_surface_save_size (surface); } else if (is_resizing) { - wayland_surface->next_layout.toplevel.should_constrain = TRUE; + wayland_toplevel->next_layout.should_constrain = TRUE; } else { - wayland_surface->next_layout.toplevel.should_constrain = FALSE; + wayland_toplevel->next_layout.should_constrain = FALSE; } - wayland_surface->next_layout.toplevel.size_is_fixed = fixed_size; + wayland_toplevel->next_layout.size_is_fixed = fixed_size; wayland_surface->next_layout.configured_width = width; wayland_surface->next_layout.configured_height = height; } else { - wayland_surface->next_layout.toplevel.should_constrain = FALSE; - wayland_surface->next_layout.toplevel.size_is_fixed = FALSE; + wayland_toplevel->next_layout.should_constrain = FALSE; + wayland_toplevel->next_layout.size_is_fixed = FALSE; wayland_surface->next_layout.configured_width = 0; wayland_surface->next_layout.configured_height = 0; } @@ -1558,8 +1568,8 @@ gdk_wayland_surface_configure_popup (GdkWaylandPopup *wayland_popup) width, height, wayland_popup->layout); - wayland_surface->next_layout.popup.x = x; - wayland_surface->next_layout.popup.y = y; + wayland_popup->next_layout.x = x; + wayland_popup->next_layout.y = y; wayland_surface->next_layout.configured_width = width; wayland_surface->next_layout.configured_height = height; wayland_surface->next_layout.surface_geometry_dirty = TRUE; -- 2.30.2