After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 740142 - loginDialog: only emit session-activated on user action
loginDialog: only emit session-activated on user action
Status: RESOLVED OBSOLETE
Product: gnome-shell
Classification: Core
Component: login-screen
unspecified
Other All
: Normal normal
: ---
Assigned To: Ray Strode [halfline]
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2014-11-14 20:51 UTC by Ray Strode [halfline]
Modified: 2018-02-19 18:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
loginDialog: only emit session-activated on user action (4.30 KB, patch)
2014-11-14 20:51 UTC, Ray Strode [halfline]
reviewed Details | Review
loginDialog: Don't arbitrarily pick a random session for the user (1006 bytes, patch)
2015-03-16 18:06 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
loginDialog: Better handle setting the active session (1.73 KB, patch)
2015-03-16 18:07 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
Revert "loginDialog: Better handle setting the active session" (5.12 KB, patch)
2015-03-18 16:44 UTC, Ray Strode [halfline]
none Details | Review
Revert "loginDialog: Don't arbitrarily pick a random session for the user" (2.79 KB, patch)
2015-03-18 16:44 UTC, Ray Strode [halfline]
none Details | Review

Description Ray Strode [halfline] 2014-11-14 20:51:24 UTC
Right now we emit session-activated any time the bullet
moves in the session menu. That includes at start up when
picking an item arbitrarily, and any time GDM reports the
session was read from the user's account settings.

session-activated informs GDM about the newly selected session,
so emitting it in response to GDM reporting a session is a
bad idea (it's not only pointless, but it can least to
oscillations)

This commit changes the code to only emit session-activated when
the user explicitly activates a session item from the gear menu.
Comment 1 Ray Strode [halfline] 2014-11-14 20:51:27 UTC
Created attachment 290737 [details] [review]
loginDialog: only emit session-activated on user action
Comment 2 Jasper St. Pierre (not reading bugmail) 2014-11-14 21:11:41 UTC
Review of attachment 290737 [details] [review]:

::: js/gdm/loginDialog.js
@@ -351,3 @@
 
-            if (!this._activeSessionId)
-                this.setActiveSession(id);

Why was this removed?
Comment 3 Ray Strode [halfline] 2014-11-14 21:49:35 UTC
(In reply to comment #2)
> Review of attachment 290737 [details] [review]:
> 
> ::: js/gdm/loginDialog.js
> @@ -351,3 @@
> 
> -            if (!this._activeSessionId)
> -                this.setActiveSession(id);
> 
> Why was this removed?

If we don't know what the user's selected session is, we shouldn't show a bullet pointing at some random one that won't get used.
Comment 4 Ray Strode [halfline] 2014-11-14 21:51:03 UTC
to be clear, this does mean in some rare cases there will be no bullet at all in the menu. Until the user picks one.  I think that's the right behavior, but also, in practice it won't happen for any case but smartcards, since we query for the username up front and load the user up front in all other cases.
Comment 5 Jasper St. Pierre (not reading bugmail) 2015-03-16 18:06:57 UTC
Created attachment 299538 [details] [review]
loginDialog: Don't arbitrarily pick a random session for the user

gdm should be in charge of telling us the default session, and it
should pick one for the user if she doesn't already have one.
Comment 6 Jasper St. Pierre (not reading bugmail) 2015-03-16 18:07:01 UTC
Created attachment 299539 [details] [review]
loginDialog: Better handle setting the active session

We currently use the setActiveSession method to both mark a menu item as
selected, and also tell gdm about the current session the user selected.

Since gdm is ultimately in charge of the state, we should decouple this
and simply ask gdm to set the session, and have the menu item reflect
what gdm thinks is the current session.

This prevents state getting mismatched and oscillations from happening,
where we get in a loop of constantly telling gdm what the session is.
Comment 7 Ray Strode [halfline] 2015-03-16 21:46:15 UTC
Review of attachment 299538 [details] [review]:

obviously, like this one.
Comment 8 Ray Strode [halfline] 2015-03-16 21:47:05 UTC
Review of attachment 299539 [details] [review]:

This is better than what I came up with, and it seems to work as well in testing. It does incur a roundtrip through GDM, but that's probably a good thing.
Comment 9 Ray Strode [halfline] 2015-03-16 21:47:49 UTC
Attachment 299538 [details] pushed as 6d40cb9 - loginDialog: Don't arbitrarily pick a random session for the user
Attachment 299539 [details] pushed as 681861c - loginDialog: Better handle setting the active session
Comment 10 Ray Strode [halfline] 2015-03-18 12:30:36 UTC
(In reply to Ray Strode [halfline] from comment #8)
> it seems to work as well in testing.

Apparently I suck at testing. I don't know if I typed make install in the wrong ssh window or what, but this patch break session changing.
Comment 11 Ray Strode [halfline] 2015-03-18 13:42:11 UTC
So there are two problems:

     setActiveSession: function(sessionId) {
-         this.emit('session-activated', this._activeSessionId);
+         this.emit('session-activated', sessionId);
     },

and the roundtrip through GDM isn't instant, because GDM is blocking waiting for the user's password. normally, the messages don't get processed until after the user enters their password.
Comment 12 Ray Strode [halfline] 2015-03-18 16:17:54 UTC
So I think we should revert this for now, since we're so late in the release cycle and it's clear what the best way forward is.

We could do the original patch instead, but at this point, I think it's probably better to be conservative and go back to 3.15.91 behavior.
Comment 13 Jasper St. Pierre (not reading bugmail) 2015-03-18 16:19:12 UTC
Please revert back to 3.15.91. Sorry about this.
Comment 14 Ray Strode [halfline] 2015-03-18 16:44:41 UTC
Created attachment 299732 [details] [review]
Revert "loginDialog: Better handle setting the active session"

This reverts commit 681861c8c76cb96ab2a6199df1153202a5c9e292.
Comment 15 Ray Strode [halfline] 2015-03-18 16:44:45 UTC
Created attachment 299733 [details] [review]
Revert "loginDialog: Don't arbitrarily pick a random session for the user"

This reverts commit 6d40cb98e7e7a24f66662f0a06ecf8e93ed5dea2.
Comment 16 Ray Strode [halfline] 2015-03-18 16:45:02 UTC
Attachment 299732 [details] pushed as ee360d8 - Revert "loginDialog: Better handle setting the active session"
Attachment 299733 [details] pushed as e5270cb - Revert "loginDialog: Don't arbitrarily pick a random session for the user"
Comment 17 Ray Strode [halfline] 2018-02-19 18:45:38 UTC
moved patch to gitlab: https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/33