seat: fix activating only enabled seats during session-switch
If we deactivate a session, we must not activate the next session we find but we need to look for an enabled session instead. This also changes the session_deactivate() helper to allow deactivating disabled sessions. This shouldn't be relyed on, but it is a safe fallback if some session turns out to be disabled but still active. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
b86f5d215d
commit
8cc97f6913
@ -129,21 +129,24 @@ static void session_activate(struct kmscon_session *sess)
|
||||
static void session_deactivate(struct kmscon_session *sess)
|
||||
{
|
||||
struct kmscon_seat *seat = sess->seat;
|
||||
struct shl_dlist *iter;
|
||||
|
||||
if (seat->cur_sess != sess || !sess->enabled)
|
||||
if (seat->cur_sess != sess)
|
||||
return;
|
||||
|
||||
if (seat->awake)
|
||||
session_call_deactivate(sess);
|
||||
|
||||
if (shl_dlist_empty(&seat->sessions)) {
|
||||
seat->cur_sess = NULL;
|
||||
} else {
|
||||
seat->cur_sess = shl_dlist_entry(seat->sessions.next,
|
||||
struct kmscon_session,
|
||||
list);
|
||||
seat->cur_sess = NULL;
|
||||
shl_dlist_for_each(iter, &seat->sessions) {
|
||||
sess = shl_dlist_entry(iter, struct kmscon_session, list);
|
||||
if (!sess->enabled)
|
||||
continue;
|
||||
|
||||
seat->cur_sess = sess;
|
||||
if (seat->awake)
|
||||
session_call_activate(seat->cur_sess);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user