Blame SOURCES/0001-layout-Don-t-always-extend-struts-to-the-screen-edge.patch

95d442
From 58027e7dcc43290a5d0da167aec23ed46148e938 Mon Sep 17 00:00:00 2001
95d442
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
95d442
Date: Tue, 15 Apr 2014 17:24:07 +0200
95d442
Subject: [PATCH] layout: Don't always extend struts to the screen edge
95d442
95d442
NetWM struts are defined in terms of screen edges (rather than monitor
95d442
edges), which works poorly with vertical monitor layouts (as it renders
95d442
entire monitors unusable). Don't extend struts in those cases.
95d442
95d442
https://bugzilla.gnome.org/show_bug.cgi?id=663690
95d442
---
95d442
 js/ui/layout.js | 30 +++++++++++++++++++++++++-----
95d442
 1 file changed, 25 insertions(+), 5 deletions(-)
95d442
95d442
diff --git a/js/ui/layout.js b/js/ui/layout.js
95d442
index 141eecc..3dcc858 100644
95d442
--- a/js/ui/layout.js
95d442
+++ b/js/ui/layout.js
95d442
@@ -1006,19 +1006,39 @@ const LayoutManager = new Lang.Class({
95d442
                     continue;
95d442
 
95d442
                 // Ensure that the strut rects goes all the way to the screen edge,
95d442
-                // as this really what mutter expects.
95d442
+                // as this really what mutter expects. However skip this step
95d442
+                // in cases where this would render an entire monitor unusable.
95d442
                 switch (side) {
95d442
                 case Meta.Side.TOP:
95d442
-                    y1 = 0;
95d442
+                    let hasMonitorsAbove = this.monitors.some(Lang.bind(this,
95d442
+                        function(mon) {
95d442
+                            return this._isAboveOrBelowPrimary(mon) &&
95d442
+                                   mon.y < primary.y;
95d442
+                        }));
95d442
+                    if (!hasMonitorsAbove)
95d442
+                        y1 = 0;
95d442
                     break;
95d442
                 case Meta.Side.BOTTOM:
95d442
-                    y2 = global.screen_height;
95d442
+                    if (this.primaryIndex == this.bottomIndex)
95d442
+                        y2 = global.screen_height;
95d442
                     break;
95d442
                 case Meta.Side.LEFT:
95d442
-                    x1 = 0;
95d442
+                    let hasMonitorsLeft = this.monitors.some(Lang.bind(this,
95d442
+                        function(mon) {
95d442
+                            return !this._isAboveOrBelowPrimary(mon) &&
95d442
+                                   mon.x < primary.x;
95d442
+                        }));
95d442
+                    if (!hasMonitorsLeft)
95d442
+                        x1 = 0;
95d442
                     break;
95d442
                 case Meta.Side.RIGHT:
95d442
-                    x2 = global.screen_width;
95d442
+                    let hasMonitorsRight = this.monitors.some(Lang.bind(this,
95d442
+                        function(mon) {
95d442
+                            return !this._isAboveOrBelowPrimary(mon) &&
95d442
+                                   mon.x > primary.x;
95d442
+                        }));
95d442
+                    if (!hasMonitorsRight)
95d442
+                        x2 = global.screen_width;
95d442
                     break;
95d442
                 }
95d442
 
95d442
-- 
95d442
1.9.0
95d442