[gnome-shell/gbsneto/new-lock-screen-part2: 1/4] unlockDialog: Toggle between clock and auth prompt



commit 500aec28853e8d716bbb1067d1f0476688d9ca2b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Nov 29 14:37:10 2019 -0300

    unlockDialog: Toggle between clock and auth prompt
    
    Toggle between them when (1) tapping anythere on the screen, and
    (2) pressing any key.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/872

 js/ui/unlockDialog.js | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
---
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 9433c22e35..ccd3b9d235 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -390,10 +390,17 @@ var UnlockDialog = GObject.registerClass({
             accessible_role: Atk.Role.WINDOW,
             style_class: 'login-dialog',
             visible: false,
+            reactive: true,
         });
 
         parentActor.add_child(this);
 
+        this._activePage = null;
+
+        let tapAction = new Clutter.TapAction();
+        tapAction.connect('tap', this._showPrompt.bind(this));
+        this.add_action(tapAction);
+
         // Background
         this._backgroundGroup = new Clutter.Actor();
 
@@ -470,6 +477,15 @@ var UnlockDialog = GObject.registerClass({
         this.connect('destroy', this._onDestroy.bind(this));
     }
 
+    vfunc_captured_event(event) {
+        if (event.type() != Clutter.EventType.KEY_PRESS)
+            return Clutter.EVENT_PROPAGATE;
+
+        this._showPrompt();
+
+        return Clutter.EVENT_PROPAGATE;
+    }
+
     _createBackground(monitorIndex) {
         let monitor = Main.layoutManager.monitors[monitorIndex];
         let widget = new St.Widget({ style_class: 'screen-shield-background',
@@ -513,6 +529,48 @@ var UnlockDialog = GObject.registerClass({
         }
     }
 
+    _showClock() {
+        if (this._activePage == this._clock)
+            return;
+
+        this._activePage = this._clock;
+        this._clock.show();
+
+        this._promptBox.ease({
+            opacity: 0,
+            duration: 300,
+            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+            onComplete: () => this._promptBox.hide(),
+        });
+
+        this._clock.ease({
+            opacity: 255,
+            duration: 300,
+            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+        });
+    }
+
+    _showPrompt() {
+        if (this._activePage == this._promptBox)
+            return;
+
+        this._activePage = this._promptBox;
+        this._promptBox.show();
+
+        this._clock.ease({
+            opacity: 0,
+            duration: 300,
+            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+            onComplete: () => this._clock.hide(),
+        });
+
+        this._promptBox.ease({
+            opacity: 255,
+            duration: 300,
+            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+        });
+    }
+
     _fail() {
         this.emit('failed');
     }
@@ -565,6 +623,7 @@ var UnlockDialog = GObject.registerClass({
     }
 
     addCharacter(unichar) {
+        this._showPrompt();
         this._authPrompt.addCharacter(unichar);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]