Skip to content
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
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
ddm (0.1.7) unstable; urgency=medium

* fix black screen when user activate session

-- Dingyuan Zhang <[email protected]> Fri, 06 Dec 2024 13:52:00 +0800

ddm (0.1.6) unstable; urgency=medium

* allow user take tty control
Expand Down
39 changes: 34 additions & 5 deletions src/daemon/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,41 @@ namespace DDM {
}

void Display::switchToUser(const QString &user) {
if (user == "dde") {
m_greeter->setUserActivated(false);
}

Auth *auth = nullptr;

for (auto *a : m_auths) {
if (a->user() == user) {
auth = a;
break;
}
}

if (!auth) {
return;
}

auto* server = reinterpret_cast<SingleWaylandDisplayServer*>(m_displayServer);
server->activateUser(user);

if (user == "dde") {
m_greeter->setUserActivated(false);
if (Logind::isAvailable()) {
OrgFreedesktopLogin1ManagerInterface manager(Logind::serviceName(), Logind::managerPath(), QDBusConnection::systemBus());
auto reply = manager.ListSessions();
reply.waitForFinished();

const auto info = reply.value();
for(const SessionInfo &s : reply.value()) {
if (s.userName == user) {
OrgFreedesktopLogin1SessionInterface session(Logind::serviceName(), s.sessionPath.path(), QDBusConnection::systemBus());
if (session.state() == "online" && session.vTNr() == static_cast<uint>(auth->tty())) {
session.Activate();
break;
}
}
}
}
}

Expand Down Expand Up @@ -592,7 +622,7 @@ namespace DDM {
}
}

VirtualTerminal::jumpToVt(auth->tty(), false);
switchToUser(auth->user());
}
m_socket = nullptr;
}
Expand Down Expand Up @@ -669,8 +699,7 @@ namespace DDM {
qDebug() << "Session started" << success;
Auth* auth = qobject_cast<Auth*>(sender());
if (m_displayServerType == SingleCompositerServerType) {
auto* server = reinterpret_cast<SingleWaylandDisplayServer*>(m_displayServer);
server->activateUser(auth->user());
switchToUser(auth->user());
}

if (success && m_displayServerType != SingleCompositerServerType) {
Expand Down
1 change: 1 addition & 0 deletions src/helper/HelperApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ namespace DDM {
}

connect(new SignalHandler(this), &SignalHandler::sigtermReceived, this, [this] {
qDebug() << "sigterm received.";
if (m_backend->isGreeter()) {
qApp->quit();
}
Expand Down
6 changes: 4 additions & 2 deletions src/helper/UserSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,17 @@ namespace DDM {
}

// take control of the tty
if (takeControl) {
if (takeControl && m_helperApp->isGreeter()) {
if (ioctl(STDIN_FILENO, TIOCSCTTY, 0) < 0) {
const auto error = strerror(errno);
qCritical().nospace() << "Failed to take control of " << ttyString << " (" << QFileInfo(ttyString).owner() << "): " << error;
_exit(Auth::HELPER_TTY_ERROR);
}
}

VirtualTerminal::jumpToVt(vtNumber, m_helperApp->isGreeter());
if (m_helperApp->isGreeter()) {
VirtualTerminal::jumpToVt(vtNumber, true);
}

// skip Ctrl-C SIGINT
struct termios oldt, newt;
Expand Down
Loading