From d0a94768a6e57abd49f7caeeb12d4674aade44f7 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Fri, 3 Aug 2012 23:31:02 +0200 Subject: [PATCH] ScreenShield: bump the lock screen slightly when pressing a key When pressing a key different from escape (one thus that has no effect), bump the screen up, to indicate that it eats keyboard input and it must be lifted up. https://bugzilla.gnome.org/show_bug.cgi?id=681143 --- js/ui/screenShield.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 75ae7b129..11cc86adf 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -23,6 +23,11 @@ const CURTAIN_SLIDE_TIME = 0.8; // the slide up automatically const ARROW_DRAG_TRESHOLD = 0.1; +// The distance in px that the lock screen will move to when pressing +// a key that has no effect in the lock screen (bumping it) +const BUMP_SIZE = 25; +const BUMP_TIME = 0.3; + const SUMMARY_ICON_SIZE = 48; // Lightbox fading times @@ -348,7 +353,12 @@ const ScreenShield = new Lang.Class({ return true; } - return false; + // If the dialog is created, but hasn't received focus yet, + // the lock screen could be still focused, so bumping would + // make the curtain fall again. + if (!this._dialog) + this._bumpLockScreen(); + return true; }, _drawArrow: function() { @@ -433,6 +443,21 @@ const ScreenShield = new Lang.Class({ this._hideLockScreen(false); }, + _bumpLockScreen: function() { + Tweener.removeTweens(this._lockScreenGroup); + Tweener.addTween(this._lockScreenGroup, + { y: -BUMP_SIZE, + time: BUMP_TIME / 2, + transition: 'easeOutQuad', + onComplete: function() { + Tweener.addTween(this, + { y: 0, + time: BUMP_TIME / 2, + transition: 'easeInQuad' }); + } + }); + }, + _hideLockScreen: function(animate) { if (animate) { // Tween the lock screen out of screen