workspacesView: Initialize/update swipe orientation before gesture
Separate this logic from _switchWorkspaceBegin() and ensure it is set before this call. The SwipeTracker code uses the orientation to determine whether the gesture should begin at all, so changing the orientation on gesture begin was a bit too late. But also, that meant the SwipeTracker was left at the default orientation, which was vertical (unlike workspaces, and like the overview gesture). This made both swipe trackers try to handle the same swipe, with the WorkspacesView being doubly unfortunate (for triggering in the first place, and for happening after the other gesture did queue relayouts on it). Taking this logic outside of _switchWorkspaceBegin() and having the right orientation beforehand results in both gestures looking for their direction, and not meddle with each other. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1643>
This commit is contained in:
parent
a498d8577e
commit
f69727464c
@ -613,6 +613,10 @@ class WorkspacesDisplay extends St.Widget {
|
||||
this._swipeTracker.connect('end', this._switchWorkspaceEnd.bind(this));
|
||||
this.connect('notify::mapped', this._updateSwipeTracker.bind(this));
|
||||
|
||||
this._layoutRowsNotifyId = workspaceManager.connect(
|
||||
'notify::layout-rows', this._updateTrackerOrientation.bind(this));
|
||||
this._updateTrackerOrientation();
|
||||
|
||||
this._windowDragBeginId =
|
||||
Main.overview.connect('window-drag-begin',
|
||||
this._windowDragBegin.bind(this));
|
||||
@ -649,6 +653,7 @@ class WorkspacesDisplay extends St.Widget {
|
||||
|
||||
global.window_manager.disconnect(this._switchWorkspaceId);
|
||||
global.workspace_manager.disconnect(this._reorderWorkspacesdId);
|
||||
global.workspace_manager.disconnect(this._layoutRowsNotifyId);
|
||||
Main.overview.disconnect(this._windowDragBeginId);
|
||||
Main.overview.disconnect(this._windowDragEndId);
|
||||
}
|
||||
@ -687,6 +692,13 @@ class WorkspacesDisplay extends St.Widget {
|
||||
});
|
||||
}
|
||||
|
||||
_updateTrackerOrientation() {
|
||||
const { layoutRows } = global.workspace_manager;
|
||||
this._swipeTracker.orientation = layoutRows !== -1
|
||||
? Clutter.Orientation.HORIZONTAL
|
||||
: Clutter.Orientation.VERTICAL;
|
||||
}
|
||||
|
||||
_directionForProgress(progress) {
|
||||
if (global.workspace_manager.layout_rows === -1) {
|
||||
return progress > 0
|
||||
@ -712,10 +724,6 @@ class WorkspacesDisplay extends St.Widget {
|
||||
if (this._gestureActive)
|
||||
adjustment.remove_transition('value');
|
||||
|
||||
tracker.orientation = workspaceManager.layout_rows !== -1
|
||||
? Clutter.Orientation.HORIZONTAL
|
||||
: Clutter.Orientation.VERTICAL;
|
||||
|
||||
const distance = global.workspace_manager.layout_rows === -1
|
||||
? this.height : this.width;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user