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