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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3401>
This commit is contained in:
Sebastian Wick 2023-11-15 16:59:21 +01:00
parent 47814fab71
commit 976bcef3d5

View File

@ -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;
}