From 95bf59cc04412124b2f24874a797862503bc6696 Mon Sep 17 00:00:00 2001 From: Zhang Dingyuan Date: Thu, 25 Jul 2024 15:15:04 +0800 Subject: [PATCH 1/2] fix: unlock will switch to greeter as title Log: --- src/daemon/Display.cpp | 12 ++++++------ src/daemon/SingleWaylandDisplayServer.cpp | 7 +++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp index 60b5b10..b9424d4 100644 --- a/src/daemon/Display.cpp +++ b/src/daemon/Display.cpp @@ -630,14 +630,14 @@ namespace DDM { if(!auth->identifyOnly()) { daemonApp->displayManager()->RemoveSession(auth->sessionId()); + if (m_displayServerType == DisplayServerType::SingleCompositerServerType) { + auto* server = reinterpret_cast(m_displayServer); + // TODO: switch to greeter + server->activateUser("dde"); + return; + } } - if (m_displayServerType == DisplayServerType::SingleCompositerServerType) { - auto* server = reinterpret_cast(m_displayServer); - // TODO: switch to greeter - server->activateUser("dde"); - return; - } if (status != Auth::HELPER_AUTH_ERROR && m_displayServerType != DisplayServerType::SingleCompositerServerType) stop(); } diff --git a/src/daemon/SingleWaylandDisplayServer.cpp b/src/daemon/SingleWaylandDisplayServer.cpp index c6f9048..087c38e 100644 --- a/src/daemon/SingleWaylandDisplayServer.cpp +++ b/src/daemon/SingleWaylandDisplayServer.cpp @@ -74,10 +74,9 @@ void SingleWaylandDisplayServer::activateUser(const QString &user) { if (user == "dde") { SocketWriter(greeter) << quint32(DaemonMessages::SwitchToGreeter); } - else { - SocketWriter(greeter) << quint32(DaemonMessages::UserActivateMessage) << user; - displayPtr()->activateUser(user); // IOCTL activate - } + + SocketWriter(greeter) << quint32(DaemonMessages::UserActivateMessage) << user; + displayPtr()->activateUser(user); // IOCTL activate } } From 1b7607477b80ef9992c04a02315d3ff8a2028e26 Mon Sep 17 00:00:00 2001 From: Zhang Dingyuan Date: Thu, 25 Jul 2024 15:57:40 +0800 Subject: [PATCH 2/2] fix: not send login state for clients send state for all clients Log: --- src/daemon/Display.cpp | 22 +++++++++++++++++----- src/daemon/SingleWaylandDisplayServer.cpp | 12 ++++++++++++ src/daemon/SingleWaylandDisplayServer.h | 2 ++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp index b9424d4..00faefb 100644 --- a/src/daemon/Display.cpp +++ b/src/daemon/Display.cpp @@ -587,10 +587,16 @@ namespace DDM { stateConfig.Last.Session.setDefault(); stateConfig.save(); - if (m_socket) { - emit loginSucceeded(m_socket, user); - daemonApp->displayManager()->setLastSession(auth->sessionId()); + if (m_displayServerType == DisplayServerType::SingleCompositerServerType) { + auto* server = reinterpret_cast(m_displayServer); + server->onLoginSucceeded(user); + } else { + if (m_socket) { + emit loginSucceeded(m_socket, user); + daemonApp->displayManager()->setLastSession(auth->sessionId()); + } } + } m_socket = nullptr; } @@ -613,8 +619,14 @@ namespace DDM { return; m_socketServer->informationMessage(m_socket, message); - if (error == Auth::ERROR_AUTHENTICATION) - emit loginFailed(m_socket, auth->user()); + if (error == Auth::ERROR_AUTHENTICATION) { + if (m_displayServerType == DisplayServerType::SingleCompositerServerType) { + auto* server = reinterpret_cast(m_displayServer); + server->onLoginFailed(auth->user()); + } else { + emit loginFailed(m_socket, auth->user()); + } + } } void Display::slotHelperFinished(Auth::HelperExitStatus status) { diff --git a/src/daemon/SingleWaylandDisplayServer.cpp b/src/daemon/SingleWaylandDisplayServer.cpp index 087c38e..6aee8d4 100644 --- a/src/daemon/SingleWaylandDisplayServer.cpp +++ b/src/daemon/SingleWaylandDisplayServer.cpp @@ -83,3 +83,15 @@ void SingleWaylandDisplayServer::activateUser(const QString &user) { QString SingleWaylandDisplayServer::getUserWaylandSocket(const QString &user) const { return m_waylandSockets.value(user); } + +void SingleWaylandDisplayServer::onLoginFailed(const QString &user) { + for (auto greeter : m_greeterSockets) { + SocketWriter(greeter) << quint32(DaemonMessages::LoginFailed) << user; + } +} + +void SingleWaylandDisplayServer::onLoginSucceeded(const QString &user) { + for (auto greeter : m_greeterSockets) { + SocketWriter(greeter) << quint32(DaemonMessages::LoginSucceeded) << user; + } +} diff --git a/src/daemon/SingleWaylandDisplayServer.h b/src/daemon/SingleWaylandDisplayServer.h index b647f82..5ecc61b 100644 --- a/src/daemon/SingleWaylandDisplayServer.h +++ b/src/daemon/SingleWaylandDisplayServer.h @@ -26,6 +26,8 @@ class SingleWaylandDisplayServer : public DDM::WaylandDisplayServer public Q_SLOTS: void activateUser(const QString &user); QString getUserWaylandSocket(const QString &user) const; + void onLoginFailed(const QString &user); + void onLoginSucceeded(const QString &user); private: DDM::SocketServer *m_socketServer;