[gnome-shell] workspaceThumbnail: Clean up porthole/workarea setting and updating
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] workspaceThumbnail: Clean up porthole/workarea setting and updating
- Date: Wed, 30 Jan 2019 09:13:47 +0000 (UTC)
commit f6da36ad3a660ddc8e1378ce36103820168ec80d
Author: verdre <verdre v0yd nl>
Date: Fri Jan 11 23:50:09 2019 +0100
workspaceThumbnail: Clean up porthole/workarea setting and updating
Instead of unnecessarily updating the porthole on every call to the
layout vfuncs and returning widths and heights of 0 when the overview is
hidden, only update it on actual workarea changes.
Also use the stage size for the porthole in case no monitor is available
to make sure we don't try to allocate a 0-sized box.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/892,
https://gitlab.gnome.org/GNOME/gnome-shell/issues/517
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/343
js/ui/workspaceThumbnail.js | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index f56e549ff..05167eeae 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -624,6 +624,10 @@ class ThumbnailsBox extends St.Widget {
this._indicator = indicator;
this.add_actor(indicator);
+ // The porthole is the part of the screen we're showing in the thumbnails
+ this._porthole = { width: global.stage.width, height: global.stage.height,
+ x: global.stage.x, y: global.stage.y };
+
this._dropWorkspace = -1;
this._dropPlaceholderPos = -1;
this._dropPlaceholder = new St.Bin({ style_class: 'placeholder' });
@@ -675,6 +679,9 @@ class ThumbnailsBox extends St.Widget {
this._createThumbnails();
});
+ global.display.connect('workareas-changed',
+ this._updatePorthole.bind(this));
+
this._switchWorkspaceNotifyId = 0;
this._nWorkspacesNotifyId = 0;
this._syncStackingId = 0;
@@ -912,7 +919,6 @@ class ThumbnailsBox extends St.Widget {
for (let w = 0; w < this._thumbnails.length; w++)
this._thumbnails[w].destroy();
this._thumbnails = [];
- this._porthole = null;
}
_workspacesChanged() {
@@ -945,8 +951,6 @@ class ThumbnailsBox extends St.Widget {
addThumbnails(start, count) {
let workspaceManager = global.workspace_manager;
- if (!this._ensurePorthole())
- return;
for (let k = start; k < start + count; k++) {
let metaWorkspace = workspaceManager.get_workspace_by_index(k);
let thumbnail = new WorkspaceThumbnail(metaWorkspace);
@@ -1126,10 +1130,6 @@ class ThumbnailsBox extends St.Widget {
// Note that for getPreferredWidth/Height we cheat a bit and skip propagating
// the size request to our children because we know how big they are and know
// that the actors aren't depending on the virtual functions being called.
-
- if (!this._ensurePorthole())
- return [0, 0];
-
let workspaceManager = global.workspace_manager;
let themeNode = this.get_theme_node();
@@ -1143,9 +1143,6 @@ class ThumbnailsBox extends St.Widget {
}
vfunc_get_preferred_width(forHeight) {
- if (!this._ensurePorthole())
- return [0, 0];
-
let workspaceManager = global.workspace_manager;
let themeNode = this.get_theme_node();
@@ -1165,16 +1162,14 @@ class ThumbnailsBox extends St.Widget {
return themeNode.adjust_preferred_width(width, width);
}
- // The "porthole" is the portion of the screen that we show in the
- // workspaces
- _ensurePorthole() {
- if (!Main.layoutManager.primaryMonitor || !Main.overview.visible)
- return false;
-
- if (!this._porthole)
+ _updatePorthole() {
+ if (!Main.layoutManager.primaryMonitor)
+ this._porthole = { width: global.stage.width, height: global.stage.height,
+ x: global.stage.x, y: global.stage.y };
+ else
this._porthole = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
- return true;
+ this.queue_relayout();
}
vfunc_allocate(box, flags) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]