Blame SOURCES/0001-gdm-honor-timed-login-delay-even-if-animations-disab.patch

580c05
From 266607d2b5ce7bb74f5954897460261af21b9ff0 Mon Sep 17 00:00:00 2001
580c05
From: Ray Strode <rstrode@redhat.com>
580c05
Date: Tue, 18 Aug 2015 12:02:17 -0400
580c05
Subject: [PATCH] gdm: honor timed login delay even if animations disabled
580c05
580c05
gnome-shell currently initiates an automatic login attempt if
580c05
timed login is enabled and the timed login animation completes.
580c05
580c05
Unfortunately, if animations are disabled (as is the case for
580c05
virtual machines) then the timed login animation will complete
580c05
instantly, and timed login will proceed immediately after gnome-shell
580c05
has noticed the user is idle for 5 seconds.
580c05
580c05
This commit addresses that problem by initiating timed login and the
580c05
animation from a main loop timeout, instead of using the tweener api.
580c05
---
580c05
 js/gdm/loginDialog.js | 38 ++++++++++++++++++++++++++++----------
580c05
 src/gvc               |  2 +-
580c05
 2 files changed, 29 insertions(+), 11 deletions(-)
580c05
580c05
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
580c05
index a51ffd5..4b4d232 100644
580c05
--- a/js/gdm/loginDialog.js
580c05
+++ b/js/gdm/loginDialog.js
580c05
@@ -80,74 +80,90 @@ const UserListItem = new Lang.Class({
580c05
                                                  scale_x: 0 });
580c05
         layout.add(this._timedLoginIndicator);
580c05
 
580c05
         this.actor.connect('clicked', Lang.bind(this, this._onClicked));
580c05
         this._onUserChanged();
580c05
     },
580c05
 
580c05
     _onUserChanged: function() {
580c05
         this._updateLoggedIn();
580c05
     },
580c05
 
580c05
     _updateLoggedIn: function() {
580c05
         if (this.user.is_logged_in())
580c05
             this.actor.add_style_pseudo_class('logged-in');
580c05
         else
580c05
             this.actor.remove_style_pseudo_class('logged-in');
580c05
     },
580c05
 
580c05
     _onDestroy: function() {
580c05
         this._user.disconnect(this._userChangedId);
580c05
     },
580c05
 
580c05
     _onClicked: function() {
580c05
         this.emit('activate');
580c05
     },
580c05
 
580c05
     showTimedLoginIndicator: function(time) {
580c05
         let hold = new Batch.Hold();
580c05
 
580c05
         this.hideTimedLoginIndicator();
580c05
-        Tweener.addTween(this._timedLoginIndicator,
580c05
-                         { scale_x: 1.,
580c05
-                           time: time,
580c05
-                           transition: 'linear',
580c05
-                           onComplete: function() {
580c05
-                               hold.release();
580c05
-                           },
580c05
-                           onCompleteScope: this
580c05
-                         });
580c05
+
580c05
+        let startTime = GLib.get_monotonic_time();
580c05
+
580c05
+        this._timedLoginTimeoutId = GLib.timeout_add (GLib.PRIORITY_DEFAULT,
580c05
+                                                      33,
580c05
+                                                      Lang.bind(this, function() {
580c05
+                                                          let currentTime = GLib.get_monotonic_time();
580c05
+                                                          let elapsedTime = (currentTime - startTime) / GLib.USEC_PER_SEC;
580c05
+                                                          this._timedLoginIndicator.scale_x = elapsedTime / time;
580c05
+                                                          log("elasped time: " + elapsedTime + " time: " + time);
580c05
+                                                          if (elapsedTime >= time) {
580c05
+                                                              log("releasing hold");
580c05
+                                                              this._timedLoginTimeoutId = 0;
580c05
+                                                              hold.release();
580c05
+                                                              return GLib.SOURCE_REMOVE;
580c05
+                                                          }
580c05
+
580c05
+                                                          return GLib.SOURCE_CONTINUE;
580c05
+                                                      }));
580c05
+
580c05
+        GLib.Source.set_name_by_id(this._timedLoginTimeoutId, '[gnome-shell] this._timedLoginTimeoutId');
580c05
+
580c05
         return hold;
580c05
     },
580c05
 
580c05
     hideTimedLoginIndicator: function() {
580c05
-        Tweener.removeTweens(this._timedLoginIndicator);
580c05
+        if (this._timedLoginTimeoutId) {
580c05
+            GLib.source_remove(this._timedLoginTimeoutId);
580c05
+            this._timedLoginTimeoutId = 0;
580c05
+        }
580c05
         this._timedLoginIndicator.scale_x = 0.;
580c05
     }
580c05
 });
580c05
 Signals.addSignalMethods(UserListItem.prototype);
580c05
 
580c05
 const UserList = new Lang.Class({
580c05
     Name: 'UserList',
580c05
 
580c05
     _init: function() {
580c05
         this.actor = new St.ScrollView({ style_class: 'login-dialog-user-list-view'});
580c05
         this.actor.set_policy(Gtk.PolicyType.NEVER,
580c05
                               Gtk.PolicyType.AUTOMATIC);
580c05
 
580c05
         this._box = new St.BoxLayout({ vertical: true,
580c05
                                        style_class: 'login-dialog-user-list',
580c05
                                        pseudo_class: 'expanded' });
580c05
 
580c05
         this.actor.add_actor(this._box);
580c05
         this._items = {};
580c05
 
580c05
         this.actor.connect('key-focus-in', Lang.bind(this, this._moveFocusToItems));
580c05
     },
580c05
 
580c05
     _moveFocusToItems: function() {
580c05
         let hasItems = Object.keys(this._items).length > 0;
580c05
 
580c05
         if (!hasItems)
580c05
             return;
580c05
 
580c05
         if (global.stage.get_key_focus() != this.actor)