From 976bcef3d5981d1d923eba7867bf3da0e4b4c929 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Wed, 15 Nov 2023 16:59:21 +0100 Subject: [PATCH] window-actor/wayland: Sync geometry only when window is mapped In some cases the window is not mapped when the geometry changes. Without the mapped window the surfaces are not mapped either and don't have a sensible allocation. This patch makes sure we abort syncing the geometry if the window is not mapped and also make sure we sync geometry when the actor eventually does get mapped. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3152 Fixes: 8f4ab53bd ("window-actor/wayland: Ensure to use allocation for black background check") Part-of: --- src/compositor/meta-window-actor-wayland.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/compositor/meta-window-actor-wayland.c b/src/compositor/meta-window-actor-wayland.c index b66619751..2f2e08432 100644 --- a/src/compositor/meta-window-actor-wayland.c +++ b/src/compositor/meta-window-actor-wayland.c @@ -536,6 +536,9 @@ meta_window_actor_wayland_sync_geometry (MetaWindowActor *actor, if (window->unmanaging) return; + if (!clutter_actor_is_mapped (CLUTTER_ACTOR (actor))) + return; + if (maybe_configure_black_background (self, &surfaces_width, &surfaces_height, &background_width, &background_height)) @@ -600,10 +603,26 @@ meta_window_actor_wayland_constructed (GObject *object) self->surface_container); } +static void +meta_window_actor_wayland_map (ClutterActor *self) +{ + ClutterActorClass *parent_class = + CLUTTER_ACTOR_CLASS (meta_window_actor_wayland_parent_class); + MetaWindowActor *window_actor = META_WINDOW_ACTOR (self); + MetaWindow *window = meta_window_actor_get_meta_window (window_actor); + MtkRectangle actor_rect; + + meta_window_get_buffer_rect (window, &actor_rect); + meta_window_actor_wayland_sync_geometry (window_actor, &actor_rect); + + parent_class->map (self); +} + static void meta_window_actor_wayland_class_init (MetaWindowActorWaylandClass *klass) { MetaWindowActorClass *window_actor_class = META_WINDOW_ACTOR_CLASS (klass); + ClutterActorClass *clutter_actor_class = CLUTTER_ACTOR_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass); window_actor_class->get_scanout_candidate = meta_window_actor_wayland_get_scanout_candidate; @@ -619,6 +638,8 @@ meta_window_actor_wayland_class_init (MetaWindowActorWaylandClass *klass) window_actor_class->sync_geometry = meta_window_actor_wayland_sync_geometry; window_actor_class->is_single_surface_actor = meta_window_actor_wayland_is_single_surface_actor; + clutter_actor_class->map = meta_window_actor_wayland_map; + object_class->constructed = meta_window_actor_wayland_constructed; object_class->dispose = meta_window_actor_wayland_dispose; }