[gnome-shell/gnome-3-24] layout: Skip strut computation in the no-monitor case



commit ebc74957c815a31877f4c66857e662cf973b2a78
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 13 15:53:04 2017 +0200

    layout: Skip strut computation in the no-monitor case
    
    It's possible for updateRegions() to be called before monitors have
    been properly initialized. Instead of throwing an error in that case,
    just skip the strut computation (that doesn't make sense anyway without
    a monitor).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781471

 js/ui/layout.js |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index b1e7f94..4c11e1d 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -969,7 +969,11 @@ const LayoutManager = new Lang.Class({
             if (actorData.affectsInputRegion && wantsInputRegion && actorData.actor.get_paint_visibility())
                 rects.push(new Meta.Rectangle({ x: x, y: y, width: w, height: h }));
 
-            if (actorData.affectsStruts) {
+            let monitor = null;
+            if (actorData.affectsStruts)
+                monitor = this.findMonitorForActor(actorData.actor);
+
+            if (monitor) {
                 // Limit struts to the size of the screen
                 let x1 = Math.max(x, 0);
                 let x2 = Math.min(x + w, global.screen_width);
@@ -986,7 +990,6 @@ const LayoutManager = new Lang.Class({
                 // spans the width/height across the middle of the
                 // screen, then we don't create a strut for it at all.
 
-                let monitor = this.findMonitorForActor(actorData.actor);
                 let side;
                 if (x1 <= monitor.x && x2 >= monitor.x + monitor.width) {
                     if (y1 <= monitor.y)


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