|
|
e251e4 |
From 4926a9b8f958617d67d603622b1382c17fe4037c Mon Sep 17 00:00:00 2001
|
|
|
e251e4 |
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
e251e4 |
Date: Wed, 20 May 2020 12:05:04 +0200
|
|
|
e251e4 |
Subject: [PATCH 1/2] workspacesView: Avoid setting invalid geometries on views
|
|
|
e251e4 |
|
|
|
e251e4 |
The fullGeometry and the actualGeometry of the WorkspacesDisplay are set
|
|
|
e251e4 |
from the allocation of the overviews ControlsManager and the
|
|
|
e251e4 |
WorkspacesDisplay, that means they're only valid after those actors got
|
|
|
e251e4 |
their allocations during Clutters allocation cycle.
|
|
|
e251e4 |
|
|
|
e251e4 |
Since WorkspacesDisplay._updateWorkspacesViews() is already called while
|
|
|
e251e4 |
showing/mapping the WorkspacesDisplay, that allocation cycle didn't
|
|
|
e251e4 |
happen yet and we end up either setting the geometries of the views to
|
|
|
e251e4 |
null (in case of the fullGeometry) or to something wrong (a 0-sized
|
|
|
e251e4 |
allocation in case of the actualGeometry).
|
|
|
e251e4 |
|
|
|
e251e4 |
So avoid setting invalid geometries on the views by initializing both
|
|
|
e251e4 |
the fullGeometry and the actualGeometry to null, and then only updating
|
|
|
e251e4 |
the geometries of the views after they're set to a correct value.
|
|
|
e251e4 |
|
|
|
e251e4 |
Note that this means we won't correctly animate the overview the first
|
|
|
e251e4 |
time we open it since the animation depends on the geometries being set,
|
|
|
e251e4 |
but is being started from show(), which means no allocations have
|
|
|
e251e4 |
happened yet. In practice this introduces no regression though since
|
|
|
e251e4 |
before this change we simply used incorrect geometries (see the 0-sized
|
|
|
e251e4 |
allocation mentioned above) on the initial opening and the animation
|
|
|
e251e4 |
didn't work either.
|
|
|
e251e4 |
|
|
|
e251e4 |
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1119
|
|
|
e251e4 |
---
|
|
|
e251e4 |
js/ui/workspacesView.js | 28 +++++++++++++++++-----------
|
|
|
e251e4 |
1 file changed, 17 insertions(+), 11 deletions(-)
|
|
|
e251e4 |
|
|
|
e251e4 |
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
|
|
|
e251e4 |
index e302296a6..02baddc6e 100644
|
|
|
e251e4 |
--- a/js/ui/workspacesView.js
|
|
|
e251e4 |
+++ b/js/ui/workspacesView.js
|
|
|
e251e4 |
@@ -521,6 +521,7 @@ var WorkspacesDisplay = class {
|
|
|
e251e4 |
this._scrollEventId = 0;
|
|
|
e251e4 |
this._keyPressEventId = 0;
|
|
|
e251e4 |
|
|
|
e251e4 |
+ this._actualGeometry = null;
|
|
|
e251e4 |
this._fullGeometry = null;
|
|
|
e251e4 |
}
|
|
|
e251e4 |
|
|
|
e251e4 |
@@ -675,8 +676,10 @@ var WorkspacesDisplay = class {
|
|
|
e251e4 |
|
|
|
e251e4 |
this._workspacesViews.forEach(v => v.actor.show());
|
|
|
e251e4 |
|
|
|
e251e4 |
- this._updateWorkspacesFullGeometry();
|
|
|
e251e4 |
- this._updateWorkspacesActualGeometry();
|
|
|
e251e4 |
+ if (this._fullGeometry)
|
|
|
e251e4 |
+ this._syncWorkspacesFullGeometry();
|
|
|
e251e4 |
+ if (this._actualGeometry)
|
|
|
e251e4 |
+ this._syncWorkspacesActualGeometry();
|
|
|
e251e4 |
}
|
|
|
e251e4 |
|
|
|
e251e4 |
_scrollValueChanged() {
|
|
|
e251e4 |
@@ -739,10 +742,10 @@ var WorkspacesDisplay = class {
|
|
|
e251e4 |
// the sliding controls were never slid in at all.
|
|
|
e251e4 |
setWorkspacesFullGeometry(geom) {
|
|
|
e251e4 |
this._fullGeometry = geom;
|
|
|
e251e4 |
- this._updateWorkspacesFullGeometry();
|
|
|
e251e4 |
+ this._syncWorkspacesFullGeometry();
|
|
|
e251e4 |
}
|
|
|
e251e4 |
|
|
|
e251e4 |
- _updateWorkspacesFullGeometry() {
|
|
|
e251e4 |
+ _syncWorkspacesFullGeometry() {
|
|
|
e251e4 |
if (!this._workspacesViews.length)
|
|
|
e251e4 |
return;
|
|
|
e251e4 |
|
|
|
e251e4 |
@@ -754,18 +757,21 @@ var WorkspacesDisplay = class {
|
|
|
e251e4 |
}
|
|
|
e251e4 |
|
|
|
e251e4 |
_updateWorkspacesActualGeometry() {
|
|
|
e251e4 |
+ const [x, y] = this.actor.get_transformed_position();
|
|
|
e251e4 |
+ const width = this.actor.allocation.get_width();
|
|
|
e251e4 |
+ const height = this.actor.allocation.get_height();
|
|
|
e251e4 |
+
|
|
|
e251e4 |
+ this._actualGeometry = { x, y, width, height };
|
|
|
e251e4 |
+ this._syncWorkspacesActualGeometry();
|
|
|
e251e4 |
+ }
|
|
|
e251e4 |
+
|
|
|
e251e4 |
+ _syncWorkspacesActualGeometry() {
|
|
|
e251e4 |
if (!this._workspacesViews.length)
|
|
|
e251e4 |
return;
|
|
|
e251e4 |
|
|
|
e251e4 |
- let [x, y] = this.actor.get_transformed_position();
|
|
|
e251e4 |
- let allocation = this.actor.allocation;
|
|
|
e251e4 |
- let width = allocation.x2 - allocation.x1;
|
|
|
e251e4 |
- let height = allocation.y2 - allocation.y1;
|
|
|
e251e4 |
- let primaryGeometry = { x: x, y: y, width: width, height: height };
|
|
|
e251e4 |
-
|
|
|
e251e4 |
let monitors = Main.layoutManager.monitors;
|
|
|
e251e4 |
for (let i = 0; i < monitors.length; i++) {
|
|
|
e251e4 |
- let geometry = (i == this._primaryIndex) ? primaryGeometry : monitors[i];
|
|
|
e251e4 |
+ let geometry = i === this._primaryIndex ? this._actualGeometry : monitors[i];
|
|
|
e251e4 |
this._workspacesViews[i].setActualGeometry(geometry);
|
|
|
e251e4 |
}
|
|
|
e251e4 |
}
|
|
|
e251e4 |
--
|
|
|
e251e4 |
2.26.2
|
|
|
e251e4 |
|
|
|
e251e4 |
|
|
|
e251e4 |
From 4671eebccf4e6afce8c0a869d63095b39aa7e163 Mon Sep 17 00:00:00 2001
|
|
|
e251e4 |
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
e251e4 |
Date: Wed, 20 May 2020 13:39:11 +0200
|
|
|
e251e4 |
Subject: [PATCH 2/2] workspacesView: Only animate on show() when geometries
|
|
|
e251e4 |
are already set
|
|
|
e251e4 |
|
|
|
e251e4 |
Animating the window clones of the overview requires the fullGeometry
|
|
|
e251e4 |
and the actualGeometry to be set, which they won't be when showing the
|
|
|
e251e4 |
overview for the first time. So don't even try to animate the window
|
|
|
e251e4 |
clones in that case because the geometries will still be null and
|
|
|
e251e4 |
accessing them in workspace.js will throw errors.
|
|
|
e251e4 |
|
|
|
e251e4 |
The workspace views will still get the correct layout as soon as the
|
|
|
e251e4 |
allocations happen because syncing the geometries will trigger updating
|
|
|
e251e4 |
the window positions. Since animations are disabled for position changes
|
|
|
e251e4 |
when syncing the geometry though, we won't get an animation and the
|
|
|
e251e4 |
clones will jump into place. That's not a regression though since before
|
|
|
e251e4 |
this change we also didn't animate in that case because the geometries
|
|
|
e251e4 |
used were simply wrong (the actualGeometry was 0-sized as explained in
|
|
|
e251e4 |
the last commit).
|
|
|
e251e4 |
|
|
|
e251e4 |
If we wanted to fix the initial animation of the overview, we'd have to
|
|
|
e251e4 |
always enable animations of the window clones when syncing geometries,
|
|
|
e251e4 |
but that would break the animation of the workspace when hovering the
|
|
|
e251e4 |
workspaceThumbnail slider, because right now those animations are "glued
|
|
|
e251e4 |
together" using the actualGeometry, so they would get out of sync.
|
|
|
e251e4 |
|
|
|
e251e4 |
The reason there are no errors happening in workspace.js with the
|
|
|
e251e4 |
existing code is that due to a bug in Clutter the fullGeometry of
|
|
|
e251e4 |
WorkspacesDisplay gets set very early while mapping the WorkspacesViews
|
|
|
e251e4 |
(because the overviews ControlsManager gets an allocation during the
|
|
|
e251e4 |
resource scale calculation of a ClutterClone, see
|
|
|
e251e4 |
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1181), so it
|
|
|
e251e4 |
won't be set to null anymore when calling
|
|
|
e251e4 |
WorkspacesView.animateToOverview().
|
|
|
e251e4 |
|
|
|
e251e4 |
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1119
|
|
|
e251e4 |
---
|
|
|
e251e4 |
js/ui/workspacesView.js | 17 ++++++++++-------
|
|
|
e251e4 |
1 file changed, 10 insertions(+), 7 deletions(-)
|
|
|
e251e4 |
|
|
|
e251e4 |
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
|
|
|
e251e4 |
index 02baddc6e..3e9d77655 100644
|
|
|
e251e4 |
--- a/js/ui/workspacesView.js
|
|
|
e251e4 |
+++ b/js/ui/workspacesView.js
|
|
|
e251e4 |
@@ -589,13 +589,16 @@ var WorkspacesDisplay = class {
|
|
|
e251e4 |
|
|
|
e251e4 |
show(fadeOnPrimary) {
|
|
|
e251e4 |
this._updateWorkspacesViews();
|
|
|
e251e4 |
- for (let i = 0; i < this._workspacesViews.length; i++) {
|
|
|
e251e4 |
- let animationType;
|
|
|
e251e4 |
- if (fadeOnPrimary && i == this._primaryIndex)
|
|
|
e251e4 |
- animationType = AnimationType.FADE;
|
|
|
e251e4 |
- else
|
|
|
e251e4 |
- animationType = AnimationType.ZOOM;
|
|
|
e251e4 |
- this._workspacesViews[i].animateToOverview(animationType);
|
|
|
e251e4 |
+
|
|
|
e251e4 |
+ if (this._actualGeometry && this._fullGeometry) {
|
|
|
e251e4 |
+ for (let i = 0; i < this._workspacesViews.length; i++) {
|
|
|
e251e4 |
+ let animationType;
|
|
|
e251e4 |
+ if (fadeOnPrimary && i == this._primaryIndex)
|
|
|
e251e4 |
+ animationType = AnimationType.FADE;
|
|
|
e251e4 |
+ else
|
|
|
e251e4 |
+ animationType = AnimationType.ZOOM;
|
|
|
e251e4 |
+ this._workspacesViews[i].animateToOverview(animationType);
|
|
|
e251e4 |
+ }
|
|
|
e251e4 |
}
|
|
|
e251e4 |
|
|
|
e251e4 |
this._restackedNotifyId =
|
|
|
e251e4 |
--
|
|
|
e251e4 |
2.26.2
|
|
|
e251e4 |
|