[gnome-shell] workspaceThumbnails: Update indicator on workspace changes
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] workspaceThumbnails: Update indicator on workspace changes
- Date: Wed, 3 Mar 2021 18:07:36 +0000 (UTC)
commit 30f0c9f94399c4a94ff9cf1fd7083e08ad473536
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Mar 2 19:48:55 2021 +0100
workspaceThumbnails: Update indicator on workspace changes
We block state updates while the indicator for the active workspace
is animating. To track that, we check whether the scroll-adjustment's
value matches the active workspace index. That works as long as the
adjustment's value changes after the active workspace, but not when
switching workspaces via SwipeTracker which only changes the active
workspace after transitioning to the new scroll value.
To fix that, update the indicator on workspace changes as well.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1716>
js/ui/workspaceThumbnail.js | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 17d29d0d1a..79c8df2249 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -706,24 +706,13 @@ var ThumbnailsBox = GObject.registerClass({
});
this.connect('destroy', () => this._onDestroy());
- this._switchWorkspaceNotifyId = 0;
this._nWorkspacesNotifyId = 0;
+ this._activeWorkspaceChangedId = 0;
this._syncStackingId = 0;
this._scrollAdjustment = scrollAdjustment;
-
this._scrollValueId = this._scrollAdjustment.connect('notify::value',
- adj => {
- const { workspaceManager } = global;
- const activeIndex = workspaceManager.get_active_workspace_index();
-
- this._animatingIndicator = adj.value !== activeIndex;
-
- if (!this._animatingIndicator)
- this._queueUpdateStates();
-
- this.queue_relayout();
- });
+ () => this._updateIndicator());
}
_onDestroy() {
@@ -762,6 +751,19 @@ var ThumbnailsBox = GObject.registerClass({
this.notify('should-show');
}
+ _updateIndicator() {
+ const { value } = this._scrollAdjustment;
+ const { workspaceManager } = global;
+ const activeIndex = workspaceManager.get_active_workspace_index();
+
+ this._animatingIndicator = value !== activeIndex;
+
+ if (!this._animatingIndicator)
+ this._queueUpdateStates();
+
+ this.queue_relayout();
+ }
+
_activateThumbnailAtPoint(stageX, stageY, time) {
const [r_, x] = this.transform_stage_point(stageX, stageY);
@@ -992,6 +994,9 @@ var ThumbnailsBox = GObject.registerClass({
this._nWorkspacesNotifyId =
workspaceManager.connect('notify::n-workspaces',
this._workspacesChanged.bind(this));
+ this._activeWorkspaceChangedId =
+ workspaceManager.connect('active-workspace-changed',
+ () => this._updateIndicator());
this._workspacesReorderedId =
workspaceManager.connect('workspaces-reordered', () => {
this._thumbnails.sort((a, b) => {
@@ -1019,13 +1024,17 @@ var ThumbnailsBox = GObject.registerClass({
if (this._thumbnails.length == 0)
return;
+ const { workspaceManager } = global;
+
if (this._nWorkspacesNotifyId > 0) {
- let workspaceManager = global.workspace_manager;
workspaceManager.disconnect(this._nWorkspacesNotifyId);
this._nWorkspacesNotifyId = 0;
}
+ if (this._activeWorkspaceChangedId > 0) {
+ workspaceManager.disconnect(this._activeWorkspaceChangedId);
+ this._activeWorkspaceChangedId = 0;
+ }
if (this._workspacesReorderedId > 0) {
- let workspaceManager = global.workspace_manager;
workspaceManager.disconnect(this._workspacesReorderedId);
this._workspacesReorderedId = 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]