[gnome-shell] ScreenShield: Allow lifting up the curtain with the mouse wheel
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] ScreenShield: Allow lifting up the curtain with the mouse wheel
- Date: Mon, 3 Sep 2012 15:20:50 +0000 (UTC)
commit f177bd0b51a5129f55133134b69e774725fffd71
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun Sep 2 14:48:08 2012 +0200
ScreenShield: Allow lifting up the curtain with the mouse wheel
On a traditional mouse, or with edge-scrolling on a touchpad, it just
feels natural to unlock by scrolling up.
https://bugzilla.gnome.org/show_bug.cgi?id=683164
js/ui/screenShield.js | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index ad8ecae..fd096c9 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -355,6 +355,8 @@ const ScreenShield = new Lang.Class({
});
this._lockScreenGroup.connect('key-release-event',
Lang.bind(this, this._onLockScreenKeyRelease));
+ this._lockScreenGroup.connect('scroll-event',
+ Lang.bind(this, this._onLockScreenScroll));
this._lockScreenContents = new St.Widget({ layout_manager: new Clutter.BinLayout(),
name: 'lockScreenContents' });
@@ -439,6 +441,27 @@ const ScreenShield = new Lang.Class({
return true;
},
+ _onLockScreenScroll: function(actor, event) {
+ if (this._lockScreenState != MessageTray.State.SHOWN)
+ return false;
+
+ let delta = 0;
+ if (event.get_scroll_direction() == Clutter.ScrollDirection.UP)
+ delta = 5;
+ else if (event.get_scroll_direction() == Clutter.ScrollDirection.SMOOTH)
+ delta = Math.max(0, event.get_scroll_delta()[0]);
+
+ this._lockScreenScrollCounter += delta;
+
+ // 7 standard scrolls to lift up
+ if (this._lockScreenScrollCounter > 35) {
+ this._ensureUnlockDialog();
+ this._hideLockScreen(0);
+ }
+
+ return true;
+ },
+
_animateArrows: function() {
let arrows = this._arrowContainer.get_children();
let unitaryDelay = ARROW_ANIMATION_TIME / (arrows.length + 1);
@@ -656,6 +679,7 @@ const ScreenShield = new Lang.Class({
this._lockScreenState = MessageTray.State.SHOWN;
this._lockScreenGroup.fixed_position_set = false;
+ this._lockScreenScrollCounter = 0;
this.emit('lock-screen-shown');
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]