on xenial help sign in
Workaround bug in logind not telling us when a session becomes inactive, and also hide launcher when that happens
commit3d77c8a82b0e3c7879ffd3f009ea33476c1d2a62 authorMichael Terry <michael.terry@canonical.com> dateSat 17 May 2014, 21:58 (12 years ago) parent3565abc
3 files changed+23
plugins/SessionManager/SessionManager.cpp+17 plugins/SessionManager/SessionManager.h+1 qml/Shell.qml+5
plugins/SessionManager/SessionManager.cpp+17
@@ -79,6 +79,17 @@ void SessionManager::getSessionSlot(QDBusPendingCallWatcher *watcher)
7979 this,
8080 SLOT(propertiesChanged(QString, QVariantMap, QStringList)));
8181
82+ // Login1 is very odd about emitting PropertiesChanged. It often does
83+ // not do so when active is becoming false. But it always does when
84+ // it becomes true. So we watch for the "Lock" signal too, which is a
85+ // reliably hint that active is false.
86+ l1_manager->connection().connect("org.freedesktop.login1",
87+ path.path(),
88+ "org.freedesktop.login1.Session",
89+ "Lock",
90+ this,
91+ SLOT(sessionLocked()));
92+
8293 propertiesChanged("", QVariantMap(), QStringList() << "Active");
8394 }
8495 watcher->deleteLater();
@@ -105,3 +116,9 @@ void SessionManager::propertiesChanged(const QString &interface, const QVariantM
105116 Q_EMIT activeChanged();
106117 }
107118}
119+
120+void SessionManager::sessionLocked()
121+{
122+ is_active = false;
123+ Q_EMIT activeChanged();
124+}
plugins/SessionManager/SessionManager.h+1
@@ -49,6 +49,7 @@ Q_SIGNALS:
4949private Q_SLOTS:
5050 void getSessionSlot(QDBusPendingCallWatcher *watcher);
5151 void propertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalid);
52+ void sessionLocked();
5253
5354private:
5455 QDBusInterface *l1_manager;
qml/Shell.qml+5
@@ -393,6 +393,11 @@ BasicShell {
393393 panel.indicators.hide()
394394 }
395395 }
396+
397+ Connections {
398+ target: SessionManager
399+ onActiveChanged: if (!SessionManager.active) launcher.hide()
400+ }
396401 }
397402
398403 Rectangle {