Date: Mon, 03 Aug 2026 16:44:01 +0000 From: Gleb Popov <arrowd@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: c8a6d8ae8a39 - main - x11/sddm: Wayland session fixes Message-ID: <6a70c551.43fa4.b2e5d61@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by arrowd: URL: https://cgit.FreeBSD.org/ports/commit/?id=c8a6d8ae8a39e609c4a919a6fff36da660b6a66b commit c8a6d8ae8a39e609c4a919a6fff36da660b6a66b Author: Gleb Popov <arrowd@FreeBSD.org> AuthorDate: 2026-08-03 16:41:25 +0000 Commit: Gleb Popov <arrowd@FreeBSD.org> CommitDate: 2026-08-03 16:43:26 +0000 x11/sddm: Wayland session fixes PR: 286592, 296052 --- x11/sddm/Makefile | 2 +- .../files/patch-src_common_VirtualTerminal.cpp | 20 ------ x11/sddm/files/patch-src_helper_UserSession.cpp | 84 ++++++++++++++++++++++ 3 files changed, 85 insertions(+), 21 deletions(-) diff --git a/x11/sddm/Makefile b/x11/sddm/Makefile index 5d6f5defaba5..0cfae784a40f 100644 --- a/x11/sddm/Makefile +++ b/x11/sddm/Makefile @@ -2,7 +2,7 @@ PORTNAME= sddm DISTVERSIONPREFIX= v DISTVERSION= 0.21.0-36 DISTVERSIONSUFFIX= -gc2b97dd -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= x11 MAINTAINER= kde@FreeBSD.org diff --git a/x11/sddm/files/patch-src_common_VirtualTerminal.cpp b/x11/sddm/files/patch-src_common_VirtualTerminal.cpp index 89717f5bd0b9..cc4c6e961794 100644 --- a/x11/sddm/files/patch-src_common_VirtualTerminal.cpp +++ b/x11/sddm/files/patch-src_common_VirtualTerminal.cpp @@ -8,23 +8,3 @@ #else #include <linux/vt.h> #include <linux/kd.h> -@@ -217,6 +218,19 @@ out: - // set graphics mode to prevent flickering - if (ioctl(fd, KDSETMODE, KD_GRAPHICS) < 0) - qWarning("Failed to set graphics mode for VT %d: %s", vt, strerror(errno)); -+ -+#ifdef __FreeBSD__ -+ struct termios tios; -+ -+ if (tcgetattr(fd, &tios) != 0) { -+ qFatal("Failed to get term attrs for VT %d: %s", vt, strerror(errno)); -+ } else { -+ cfmakeraw(&tios); -+ if (tcsetattr(fd, TCSAFLUSH, &tios) != 0) { -+ qWarning("Failed to set term attrs for VT %d: %s", vt, strerror(errno)); -+ } -+ } -+#endif - - // it's possible that the current VT was left in a broken - // combination of states (KD_GRAPHICS with VT_AUTO) that we diff --git a/x11/sddm/files/patch-src_helper_UserSession.cpp b/x11/sddm/files/patch-src_helper_UserSession.cpp new file mode 100644 index 000000000000..c9b9ba0ad5da --- /dev/null +++ b/x11/sddm/files/patch-src_helper_UserSession.cpp @@ -0,0 +1,84 @@ +This patch is twofold. First, it contains + +https://github.com/sddm/sddm/pull/2210 + +then it prevents key combinations like Ctrl+C, Alt+F4, Ctrl+Alt+Del to go +directly into the VT causing unwanted effects. This part was copied from +bsd_init.c of xorg-server. + +It does not restore the VT after messing it, but in practice the VT being used +for Wayland session starts from 10 and it isnt possible to switch into it via +normal ways. + +--- src/helper/UserSession.cpp.orig 2025-01-31 09:57:01 UTC ++++ src/helper/UserSession.cpp +@@ -40,6 +40,9 @@ + #include <fcntl.h> + #include <sched.h> + #ifdef Q_OS_FREEBSD ++#include <sys/consio.h> ++#include <sys/kbio.h> ++#include <termios.h> + #include <login_cap.h> + #endif + +@@ -191,6 +194,9 @@ namespace SDDM { + const bool x11UserSession = sessionType == QLatin1String("x11") && sessionClass == QLatin1String("user"); + const bool waylandUserSession = sessionType == QLatin1String("wayland") && sessionClass == QLatin1String("user"); + ++ // when this is true we'll take control of the tty ++ bool takeControl = false; ++ + // When the display server is part of the session, we leak the VT into + // the session as stdin so that it stays open without races + if (hasDisplayServer || waylandUserSession) { +@@ -199,9 +205,6 @@ namespace SDDM { + QString ttyString = VirtualTerminal::path(vtNumber); + int vtFd = ::open(qPrintable(ttyString), O_RDWR | O_NOCTTY); + +- // when this is true we'll take control of the tty +- bool takeControl = false; +- + if (vtNumber > 0 && vtFd > 0) { + dup2(vtFd, STDIN_FILENO); + ::close(vtFd); +@@ -229,8 +232,38 @@ namespace SDDM { + } + + if (vtNumber > 0) +- VirtualTerminal::jumpToVt(vtNumber, x11UserSession); ++ VirtualTerminal::jumpToVt(vtNumber, true); + } ++ ++#ifdef __FreeBSD__ ++ if (waylandUserSession) { ++ Q_ASSERT(takeControl); ++ ++ struct termios tios; ++ int vtFd = STDIN_FILENO; ++ ++ if (tcgetattr(vtFd, &tios) != 0) { ++ qWarning("Failed to get term attrs for VT 1: %s", strerror(errno)); ++ } ++ ++ /* disable special keys */ ++ if (ioctl(vtFd, KDSKBMODE, K_RAW) < 0) { ++ qWarning("KDSKBMODE K_RAW failed (%s)", strerror(errno)); ++ } ++ ++ tios.c_iflag = IGNPAR | IGNBRK; ++ tios.c_oflag = 0; ++ tios.c_cflag = CREAD | CS8; ++ tios.c_lflag = 0; ++ tios.c_cc[VTIME] = 0; ++ tios.c_cc[VMIN] = 1; ++ cfsetispeed(&tios, 9600); ++ cfsetospeed(&tios, 9600); ++ if (tcsetattr(vtFd, TCSANOW, &tios) != 0) { ++ qWarning("tcsetattr TCSANOW failed (%s)", strerror(errno)); ++ } ++ } ++#endif + + #ifdef Q_OS_LINUX + // enter Linux namespaceshome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a70c551.43fa4.b2e5d61>
