[gnome-shell] Switch all external uses of Main.panel.actor.height to the work area
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Switch all external uses of Main.panel.actor.height to the work area
- Date: Thu, 7 Feb 2013 03:36:30 +0000 (UTC)
commit 12ac2e5534e96a3cdf79152cb283579986a04d04
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Jan 28 00:09:12 2013 -0500
Switch all external uses of Main.panel.actor.height to the work area
https://bugzilla.gnome.org/show_bug.cgi?id=692680
js/ui/layout.js | 7 +++++++
js/ui/overview.js | 8 +++-----
js/ui/panelMenu.js | 6 ++----
js/ui/workspaceSwitcherPopup.js | 18 ++++++++----------
js/ui/workspaceThumbnail.js | 9 +--------
5 files changed, 21 insertions(+), 27 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index a3a32eb..f308c44 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -634,6 +634,13 @@ const LayoutManager = new Lang.Class({
}
},
+ getWorkAreaForMonitor: function(monitorIndex) {
+ // Assume that all workspaces will have the same
+ // struts and pick the first one.
+ let ws = global.screen.get_workspace_by_index(0);
+ return ws.get_work_area_for_monitor(monitorIndex);
+ },
+
// This call guarantees that we return some monitor to simplify usage of it
// In practice all tracked actors should be visible on some monitor anyway
findIndexForActor: function(actor) {
diff --git a/js/ui/overview.js b/js/ui/overview.js
index a8f7e4a..75b8f7e 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -374,15 +374,13 @@ const Overview = new Lang.Class({
this.hide();
let primary = Main.layoutManager.primaryMonitor;
-
- let contentY = Main.panel.actor.height;
- let contentHeight = primary.height - contentY - Main.messageTray.actor.height;
+ let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
this._overview.set_position(primary.x, primary.y);
this._overview.set_size(primary.width, primary.height);
- this._coverPane.set_position(0, contentY);
- this._coverPane.set_size(primary.width, contentHeight);
+ this._coverPane.set_position(0, workArea.y);
+ this._coverPane.set_size(workArea.width, workArea.height);
},
_onRestacked: function() {
diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js
index ad3600f..aa935e9 100644
--- a/js/ui/panelMenu.js
+++ b/js/ui/panelMenu.js
@@ -205,10 +205,8 @@ const Button = new Lang.Class({
// Setting the max-height won't do any good if the minimum height of the
// menu is higher then the screen; it's useful if part of the menu is
// scrollable so the minimum height is smaller than the natural height
- let monitor = Main.layoutManager.primaryMonitor;
- this.menu.actor.style = ('max-height: ' +
- Math.round(monitor.height - Main.panel.actor.height) +
- 'px;');
+ let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
+ this.menu.actor.style = ('max-height: ' + Math.round(workArea.height) + 'px;');
},
destroy: function() {
diff --git a/js/ui/workspaceSwitcherPopup.js b/js/ui/workspaceSwitcherPopup.js
index 6bd124d..4005d77 100644
--- a/js/ui/workspaceSwitcherPopup.js
+++ b/js/ui/workspaceSwitcherPopup.js
@@ -55,10 +55,9 @@ const WorkspaceSwitcherPopup = new Lang.Class({
_getPreferredHeight : function (actor, forWidth, alloc) {
let children = this._list.get_children();
- let primary = Main.layoutManager.primaryMonitor;
+ let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
- let availHeight = primary.height;
- availHeight -= Main.panel.actor.height;
+ let availHeight = workArea.height;
availHeight -= this.actor.get_theme_node().get_vertical_padding();
availHeight -= this._container.get_theme_node().get_vertical_padding();
availHeight -= this._list.get_theme_node().get_vertical_padding();
@@ -67,7 +66,7 @@ const WorkspaceSwitcherPopup = new Lang.Class({
for (let i = 0; i < children.length; i++) {
let [childMinHeight, childNaturalHeight] = children[i].get_preferred_height(-1);
let [childMinWidth, childNaturalWidth] = children[i].get_preferred_width(childNaturalHeight);
- height += childNaturalHeight * primary.width / primary.height;
+ height += childNaturalHeight * workArea.width / workArea.height;
}
let spacing = this._itemSpacing * (global.screen.n_workspaces - 1);
@@ -81,8 +80,8 @@ const WorkspaceSwitcherPopup = new Lang.Class({
},
_getPreferredWidth : function (actor, forHeight, alloc) {
- let primary = Main.layoutManager.primaryMonitor;
- this._childWidth = Math.round(this._childHeight * primary.width / primary.height);
+ let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
+ this._childWidth = Math.round(this._childHeight * workArea.width / workArea.height);
alloc.min_size = this._childWidth;
alloc.natural_size = this._childWidth;
@@ -122,12 +121,11 @@ const WorkspaceSwitcherPopup = new Lang.Class({
}
- let primary = Main.layoutManager.primaryMonitor;
+ let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
let [containerMinHeight, containerNatHeight] = this._container.get_preferred_height(global.screen_width);
let [containerMinWidth, containerNatWidth] = this._container.get_preferred_width(containerNatHeight);
- this._container.x = primary.x + Math.floor((primary.width - containerNatWidth) / 2);
- this._container.y = primary.y + Main.panel.actor.height +
- Math.floor(((primary.height - Main.panel.actor.height) - containerNatHeight) / 2);
+ this._container.x = workArea.x + Math.floor((workArea.width - containerNatWidth) / 2);
+ this._container.y = workArea.y + Math.floor((workArea.height - containerNatHeight) / 2);
},
_show : function() {
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index fd68ce5..b0300f6 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -759,14 +759,7 @@ const ThumbnailsBox = new Lang.Class({
this._stateCounts[ThumbnailState[key]] = 0;
// The "porthole" is the portion of the screen that we show in the workspaces
- let panelHeight = Main.panel.actor.height;
- let monitor = Main.layoutManager.primaryMonitor;
- this._porthole = {
- x: monitor.x,
- y: monitor.y + panelHeight,
- width: monitor.width,
- height: monitor.height - panelHeight
- };
+ this._porthole = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
this.addThumbnails(0, global.screen.n_workspaces);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]