From d7f54213f1473be68dfaa1f53afd1d24ff3dad25 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Fri, 3 Aug 2012 19:42:43 +0200 Subject: [PATCH] ScreenShield: when explicitly locking, tween the shield from the top The curtain should appear to be an overlay on top of the system, and since it is lifted by dragging up, it makes sense to slide it down on lock. https://bugzilla.gnome.org/show_bug.cgi?id=681143 --- data/theme/gnome-shell.css | 4 +-- js/ui/screenShield.js | 55 +++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css index 22e5e628c..13f01148a 100644 --- a/data/theme/gnome-shell.css +++ b/data/theme/gnome-shell.css @@ -2201,12 +2201,12 @@ StButton.popup-menu-item:insensitive { /* Screen shield */ -#screenShieldGroup { +#lockDialogGroup { background: #2e3436 url(noise-texture.png); background-repeat: repeat; } -#screenShieldGroup .arrow { +#lockScreenGroup .arrow { color: #333333; width: 100px; height: 50px; diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index d31094516..1b53276b2 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -17,7 +17,7 @@ const Tweener = imports.ui.tweener; const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver'; const LOCK_ENABLED_KEY = 'lock-enabled'; -const CURTAIN_SLIDE_TIME = 1.2; +const CURTAIN_SLIDE_TIME = 0.8; // fraction of screen height the arrow must reach before completing // the slide up automatically const ARROW_DRAG_TRESHOLD = 0.1; @@ -28,7 +28,7 @@ const SUMMARY_ICON_SIZE = 48; // STANDARD_FADE_TIME is used when the session goes idle, while // SHORT_FADE_TIME is used when requesting lock explicitly from the user menu const STANDARD_FADE_TIME = 10; -const SHORT_FADE_TIME = 2; +const SHORT_FADE_TIME = 0.8; const Clock = new Lang.Class({ Name: 'ScreenShieldClock', @@ -257,6 +257,23 @@ const NotificationsBox = new Lang.Class({ }, }); +const LockDialogGroup = new Lang.Class({ + Name: 'LockDialogGroup', + Extends: St.Widget, + + _init: function(params) { + this.parent(params); + }, + + vfunc_get_preferred_height: function(forWidth) { + return [global.screen_height, global.screen_height]; + }, + + vfunc_get_preferred_width: function(forHeight) { + return [global.screen_width, global.screen_width]; + } +}); + /** * To test screen shield, make sure to kill gnome-screensaver. * @@ -277,7 +294,8 @@ const ScreenShield = new Lang.Class({ y_expand: true, reactive: true, can_focus: true, - layout_manager: new Clutter.BinLayout() + layout_manager: new Clutter.BinLayout(), + name: 'lockScreenGroup', }); this._lockScreenGroup.connect('key-release-event', Lang.bind(this, this._onLockScreenKeyRelease)); @@ -304,9 +322,7 @@ const ScreenShield = new Lang.Class({ action.connect('drag-end', Lang.bind(this, this._onDragEnd)); this._lockScreenGroup.add_action(action); - this._lockDialogGroup = new St.Widget({ x_expand: true, - y_expand: true }); - + this._lockDialogGroup = new LockDialogGroup({ name: 'lockDialogGroup' }); this.actor.add_actor(this._lockDialogGroup); this.actor.add_actor(this._lockScreenGroup); @@ -478,26 +494,35 @@ const ScreenShield = new Lang.Class({ }, _resetLockScreen: function(animate) { + this._lockScreenGroup.show(); + this._arrow.show(); + if (animate) { - this.actor.opacity = 0; - Tweener.removeTweens(this.actor); - Tweener.addTween(this.actor, - { opacity: 255, + this._lockScreenGroup.y = -global.screen_height; + Tweener.removeTweens(this._lockScreenGroup); + Tweener.addTween(this._lockScreenGroup, + { y: 0, time: SHORT_FADE_TIME, - transition: 'easeOutQuad', + transition: 'linear', onComplete: function() { + this._lockScreenGroup.fixed_position_set = false; this.emit('lock-screen-shown'); }, onCompleteScope: this }); + + this._lockDialogGroup.opacity = 0; + Tweener.removeTweens(this._lockDialogGroup); + Tweener.addTween(this._lockDialogGroup, + { opacity: 255, + time: SHORT_FADE_TIME, + transition: 'easeOutQuad' }); } else { + this._lockScreenGroup.fixed_position_set = false; + this._lockDialogGroup.opacity = 255; this.emit('lock-screen-shown'); } - this._lockScreenGroup.fixed_position_set = false; - this._lockScreenGroup.show(); - this._arrow.show(); - this._lockScreenGroup.grab_key_focus(); },