115 lines
3.5 KiB
Diff
115 lines
3.5 KiB
Diff
From: Kai Uwe Broulik <kde@privat.broulik.de>
|
|
Date: Thu, 25 Feb 2016 21:16:22 +0000
|
|
Subject: [User Switcher] Fix session switching when automatic screen locking is enabled
|
|
X-Git-Url: http://quickgit.kde.org/?p=plasma-workspace.git&a=commitdiff&h=7a0096ba99d7a71ae9f45d7c0011d0ebb1eae23d
|
|
---
|
|
[User Switcher] Fix session switching when automatic screen locking is enabled
|
|
|
|
When automatic screen locking is enabled, we want to ensure the screen is fully locked
|
|
before we switch sessions or go to the login screen to avoid brief exposure of the desktop
|
|
when we return.
|
|
|
|
This check happens asynchronously and because the User Switcher dialog closes immediately
|
|
after issuing the switch request, the SessionsModel is already destroyed and the reply is never
|
|
actually processed.
|
|
|
|
BUG: 356945
|
|
FIXED-IN: 5.5.5
|
|
|
|
Differential Revision: https://phabricator.kde.org/D1020
|
|
---
|
|
|
|
|
|
--- a/components/sessionsprivate/sessionsmodel.cpp
|
|
+++ b/components/sessionsprivate/sessionsmodel.cpp
|
|
@@ -45,8 +45,10 @@
|
|
if (active) {
|
|
if (m_pendingVt) {
|
|
m_displayManager.switchVT(m_pendingVt);
|
|
+ emit switchedUser(m_pendingVt);
|
|
} else if (m_pendingReserve) {
|
|
m_displayManager.startReserve();
|
|
+ emit startedNewSession();
|
|
}
|
|
|
|
m_pendingVt = 0;
|
|
@@ -78,6 +80,7 @@
|
|
|
|
if (!shouldLock) {
|
|
m_displayManager.switchVT(vt);
|
|
+ emit switchedUser(vt);
|
|
return;
|
|
}
|
|
|
|
@@ -85,6 +88,7 @@
|
|
if (locked) {
|
|
// already locked, switch right away
|
|
m_displayManager.switchVT(vt);
|
|
+ emit switchedUser(vt);
|
|
} else {
|
|
m_pendingReserve = false;
|
|
m_pendingVt = vt;
|
|
@@ -101,6 +105,7 @@
|
|
|
|
if (!shouldLock) {
|
|
m_displayManager.startReserve();
|
|
+ emit startedNewSession();
|
|
return;
|
|
}
|
|
|
|
@@ -108,6 +113,7 @@
|
|
if (locked) {
|
|
// already locked, switch right away
|
|
m_displayManager.startReserve();
|
|
+ emit startedNewSession();
|
|
} else {
|
|
m_pendingReserve = true;
|
|
m_pendingVt = 0;
|
|
|
|
--- a/components/sessionsprivate/sessionsmodel.h
|
|
+++ b/components/sessionsprivate/sessionsmodel.h
|
|
@@ -86,8 +86,10 @@
|
|
|
|
signals:
|
|
void shouldLockChanged();
|
|
+ void countChanged();
|
|
|
|
- void countChanged();
|
|
+ void switchedUser(int vt);
|
|
+ void startedNewSession();
|
|
|
|
private:
|
|
void checkScreenLocked(const std::function<void (bool)> &cb);
|
|
|
|
--- a/lookandfeel/contents/userswitcher/UserSwitcher.qml
|
|
+++ b/lookandfeel/contents/userswitcher/UserSwitcher.qml
|
|
@@ -38,6 +38,11 @@
|
|
|
|
SessionsModel {
|
|
id: sessionsModel
|
|
+ // the calls takes place asynchronously; if we were to dismiss the dialog right
|
|
+ // after startNewSession/switchUser we would be destroyed before the reply
|
|
+ // returned leaving us do nothing (Bug 356945)
|
|
+ onStartedNewSession: root.dismissed()
|
|
+ onSwitchedUser: root.dismissed()
|
|
}
|
|
|
|
Controls.Action {
|
|
@@ -125,7 +130,6 @@
|
|
visible: sessionsModel.canStartNewSession
|
|
onClicked: {
|
|
sessionsModel.startNewSession(sessionsModel.shouldLock)
|
|
- root.dismissed()
|
|
}
|
|
}
|
|
|
|
@@ -148,7 +152,6 @@
|
|
visible: sessionsModel.count > 0
|
|
onClicked: {
|
|
sessionsModel.switchUser(block.mainItem.selectedItem.vtNumber, sessionsModel.shouldLock)
|
|
- root.dismissed()
|
|
}
|
|
|
|
Controls.Action {
|
|
|