[gnome-shell/wip/login-unlock-merge: 6/9] loginDialog: handle typing at screenshield



commit 5dce7b00239565e9716b9d6d1703f83c24b2a64a
Author: Ray Strode <rstrode redhat com>
Date:   Wed Jul 10 10:29:17 2013 -0400

    loginDialog: handle typing at screenshield
    
    If the screenshield is up and the user starts typing, we need to
    keep track of it and replay it later, otherwise what they type
    will be ignored.
    
    This is useful when the user has disable-user-list set to TRUE,
    and will also be useful to bring feature parity between the
    login screen and unlock screen.

 js/gdm/loginDialog.js |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 459ec39..8c34c7a 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -855,6 +855,9 @@ const LoginDialog = new Lang.Class({
             this._promptEntry.clutter_text.connect('activate', function() {
                 hold.release();
             });
+
+        if (this._initialAnswer && this._initialAnswer['text'])
+            hold.release();
     },
 
     _updateSensitivity: function(sensitive) {
@@ -903,7 +906,13 @@ const LoginDialog = new Lang.Class({
         this._promptLabel.set_text(question);
 
         this._updateSensitivity(true);
-        this._promptEntry.set_text('');
+        if (!this._initialAnswer) {
+            this._promptEntry.set_text('');
+        } else if (this._initialAnswer['activate-id']) {
+            this._promptEntry.clutter_text.disconnect(this._initialAnswer['activate-id']);
+            delete this._initialAnswer['activate-id'];
+        }
+
         this._promptEntry.clutter_text.set_password_char(passwordChar);
 
         let tasks = [function() {
@@ -911,7 +920,14 @@ const LoginDialog = new Lang.Class({
                      },
 
                      function() {
-                         let text = this._promptEntry.get_text();
+                         let text;
+
+                         if (this._initialAnswer && this._initialAnswer['text']) {
+                             text = this._initialAnswer['text'];
+                             this._initialAnswer = null;
+                         } else {
+                             text = this._promptEntry.get_text();
+                         }
                          this._updateSensitivity(false);
                          this._setDefaultButtonWellMode(DefaultButtonWellMode.SPINNER, false);
                          this._userVerifier.answerQuery(serviceName, text);
@@ -1216,7 +1232,19 @@ const LoginDialog = new Lang.Class({
     },
 
     addCharacter: function(unichar) {
+        if (!this._initialAnswer)
+            this._initialAnswer = {};
+
         this._promptEntry.clutter_text.insert_unichar(unichar);
+
+        if (!this._initialAnswer['activate-id'])
+            this._initialAnswer['activate-id'] =
+                this._promptEntry.clutter_text.connect('activate', Lang.bind(this, function() {
+                                                           
this._promptEntry.clutter_text.disconnect(this._initialAnswer['activate-id']);
+                                                           delete this._initialAnswer['activate-id'];
+
+                                                           this._initialAnswer['text'] = 
this._promptEntry.get_text();
+                                                       }));
     },
 });
 Signals.addSignalMethods(LoginDialog.prototype);


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