chiark / gitweb /
logind: prefer new sessions over older ones on VT switches
authorDavid Herrmann <dh.herrmann@gmail.com>
Thu, 16 Jul 2015 16:18:01 +0000 (18:18 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:07:01 +0000 (10:07 +0100)
Our seat->positions[] array keeps track of the 'preferred' session on a
VT. The only situation this is used, is to select the session to activate
when a VT is activated. In the normal case, there's only one session per
VT so the selection is trivial.

Older greeters, however, implement take-overs when they start sessions on
the same VT that the greeter ran on. We recently limited such take-overs
to VTs where a greeter is running on, to force people to never share VTs
in new code that is written.

For legacy reasons, we need to be compatible to old greeters, though.
Hence, we allow those greeters to implement take-over. In such take-overs,
however, we should really make sure that the new sessions gets preferred
over the old one under all circumstances. Hence, make sure we override
the previous preferred session with a new session.

src/login/logind-seat.c

index 72bcfc4a52b89ac0c4a7ac4fad7a216d62b2968c..3daaf000eaccf0087962cd40a2f8b504d30a3cb7 100644 (file)
@@ -473,7 +473,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) {
         seat_evict_position(s, session);
 
         session->position = pos;
         seat_evict_position(s, session);
 
         session->position = pos;
-        if (pos > 0 && !s->positions[pos])
+        if (pos > 0)
                 s->positions[pos] = session;
 }
 
                 s->positions[pos] = session;
 }