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.6) unstable; urgency=medium

* allow user take tty control

-- Dingyuan Zhang <[email protected]> Thu, 05 Dec 2024 20:58:00 +0800

ddm (0.1.5) unstable; urgency=medium

* active user tty
Expand Down
2 changes: 1 addition & 1 deletion src/daemon/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ namespace DDM {
}
}

VirtualTerminal::jumpToVt(auth->tty(), true);
VirtualTerminal::jumpToVt(auth->tty(), false);
}
m_socket = nullptr;
}
Expand Down
24 changes: 14 additions & 10 deletions src/helper/UserSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ namespace DDM {
// when this is true we'll take control of the tty
bool takeControl = false;

if (vtFd > 0 && !m_helperApp->isSingleMode()) {
if (vtFd > 0) {
dup2(vtFd, STDIN_FILENO);
::close(vtFd);
takeControl = true;
Expand All @@ -243,16 +243,20 @@ namespace DDM {
}
}

if (m_helperApp->isSingleMode() && m_helperApp->isGreeter()) {
// FIXME: if jumpToVt vt_auto is false, when switching tty, greeter sesion will died.
VirtualTerminal::jumpToVt(vtNumber, true);
VirtualTerminal::jumpToVt(vtNumber, m_helperApp->isGreeter());

// disable physical tty standard output in greeter work tty.
struct termios tios;
tcgetattr(STDOUT_FILENO, &tios);
tios.c_oflag &= ~OPOST;
tcsetattr(STDOUT_FILENO, TCSANOW, &tios);
}
// skip Ctrl-C SIGINT
struct termios oldt, newt;
tcgetattr(STDIN_FILENO, &oldt);
newt = oldt;
newt.c_lflag &= ~ISIG;
tcsetattr(STDIN_FILENO, TCSANOW, &newt);

// disable physical tty standard output in greeter work tty.
struct termios tios;
tcgetattr(STDOUT_FILENO, &tios);
tios.c_oflag &= ~OPOST;
tcsetattr(STDOUT_FILENO, TCSANOW, &tios);
}

#ifdef Q_OS_LINUX
Expand Down
Loading