diff --git a/x11/sddm/Makefile b/x11/sddm/Makefile index 5d6f5defaba5..0cfae784a40f 100644 --- a/x11/sddm/Makefile +++ b/x11/sddm/Makefile @@ -1,79 +1,79 @@ PORTNAME= sddm DISTVERSIONPREFIX= v DISTVERSION= 0.21.0-36 DISTVERSIONSUFFIX= -gc2b97dd -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= x11 MAINTAINER= kde@FreeBSD.org COMMENT= QML based login manager WWW= https://github.com/sddm/sddm # The source code is GPLv2+, but the provided themes are: # - CC-BY 3.0 (default greeter theme, maldives) # - CC-BY 4.0 (maya) # - Apache20 (font included with maya) LICENSE= GPLv2+ CC-BY-3.0 CC-BY-4.0 APACHE20 LICENSE_COMB= multi LICENSE_FILE_CC-BY-3.0= ${WRKSRC}/LICENSE.CC-BY-3.0 LICENSE_FILE_GPLv2+ = ${WRKSRC}/LICENSE BUILD_DEPENDS= rst2man:textproc/py-docutils@${PY_FLAVOR} RUN_DEPENDS= consolekit2>1.2.5:sysutils/consolekit2 \ dbus-launch:devel/dbus \ xauth:x11/xauth \ xmessage:x11/xmessage \ xrdb:x11/xrdb \ xsetroot:x11/xsetroot \ setxkbmap:x11/setxkbmap USES= cmake compiler:c++17-lang cpe gl pkgconfig python:build qt:6 xorg CPE_VENDOR= ${PORTNAME}_project USE_GITHUB= yes USE_GL= gl opengl # GLX USE_QT= base declarative \ tools:build USE_RC_SUBR= sddm USE_XORG= xau xcb CMAKE_ARGS= -DACCOUNTSSERVICE_DATA_DIR:PATH=/var/db/AccountsService \ -DCMAKE_INSTALL_SYSCONFDIR:PATH=${LOCALBASE}/etc \ -DRST2MAN_EXECUTABLE=${LOCALBASE}/bin/rst2man \ -DSDDM_INITIAL_VT=7 \ -DUID_MIN=1000 \ -DUID_MAX=65000 CMAKE_ON= BUILD_MAN_PAGES \ BUILD_WITH_QT6 CONFLICTS_INSTALL= lightdm SUB_FILES= xinit-session \ xinitrc.desktop USERS= sddm GROUPS= sddm post-patch: @${REINPLACE_CMD} -e 's#/etc/X11#${LOCALBASE}/etc/X11#' \ -e 's#/usr/bin/#${LOCALBASE}/bin/#g' \ -e 's#/usr/share/#${LOCALBASE}/share/#' \ -e 's#%%LOCALBASE%%#${LOCALBASE}#g' \ ${WRKSRC}/data/scripts/Xsession \ ${WRKSRC}/src/common/Configuration.h \ ${WRKSRC}/src/greeter/waylandkeyboardbackend.cpp post-install: # Install xsession.desktop to launch .xinitrc via sddm. ${MKDIR} ${STAGEDIR}${PREFIX}/share/xsessions ${INSTALL_DATA} ${FILESDIR}/sddm.conf.default ${STAGEDIR}${PREFIX}/etc ${INSTALL_DATA} ${WRKDIR}/xinitrc.desktop ${STAGEDIR}${PREFIX}/share/xsessions ${INSTALL_SCRIPT} ${WRKDIR}/xinit-session ${STAGEDIR}${PREFIX}/share/sddm/scripts # Install our own PAM configs. Upstream is no longer providing these for any # platform and now just leaves this part to downstream packagers. # https://github.com/sddm/sddm/commit/b82f9be9cbd25e734958ad5eb3465579befcd0c0 # https://github.com/sddm/sddm/commit/ae072f901671b68861da9577e3e12e350a9053d5 ${CP} ${FILESDIR}/sddm.default ${STAGEDIR}${PREFIX}/etc/pam.d ${CP} ${FILESDIR}/sddm-autologin.default ${STAGEDIR}${PREFIX}/etc/pam.d ${CP} ${FILESDIR}/sddm-greeter.default ${STAGEDIR}${PREFIX}/etc/pam.d .include 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 @@ -1,30 +1,10 @@ --- src/common/VirtualTerminal.cpp.orig 2025-01-31 09:57:01 UTC +++ src/common/VirtualTerminal.cpp @@ -29,6 +29,7 @@ #include #ifdef __FreeBSD__ #include +#include #else #include #include -@@ -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 + #include + #ifdef Q_OS_FREEBSD ++#include ++#include ++#include + #include + #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 namespaces