[gnome-shell/gnome-41] layout: Check again for primary monitor after startup animation idle



commit 9b38e3a5c20dac65a146b84b72da0ea070d6eeb5
Author: 13r0ck <bnr tuta io>
Date:   Tue Feb 1 13:04:19 2022 -0700

    layout: Check again for primary monitor after startup animation idle
    
    On some hardware combinations the display can be known, then unknown again. Meaining that
    when the update monitors function is called it will have a value, then be called again
    setting this.primaryMonitor to null. If the timing is just right gnome shell will
    loadBackground, then by the time the animation is ready the monitor will be gone,
    thus methods will be called on a null value. This adds more checks for a valid
    primary monitor, and wont play the animation until the system is idle AND has a valid
    priamry monitor.
    
    Fixes: #5003
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2144>
    (cherry picked from commit 85b51b9974e253e90ced85cd77090eb0b6d33d02)

 js/ui/layout.js | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index 70ece6cab8..951c42fb8d 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -616,10 +616,14 @@ var LayoutManager = GObject.registerClass({
             // This helps to prevent us from running the animation
             // when the system is bogged down
             const id = GLib.idle_add(GLib.PRIORITY_LOW, () => {
-                this._systemBackground.show();
-                global.stage.show();
-                this._prepareStartupAnimation();
-                return GLib.SOURCE_REMOVE;
+                if (this.primaryMonitor) {
+                    this._systemBackground.show();
+                    global.stage.show();
+                    this._prepareStartupAnimation();
+                    return GLib.SOURCE_REMOVE;
+                } else {
+                    return GLib.SOURCE_CONTINUE;
+                }
             });
             GLib.Source.set_name_by_id(id, '[gnome-shell] Startup Animation');
         });


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]