[gnome-shell] windowManager: Allow switching workspaces with super-scroll
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] windowManager: Allow switching workspaces with super-scroll
- Date: Thu, 4 Feb 2021 20:07:49 +0000 (UTC)
commit 7aa36ad239cc4ad138629a4bac1df974388bca5c
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jan 29 20:33:23 2021 +0100
windowManager: Allow switching workspaces with super-scroll
So far, we couldn't allow workspace scrolling outside the overview
because scroll events were always sent to clients. However mutter
was changed recently to pass on scroll events when the mouse button
modifier (usually super) is pressed, which allows us to enable the
same workspace scrolling as in the overview now.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1612>
js/ui/windowManager.js | 10 ++++++++++
js/ui/workspaceAnimation.js | 10 +++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index f4176dae67..f113fed385 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -862,6 +862,16 @@ var WindowManager = class {
Shell.ActionMode.OVERVIEW,
this._switchToApplication.bind(this));
+ global.stage.connect('scroll-event', (stage, event) => {
+ if (this._workspaceAnimation.canHandleScrollEvent(event))
+ return Clutter.EVENT_PROPAGATE;
+
+ if ((event.get_state() & global.display.compositor_modifiers) === 0)
+ return Clutter.EVENT_PROPAGATE;
+
+ return this.handleWorkspaceScroll(event);
+ });
+
global.display.connect('show-resize-popup', this._showResizePopup.bind(this));
global.display.connect('show-pad-osd', this._showPadOsd.bind(this));
global.display.connect('show-osd', (display, monitorIndex, iconName, label) => {
diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js
index 856da8f491..6cac580e71 100644
--- a/js/ui/workspaceAnimation.js
+++ b/js/ui/workspaceAnimation.js
@@ -284,11 +284,15 @@ var WorkspaceAnimationController = class {
});
const swipeTracker = new SwipeTracker.SwipeTracker(global.stage,
- Shell.ActionMode.NORMAL, { allowDrag: false, allowScroll: false });
+ Shell.ActionMode.NORMAL, { allowDrag: false });
swipeTracker.connect('begin', this._switchWorkspaceBegin.bind(this));
swipeTracker.connect('update', this._switchWorkspaceUpdate.bind(this));
swipeTracker.connect('end', this._switchWorkspaceEnd.bind(this));
this._swipeTracker = swipeTracker;
+
+ global.display.bind_property('compositor-modifiers',
+ this._swipeTracker, 'scroll-modifiers',
+ GObject.BindingFlags.SYNC_CREATE);
}
_prepareWorkspaceSwitch(workspaceIndices) {
@@ -390,6 +394,10 @@ var WorkspaceAnimationController = class {
}
}
+ canHandleScrollEvent(event) {
+ return this._swipeTracker.canHandleScrollEvent(event);
+ }
+
_findMonitorGroup(monitorIndex) {
return this._switchData.monitors.find(m => m.index === monitorIndex);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]