Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unlock will switch to greeter #14

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions src/daemon/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<SingleWaylandDisplayServer*>(m_displayServer);
server->onLoginSucceeded(user);
} else {
if (m_socket) {
emit loginSucceeded(m_socket, user);
daemonApp->displayManager()->setLastSession(auth->sessionId());
}
}

}
m_socket = nullptr;
}
Expand All @@ -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<SingleWaylandDisplayServer*>(m_displayServer);
server->onLoginFailed(auth->user());
} else {
emit loginFailed(m_socket, auth->user());
}
}
}

void Display::slotHelperFinished(Auth::HelperExitStatus status) {
Expand All @@ -630,14 +642,14 @@ namespace DDM {

if(!auth->identifyOnly()) {
daemonApp->displayManager()->RemoveSession(auth->sessionId());
if (m_displayServerType == DisplayServerType::SingleCompositerServerType) {
auto* server = reinterpret_cast<SingleWaylandDisplayServer*>(m_displayServer);
// TODO: switch to greeter
server->activateUser("dde");
return;
}
}

if (m_displayServerType == DisplayServerType::SingleCompositerServerType) {
auto* server = reinterpret_cast<SingleWaylandDisplayServer*>(m_displayServer);
// TODO: switch to greeter
server->activateUser("dde");
return;
}
if (status != Auth::HELPER_AUTH_ERROR && m_displayServerType != DisplayServerType::SingleCompositerServerType)
stop();
}
Expand Down
19 changes: 15 additions & 4 deletions src/daemon/SingleWaylandDisplayServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,24 @@
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
}
}

QString SingleWaylandDisplayServer::getUserWaylandSocket(const QString &user) const {

Check warning on line 83 in src/daemon/SingleWaylandDisplayServer.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'getUserWaylandSocket' is never used.
return m_waylandSockets.value(user);
}

void SingleWaylandDisplayServer::onLoginFailed(const QString &user) {

Check warning on line 87 in src/daemon/SingleWaylandDisplayServer.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'onLoginFailed' is never used.
for (auto greeter : m_greeterSockets) {
SocketWriter(greeter) << quint32(DaemonMessages::LoginFailed) << user;
}
}

void SingleWaylandDisplayServer::onLoginSucceeded(const QString &user) {

Check warning on line 93 in src/daemon/SingleWaylandDisplayServer.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'onLoginSucceeded' is never used.
for (auto greeter : m_greeterSockets) {
SocketWriter(greeter) << quint32(DaemonMessages::LoginSucceeded) << user;
}
}
2 changes: 2 additions & 0 deletions src/daemon/SingleWaylandDisplayServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading