unlockDialog: Support clock/prompt switching via scrolling

SwipeTracker "only" handles touch gestures and smooth scrolling.
Scrolling still makes sense for regular mice as well though, so
add handling for that as well.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/972
This commit is contained in:
Florian Müllner 2020-02-11 17:46:11 +01:00 committed by Georges Basile Stavracas Neto
parent 9e5071849c
commit d43401cc74

View File

@ -443,6 +443,18 @@ var UnlockDialog = GObject.registerClass({
this._swipeTracker.connect('update', this._swipeUpdate.bind(this)); this._swipeTracker.connect('update', this._swipeUpdate.bind(this));
this._swipeTracker.connect('end', this._swipeEnd.bind(this)); this._swipeTracker.connect('end', this._swipeEnd.bind(this));
this.connect('scroll-event', (o, event) => {
if (this._swipeTracker.canHandleScrollEvent(event))
return Clutter.EVENT_PROPAGATE;
let direction = event.get_scroll_direction();
if (direction === Clutter.ScrollDirection.UP)
this._showClock();
else if (direction === Clutter.ScrollDirection.DOWN)
this._showPrompt();
return Clutter.EVENT_STOP;
});
this._activePage = null; this._activePage = null;
let tapAction = new Clutter.TapAction(); let tapAction = new Clutter.TapAction();