layout: Ensure startup animation steps are always performed if monitors changes during init

Especially under X11 we may get "monitors-changed" event while the startup animation is in progress, while some of them were addressed by !2269 (merged), we still have an issue happening:

  • GNOME shell is preparing the animation and awaiting for bg changes
  • Monitors are changed, during this phase we destroy the current background managers
  • => The "loaded" signals we were waiting for, won't ever happen

This implies that we are stuck in await this._updateBackgrounds(); and thus we keep staying in broken mode.

Other than that, if resolution changes during this phase, the clipped area isn't ever updated.

Somehting can be simulated by using this script (sleep times may need to be adjusted):

#!/bin/bash

export XDG_RUNTIME_DIR=/tmp/.test-runtime
export GNOME_SHELL_SLOWDOWN_FACTOR=3
export XDG_SESSION_TYPE=wayland

read -r -d '' CMD <<'EOF'
gnome-shell --nested --unsafe-mode &

sleep 1.0
gdbus call --session --dest org.gnome.Mutter.DisplayConfig \
    --object-path /org/gnome/Mutter/DisplayConfig \
    --method org.gnome.Mutter.DisplayConfig.ApplyMonitorsConfig \
    1 1 '[(0,0,1,0,true,[("LVDS1", "1440x900@60.000", [])])]' []
sleep 0.5
gdbus call --session --dest org.gnome.Mutter.DisplayConfig \
    --object-path /org/gnome/Mutter/DisplayConfig \
    --method org.gnome.Mutter.DisplayConfig.ApplyMonitorsConfig \
    1 1 '[(0,0,1,0,true,[("LVDS1", "1024x768@60.000", [])])]' []
sleep 0.5
gdbus call --session --dest org.gnome.Mutter.DisplayConfig \
    --object-path /org/gnome/Mutter/DisplayConfig \
    --method org.gnome.Mutter.DisplayConfig.ApplyMonitorsConfig \
    1 1 '[(0,0,1,0,true,[("LVDS1", "1440x900@60.000", [])])]' []
sleep 0.5
gdbus call --session --dest org.gnome.Mutter.DisplayConfig \
    --object-path /org/gnome/Mutter/DisplayConfig \
    --method org.gnome.Mutter.DisplayConfig.ApplyMonitorsConfig \
    1 1 '[(0,0,1,0,true,[("LVDS1", "1440x900@60.000", [])])]' []

sleep infinity
EOF

dbus-run-session -- bash -c "$CMD"

To avoid this, we need to restart the prepare animation steps in case monitors have changed while awaiting for background loading.

Closes: #6473

Edited by Marco Trevisan

Merge request reports