diff options
Diffstat (limited to 'user/sddm')
-rw-r--r-- | user/sddm/APKBUILD | 47 | ||||
-rw-r--r-- | user/sddm/allocate-vt.patch | 220 | ||||
-rw-r--r-- | user/sddm/authed.patch | 32 | ||||
-rw-r--r-- | user/sddm/autologin-pam.patch | 80 | ||||
-rw-r--r-- | user/sddm/autologin-type.patch | 31 | ||||
-rw-r--r-- | user/sddm/ck2-support.patch | 89 | ||||
-rw-r--r-- | user/sddm/cleanup-xorg.patch | 63 | ||||
-rw-r--r-- | user/sddm/qt515.patch | 23 | ||||
-rw-r--r-- | user/sddm/retry.patch | 115 | ||||
-rw-r--r-- | user/sddm/revert-fedora.patch | 74 | ||||
-rw-r--r-- | user/sddm/sddm.initd | 2 | ||||
-rw-r--r-- | user/sddm/sddm.post-install | 2 | ||||
-rw-r--r-- | user/sddm/session-env.patch | 122 | ||||
-rw-r--r-- | user/sddm/utmpx.patch | 8 | ||||
-rw-r--r-- | user/sddm/xephyr.patch | 171 |
15 files changed, 972 insertions, 107 deletions
diff --git a/user/sddm/APKBUILD b/user/sddm/APKBUILD index b37641257..1db377aa7 100644 --- a/user/sddm/APKBUILD +++ b/user/sddm/APKBUILD @@ -1,26 +1,36 @@ # Contributor: A. Wilcox <awilfox@adelielinux.org> # Maintainer: A. Wilcox <awilfox@adelielinux.org> pkgname=sddm -pkgver=0.18.1 -pkgrel=2 +pkgver=0.19.0 +pkgrel=0 pkgdesc="Simple Desktop Display Manager" url="https://github.com/sddm/sddm/" +pkgusers="sddm" +pkggroups="sddm" arch="all" license="GPL-2.0+" -depends="consolekit2 dbus-x11" +depends="dbus-x11 elogind" makedepends="cmake extra-cmake-modules qt5-qtbase-dev libxcb-dev upower-dev - consolekit2-dev linux-pam-dev qt5-qtdeclarative-dev qt5-qttools-dev + elogind-dev linux-pam-dev qt5-qtdeclarative-dev qt5-qttools-dev utmps-dev" subpackages="$pkgname-lang $pkgname-openrc" install="sddm.post-install" langdir="/usr/share/sddm/translations" -pkgusers="sddm" -pkggroups="sddm" +# Patch files are in order of needed application. source="https://github.com/sddm/sddm/releases/download/v$pkgver/sddm-$pkgver.tar.xz - ck2-support.patch pam-path-fix.patch - sddm.initd utmpx.patch + revert-fedora.patch + xephyr.patch + retry.patch + cleanup-xorg.patch + authed.patch + allocate-vt.patch + autologin-type.patch + autologin-pam.patch + session-env.patch + qt515.patch + sddm.initd " build() { @@ -35,9 +45,11 @@ build() { -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ -DCMAKE_C_FLAGS="$CFLAGS" \ -DENABLE_JOURNALD=OFF \ + -DNO_SYSTEMD=ON \ + -DUSE_ELOGIND=ON \ -DUID_MIN=500 \ -DUID_MAX=65000 \ - ${CMAKE_CROSSOPTS} + ${CMAKE_CROSSOPTS} . make } @@ -55,8 +67,17 @@ openrc() { depends="sddm xorg-server" } -sha512sums="ff0637600cda2f4da1f643f047f8ee822bd9651ae4ccbb614b9804175c97360ada7af93e07a7b63832f014ef6e7d1b5380ab2b8959f8024ea520fa5ff17efd60 sddm-0.18.1.tar.xz -075e3baf24606cdea620737dbc00f7cf5c487ab6d88e37b23a581afcfbcf872c379753c89c80ad5c90c28fa27d3e5c5df64d4fd30764fdbfc0586e0f26666fe1 ck2-support.patch +sha512sums="0a40816bc105a1e930fec2d65fabff0ae7e27c641235d90e41f6fbaa86af4bb774a9e30f7548ce2c6c791e6d4f8195b02afddedca60a9e7c77447702e728edc3 sddm-0.19.0.tar.xz f0b4eb7ef0581701157f9decc637629156f36f6711b9a4bae517f94d7a1df614c81bbd891c918f07ac50e2a3d1519c43ccb9eefd80282c95dd79eca0e8d90904 pam-path-fix.patch -10cac48b821ff7ad39ece4cbc45a8e814d00251b0f8d02f9e42888ad97f465438320f078663be98c5b39630a0bbb26f4f0d76b44574c87a76b4871872add8b9f sddm.initd -c42d8b3edbc0ae7e3d5ea7bb0080c5c50e0569f0ea947e1ba17bc794c8c0d67a214e62aad7eba0a51791c44b29a3017692bbe738250c63cb2219891bb1313422 utmpx.patch" +b61c02e9d75c03c5a04a44bf53bf1d7df3afe6214b2c7f6da8a2b3a78c859443fb2af6ff748a9d369707e6eaab8c0e5f9872c35e52e602836795b7099330ba00 utmpx.patch +51a0b6d427da8ea8dfbeb043ae4eb47f6c55645d03ed3a88e7583c216c52916863d8184faa6402f348e6ca704098b180079f9c6d4faaca1855bad58f9cf5f531 revert-fedora.patch +65fb8d772ca149f3616cb9d106eebf246b65bc8c0d2e328bd361dcc2664afb6ae467f698ac656653c5092f3b2b5f14b2980f9f1f3929839bb0674c5c801b36a1 xephyr.patch +d47123e097e8ea918ba112332272dbc94a3f06a76dc01080fd80f5f945320e0647d8f84d4232d32650c9705e2228c054748ce7207492a4c7e6039655668a0440 retry.patch +5dd057acc054f905ad0b9b0924eeb792b417cfe9d506f1d138266b9dc38c229b1b32d0c2443e85db5bba90d8c64efcebfceac07bd742acf0d8c10d992e8b4e1a cleanup-xorg.patch +fea260015dfaf82e97ea2a77d7810e11f85503446ce6450ed9fe3072ce2151bb2ecac56fbc917a47b8ebcaf9fa51c077d4e798c4ef62919e18d1751fd7de92fc authed.patch +829397bdb1d5fd6887b7836d503b081a8827346aa775b702d4ea9946d3ff4374446175e462732e52e33e1a53481b99cbe652c44e031c79823d5fbf67e4b48c46 allocate-vt.patch +378a735946c93dc9fb746cc4d4cf436d728ec0f1fddd3fcac8797ef90acb0d6582e41ac0a91b96d3886695b8664627ef81822f531c67deb12085626206f27136 autologin-type.patch +327d3f1d35d493cc302096d7047d0159e570c94320df52efe7e4cefeff910b38e322eaba57396e91efed7f9fb2da5ccf19b383cbfbd14537e016c1dfa319bd8e autologin-pam.patch +0997ae1ea2f0b44835a397f107d73ae2eb0d492cbf97b3f446c388eebb6ec0b9255b2352a51c9e00ebf846c0fec61998895aba865e06814ee20ab9d526b3f353 session-env.patch +77d1abe99a8f0c38f9bf2d1ec695d371a46842b7f64c0a53e8f5c34550de5f9fba7ae9b187ba698e6658f03b18c6bd4b975532d9f2cecdb857e42e20413e96a7 qt515.patch +d603934552bad47edda458d7a4df2310e98bde74bdb3bf8588f5171b2a5d68814192b8dc8f5599b35402f9a747d519d985d4976e7aa50dabed445f99a112594c sddm.initd" diff --git a/user/sddm/allocate-vt.patch b/user/sddm/allocate-vt.patch new file mode 100644 index 000000000..34e599cd3 --- /dev/null +++ b/user/sddm/allocate-vt.patch @@ -0,0 +1,220 @@ +From f0b6dec66a6fc8cc6e21da57f81190843b483f76 Mon Sep 17 00:00:00 2001 +From: Pier Luigi Fiorini <pierluigi.fiorini@liri.io> +Date: Sun, 28 Feb 2021 12:07:33 +0100 +Subject: [PATCH] Allocate VT for the display + +Replace the old crude algorithm to find the next available VT with a +more reliable method using the VT_OPENQRY ioctl. + +General.MinimumVT setting is now obsolete and it's no longer used. +--- + CMakeLists.txt | 4 ---- + data/man/sddm.conf.rst.in | 2 +- + src/common/Configuration.h | 1 - + src/common/Constants.h.in | 1 - + src/daemon/Display.cpp | 7 +++++-- + src/daemon/Display.h | 2 +- + src/daemon/Seat.cpp | 38 +++----------------------------------- + src/daemon/Seat.h | 3 +-- + 8 files changed, 11 insertions(+), 47 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e52e0e903..9614b4e1e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -141,7 +141,6 @@ if(SYSTEMD_FOUND) + string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_SYSTEM_UNIT_DIR ${SYSTEMD_SYSTEM_UNIT_DIR}) + endif() + +- set(MINIMUM_VT 1) + set(HALT_COMMAND "/usr/bin/systemctl poweroff") + set(REBOOT_COMMAND "/usr/bin/systemctl reboot") + else() +@@ -159,7 +158,6 @@ if(ELOGIND_FOUND) + add_definitions(-DHAVE_ELOGIND) + set(CMAKE_AUTOMOC_MOC_OPTIONS -DHAVE_ELOGIND) + +- set(MINIMUM_VT 7) + set(HALT_COMMAND "/usr/bin/loginctl poweroff") + set(REBOOT_COMMAND "/usr/bin/loginctl reboot") + endif() +@@ -171,10 +169,8 @@ if (NOT ELOGIND_FOUND AND NOT SYSTEMD_FOUND) + # commands for shutdown and reboot. On FreeBSD, there are + # normally more getty's running than on Linux. + if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") +- set(MINIMUM_VT 9) + set(HALT_COMMAND "/sbin/shutdown -p now") + else() +- set(MINIMUM_VT 7) + set(HALT_COMMAND "/sbin/shutdown -h -P now") + endif() + set(REBOOT_COMMAND "/sbin/shutdown -r now") +diff --git a/data/man/sddm.conf.rst.in b/data/man/sddm.conf.rst.in +index bee07681d..1061540c0 100644 +--- a/data/man/sddm.conf.rst.in ++++ b/data/man/sddm.conf.rst.in +@@ -144,7 +144,7 @@ OPTIONS + Minimum virtual terminal number that will be used + by the first display. Virtual terminal number will + increase as new displays added. +- Default value is @MINIMUM_VT@. ++ This setting is no longer available since SDDM v0.20. + + `EnableHiDPI=` + Enables Qt's automatic HiDPI scaling. +diff --git a/src/common/Configuration.h b/src/common/Configuration.h +index cf44a629c..b79871988 100644 +--- a/src/common/Configuration.h ++++ b/src/common/Configuration.h +@@ -70,7 +70,6 @@ namespace SDDM { + Entry(UserAuthFile, QString, _S(".Xauthority"), _S("Path to the Xauthority file")); + Entry(DisplayCommand, QString, _S(DATA_INSTALL_DIR "/scripts/Xsetup"), _S("Path to a script to execute when starting the display server")); + Entry(DisplayStopCommand, QString, _S(DATA_INSTALL_DIR "/scripts/Xstop"), _S("Path to a script to execute when stopping the display server")); +- Entry(MinimumVT, int, MINIMUM_VT, _S("The lowest virtual terminal number that will be used.")); + Entry(EnableHiDPI, bool, false, _S("Enable Qt's automatic high-DPI scaling")); + ); + +diff --git a/src/common/Constants.h.in b/src/common/Constants.h.in +index e174b5bfc..480512880 100644 +--- a/src/common/Constants.h.in ++++ b/src/common/Constants.h.in +@@ -37,7 +37,6 @@ + #define SYSTEM_CONFIG_DIR "@SYSTEM_CONFIG_DIR@" + + #define LOG_FILE "@LOG_FILE@" +-#define MINIMUM_VT @MINIMUM_VT@ + + #define UID_MIN @UID_MIN@ + #define UID_MAX @UID_MAX@ +diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp +index ed13bae79..3c77454fc 100644 +--- a/src/daemon/Display.cpp ++++ b/src/daemon/Display.cpp +@@ -46,6 +46,7 @@ + + #include "Login1Manager.h" + #include "Login1Session.h" ++#include "VirtualTerminal.h" + + #if defined(Q_OS_LINUX) + #include <utmp.h> +@@ -53,14 +54,16 @@ + #include <utmpx.h> + + namespace SDDM { +- Display::Display(const int terminalId, Seat *parent) : QObject(parent), +- m_terminalId(terminalId), ++ Display::Display(Seat *parent) : QObject(parent), + m_auth(new Auth(this)), + m_displayServer(new XorgDisplayServer(this)), + m_seat(parent), + m_socketServer(new SocketServer(this)), + m_greeter(new Greeter(this)) { + ++ // Allocate vt ++ m_terminalId = VirtualTerminal::setUpNewVt(); ++ + // respond to authentication requests + m_auth->setVerbose(true); + connect(m_auth, &Auth::requestChanged, this, &Display::slotRequestChanged); +diff --git a/src/daemon/Display.h b/src/daemon/Display.h +index 8b3c2c635..61dd9f630 100644 +--- a/src/daemon/Display.h ++++ b/src/daemon/Display.h +@@ -41,7 +41,7 @@ namespace SDDM { + Q_OBJECT + Q_DISABLE_COPY(Display) + public: +- explicit Display(int terminalId, Seat *parent); ++ explicit Display(Seat *parent); + ~Display(); + + QString displayId() const; +diff --git a/src/daemon/Seat.cpp b/src/daemon/Seat.cpp +index 838c2221d..a2f3d0c39 100644 +--- a/src/daemon/Seat.cpp ++++ b/src/daemon/Seat.cpp +@@ -33,18 +33,6 @@ + #include <functional> + + namespace SDDM { +- int findUnused(int minimum, std::function<bool(const int)> used) { +- // initialize with minimum +- int number = minimum; +- +- // find unused +- while (used(number)) +- number++; +- +- // return number; +- return number; +- } +- + Seat::Seat(const QString &name, QObject *parent) : QObject(parent), m_name(name) { + createDisplay(); + } +@@ -53,30 +41,13 @@ namespace SDDM { + return m_name; + } + +- void Seat::createDisplay(int terminalId) { ++ void Seat::createDisplay() { + //reload config if needed + mainConfig.load(); + +- if (m_name == QLatin1String("seat0")) { +- if (terminalId == -1) { +- // find unused terminal +- terminalId = findUnused(mainConfig.X11.MinimumVT.get(), [&](const int number) { +- return m_terminalIds.contains(number); +- }); +- } +- +- // mark terminal as used +- m_terminalIds << terminalId; +- +- // log message +- qDebug() << "Adding new display" << "on vt" << terminalId << "..."; +- } +- else { +- qDebug() << "Adding new VT-less display..."; +- } +- + // create a new display +- Display *display = new Display(terminalId, this); ++ qDebug() << "Adding new display..."; ++ Display *display = new Display(this); + + // restart display on stop + connect(display, &Display::stopped, this, &Seat::displayStopped); +@@ -112,9 +83,6 @@ namespace SDDM { + // remove display from list + m_displays.removeAll(display); + +- // mark display and terminal ids as unused +- m_terminalIds.removeAll(display->terminalId()); +- + // stop the display + display->blockSignals(true); + display->stop(); +diff --git a/src/daemon/Seat.h b/src/daemon/Seat.h +index f9fe7331f..685eaedd2 100644 +--- a/src/daemon/Seat.h ++++ b/src/daemon/Seat.h +@@ -35,7 +35,7 @@ namespace SDDM { + const QString &name() const; + + public slots: +- void createDisplay(int terminalId = -1); ++ void createDisplay(); + void removeDisplay(SDDM::Display* display); + + private slots: +@@ -47,7 +47,6 @@ namespace SDDM { + QString m_name; + + QVector<Display *> m_displays; +- QVector<int> m_terminalIds; + }; + } + diff --git a/user/sddm/authed.patch b/user/sddm/authed.patch new file mode 100644 index 000000000..fe76652f8 --- /dev/null +++ b/user/sddm/authed.patch @@ -0,0 +1,32 @@ +From b2520c9fdeff081b1ac66a4a15289cedfa6944b9 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt <fabian@ritter-vogt.de> +Date: Wed, 9 Dec 2020 19:33:08 +0100 +Subject: [PATCH] Emit XorgDisplayServer::started only when the auth file is + ready + +--- + src/daemon/XorgDisplayServer.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp +index 3a7bee0d8..331adcda7 100644 +--- a/src/daemon/XorgDisplayServer.cpp ++++ b/src/daemon/XorgDisplayServer.cpp +@@ -219,8 +219,6 @@ namespace SDDM { + // close our pipe + close(pipeFds[0]); + +- emit started(); +- + // The file is also used by the greeter, which does care about the + // display number. Write the proper entry, if it's different. + if(m_display != QStringLiteral(":0")) { +@@ -232,6 +230,8 @@ namespace SDDM { + } + changeOwner(m_authPath); + ++ emit started(); ++ + // set flag + m_started = true; + diff --git a/user/sddm/autologin-pam.patch b/user/sddm/autologin-pam.patch new file mode 100644 index 000000000..bb4560b69 --- /dev/null +++ b/user/sddm/autologin-pam.patch @@ -0,0 +1,80 @@ +From a6280bde181c72811ab5dd0eb525f112ac72099f Mon Sep 17 00:00:00 2001 +From: Aleix Pol <aleixpol@kde.org> +Date: Thu, 24 Jun 2021 17:08:10 +0200 +Subject: [PATCH] pam: Do not use tally2 if faillock is present + +From pam 1.4.0 release notes: + +Deprecated pam_tally and pam_tally2: these modules are no longer built +by default and will be removed in the next release, use pam_faillock +instead. +https://github.com/linux-pam/linux-pam/releases/tag/v1.4.0 + +Fixes #1313 +--- + cmake/FindPAM.cmake | 1 + + services/CMakeLists.txt | 6 +++++- + services/sddm-autologin-tally2.pam | 13 +++++++++++++ + services/sddm-autologin.pam | 2 +- + 4 files changed, 20 insertions(+), 2 deletions(-) + create mode 100755 services/sddm-autologin-tally2.pam + +diff --git a/cmake/FindPAM.cmake b/cmake/FindPAM.cmake +index f209c0b46..a64680bea 100644 +--- a/cmake/FindPAM.cmake ++++ b/cmake/FindPAM.cmake +@@ -13,6 +13,7 @@ endif (PAM_INCLUDE_DIR AND PAM_LIBRARY) + find_path(PAM_INCLUDE_DIR NAMES security/pam_appl.h pam/pam_appl.h) + find_library(PAM_LIBRARY pam) + find_library(DL_LIBRARY dl) ++find_library(HAVE_PAM_FAILLOCK NAME pam_faillock.so PATH_SUFFIXES security) + + if (PAM_INCLUDE_DIR AND PAM_LIBRARY) + set(PAM_FOUND TRUE) +diff --git a/services/CMakeLists.txt b/services/CMakeLists.txt +index fbf760895..6e4fa0f93 100644 +--- a/services/CMakeLists.txt ++++ b/services/CMakeLists.txt +@@ -10,6 +10,10 @@ else() + endif() + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/sddm-greeter.pam.in" "${CMAKE_CURRENT_BINARY_DIR}/sddm-greeter.pam") + ++if(HAVE_PAM_FAILLOCK) ++ install(FILES sddm-autologin.pam DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/pam.d RENAME sddm-autologin) ++else() ++ install(FILES sddm-autologin-tally2.pam DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/pam.d RENAME sddm-autologin) ++endif() + install(FILES sddm.pam DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/pam.d RENAME sddm) +-install(FILES sddm-autologin.pam DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/pam.d RENAME sddm-autologin) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sddm-greeter.pam" DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/pam.d RENAME sddm-greeter) +diff --git a/services/sddm-autologin-tally2.pam b/services/sddm-autologin-tally2.pam +new file mode 100755 +index 000000000..99729bc9b +--- /dev/null ++++ b/services/sddm-autologin-tally2.pam +@@ -0,0 +1,13 @@ ++#%PAM-1.0 ++auth required pam_env.so ++auth required pam_tally2.so file=/var/log/tallylog onerr=succeed ++auth required pam_shells.so ++auth required pam_nologin.so ++auth required pam_permit.so ++-auth optional pam_gnome_keyring.so ++-auth optional pam_kwallet5.so ++account include system-local-login ++password include system-local-login ++session include system-local-login ++-session optional pam_gnome_keyring.so auto_start ++-session optional pam_kwallet5.so auto_start +diff --git a/services/sddm-autologin.pam b/services/sddm-autologin.pam +index 99729bc9b..b42991e38 100755 +--- a/services/sddm-autologin.pam ++++ b/services/sddm-autologin.pam +@@ -1,6 +1,6 @@ + #%PAM-1.0 + auth required pam_env.so +-auth required pam_tally2.so file=/var/log/tallylog onerr=succeed ++auth required pam_faillock.so preauth + auth required pam_shells.so + auth required pam_nologin.so + auth required pam_permit.so diff --git a/user/sddm/autologin-type.patch b/user/sddm/autologin-type.patch new file mode 100644 index 000000000..cc5738065 --- /dev/null +++ b/user/sddm/autologin-type.patch @@ -0,0 +1,31 @@ +From e81dfcd6913c4fbd1801597168291b1e396633d8 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt <fabian@ritter-vogt.de> +Date: Wed, 6 Jan 2021 16:00:34 +0100 +Subject: [PATCH] Fix sessions being started as the wrong type on autologin + +For autologin, the last session is used, which contains a full path. +Display::findSessionEntry didn't handle that correctly, which led to +X11 sessions getting started as Wayland ones (or the other way around +before 994fa67). + +Fixes #1348 +--- + src/daemon/Display.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp +index b95f6e51e..9f1fabc68 100644 +--- a/src/daemon/Display.cpp ++++ b/src/daemon/Display.cpp +@@ -245,6 +245,11 @@ namespace SDDM { + } + + bool Display::findSessionEntry(const QDir &dir, const QString &name) const { ++ // Given an absolute path: Check that it matches dir ++ const QFileInfo fileInfo(name); ++ if (fileInfo.isAbsolute() && fileInfo.absolutePath() != dir.absolutePath()) ++ return false; ++ + QString fileName = name; + + // append extension diff --git a/user/sddm/ck2-support.patch b/user/sddm/ck2-support.patch deleted file mode 100644 index f073877fc..000000000 --- a/user/sddm/ck2-support.patch +++ /dev/null @@ -1,89 +0,0 @@ -diff --git a/src/daemon/LogindDBusTypes.cpp b/src/daemon/LogindDBusTypes.cpp -index 79c7031..4ccfeb5 100644 ---- a/src/daemon/LogindDBusTypes.cpp -+++ b/src/daemon/LogindDBusTypes.cpp -@@ -18,6 +18,7 @@ public: - QString sessionIfaceName; - QString seatIfaceName; - QString userIfaceName; -+ QString newSeatSignalName; - }; - - LogindPathInternal::LogindPathInternal() -@@ -55,18 +56,20 @@ LogindPathInternal::LogindPathInternal() - seatIfaceName = QStringLiteral("org.freedesktop.login1.Seat"); - sessionIfaceName = QStringLiteral("org.freedesktop.login1.Session"); - userIfaceName = QStringLiteral("org.freedesktop.login1.User"); -+ newSeatSignalName = QStringLiteral("SeatNew"); - return; - } - - if (QDBusConnection::systemBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.ConsoleKit"))) { -- qDebug() << "Console kit interface found"; -+ qDebug() << "ConsoleKit interface found"; - available = true; - serviceName = QStringLiteral("org.freedesktop.ConsoleKit"); - managerPath = QStringLiteral("/org/freedesktop/ConsoleKit/Manager"); - managerIfaceName = QStringLiteral("org.freedesktop.ConsoleKit.Manager"); //note this doesn't match logind - seatIfaceName = QStringLiteral("org.freedesktop.ConsoleKit.Seat"); - sessionIfaceName = QStringLiteral("org.freedesktop.ConsoleKit.Session"); - userIfaceName = QStringLiteral("org.freedesktop.ConsoleKit.User"); -+ newSeatSignalName = QStringLiteral("SeatAdded"); - return; - } - qDebug() << "No session manager found"; -@@ -109,3 +112,8 @@ QString Logind::userIfaceName() - { - return s_instance->userIfaceName; - } -+ -+QString Logind::newSeatSignalName() -+{ -+ return s_instance->newSeatSignalName; -+} -diff --git a/src/daemon/LogindDBusTypes.h b/src/daemon/LogindDBusTypes.h -index f1e8dd4..028879a 100644 ---- a/src/daemon/LogindDBusTypes.h -+++ b/src/daemon/LogindDBusTypes.h -@@ -13,6 +13,7 @@ struct Logind - static QString sessionIfaceName(); - static QString seatIfaceName(); - static QString userIfaceName(); -+ static QString newSeatSignalName(); - }; - - -diff --git a/src/daemon/SeatManager.cpp b/src/daemon/SeatManager.cpp -index c5afc57..6281ea8 100644 ---- a/src/daemon/SeatManager.cpp -+++ b/src/daemon/SeatManager.cpp -@@ -26,6 +26,7 @@ - #include <QDBusMessage> - #include <QDBusPendingReply> - #include <QDBusContext> -+#include <QDebug> - - #include "LogindDBusTypes.h" - -@@ -59,6 +60,12 @@ namespace SDDM { - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply); - connect(watcher, &QDBusPendingCallWatcher::finished, this, [=]() { - watcher->deleteLater(); -+ if (Logind::serviceName().contains(QStringLiteral("ConsoleKit"))) { -+ m_canGraphical = true; -+ emit canGraphicalChanged(m_canGraphical); -+ return; -+ } -+ - if (!reply.isValid()) - return; - -@@ -113,7 +120,7 @@ namespace SDDM { - } - }); - -- QDBusConnection::systemBus().connect(Logind::serviceName(), Logind::managerPath(), Logind::managerIfaceName(), QStringLiteral("SeatNew"), this, SLOT(logindSeatAdded(QString,QDBusObjectPath))); -+ QDBusConnection::systemBus().connect(Logind::serviceName(), Logind::managerPath(), Logind::managerIfaceName(), Logind::newSeatSignalName(), this, SLOT(logindSeatAdded(QString,QDBusObjectPath))); - QDBusConnection::systemBus().connect(Logind::serviceName(), Logind::managerPath(), Logind::managerIfaceName(), QStringLiteral("SeatRemoved"), this, SLOT(logindSeatRemoved(QString,QDBusObjectPath))); - } - diff --git a/user/sddm/cleanup-xorg.patch b/user/sddm/cleanup-xorg.patch new file mode 100644 index 000000000..7949b2dbf --- /dev/null +++ b/user/sddm/cleanup-xorg.patch @@ -0,0 +1,63 @@ +From 3b00cd06f82837ba85f37c9f632261e7b4c6fd35 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt <fabian@ritter-vogt.de> +Date: Wed, 9 Dec 2020 19:28:41 +0100 +Subject: [PATCH] Explicitly stop Xorg when starting fails + +When Xorg starts but there is an error, stop it explicitly instead of assuming +that X exits itself. This avoids a possibly lingering Xorg process in the +XorgDisplayServer instance. Add a check and warning message if Xorg is +restarted too early (shouldn't happen). +--- + src/daemon/XorgDisplayServer.cpp | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp +index 5f40fe8c3..3a7bee0d8 100644 +--- a/src/daemon/XorgDisplayServer.cpp ++++ b/src/daemon/XorgDisplayServer.cpp +@@ -118,6 +118,11 @@ namespace SDDM { + if (m_started) + return false; + ++ if (process) { ++ qCritical() << "Tried to start Xorg before previous instance exited"; ++ return false; ++ } ++ + // create process + process = new QProcess(this); + +@@ -195,6 +200,7 @@ namespace SDDM { + qCritical("Failed to open pipe to start X Server"); + + close(pipeFds[0]); ++ stop(); + return false; + } + QByteArray displayNumber = readPipe.readLine(); +@@ -203,6 +209,7 @@ namespace SDDM { + qCritical("Failed to read display number from pipe"); + + close(pipeFds[0]); ++ stop(); + return false; + } + displayNumber.prepend(QByteArray(":")); +@@ -219,6 +226,7 @@ namespace SDDM { + if(m_display != QStringLiteral(":0")) { + if(!addCookie(m_authPath)) { + qCritical() << "Failed to write xauth file"; ++ stop(); + return false; + } + } +@@ -232,8 +240,7 @@ namespace SDDM { + } + + void XorgDisplayServer::stop() { +- // check flag +- if (!m_started) ++ if (!process) + return; + + // log message diff --git a/user/sddm/qt515.patch b/user/sddm/qt515.patch new file mode 100644 index 000000000..51094817c --- /dev/null +++ b/user/sddm/qt515.patch @@ -0,0 +1,23 @@ +From e93bf95c54ad8c2a1604f8d7be05339164b19308 Mon Sep 17 00:00:00 2001 +From: "aacid@kde.org" <aacid@kde.org> +Date: Thu, 12 Nov 2020 23:42:48 +0100 +Subject: [PATCH] Fix compilation once QTBUG-88431 gets fixed + +And also comes closes to Qt6 compatibility +--- + src/daemon/XorgDisplayServer.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp +index 5f93a1b37..d5f29a94a 100644 +--- a/src/daemon/XorgDisplayServer.cpp ++++ b/src/daemon/XorgDisplayServer.cpp +@@ -65,7 +65,7 @@ namespace SDDM { + // create a random hexadecimal number + const char *digits = "0123456789abcdef"; + for (int i = 0; i < 32; ++i) +- m_cookie[i] = digits[dis(gen)]; ++ m_cookie[i] = QLatin1Char(digits[dis(gen)]); + } + + XorgDisplayServer::~XorgDisplayServer() { diff --git a/user/sddm/retry.patch b/user/sddm/retry.patch new file mode 100644 index 000000000..84edc7f08 --- /dev/null +++ b/user/sddm/retry.patch @@ -0,0 +1,115 @@ +From 42c51761cc82edbaa50d702a4614e179ad4bcd63 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt <fabian@ritter-vogt.de> +Date: Thu, 12 Nov 2020 20:30:55 +0100 +Subject: [PATCH] Retry starting the display server + +Even if the CanGraphical property of a Seat is true, it's possible that it's +still too early for X to start, as it might need some driver or device which +isn't present yet. + +Fixes #1316 +--- + src/daemon/Seat.cpp | 23 ++++++++++++++++++----- + src/daemon/Seat.h | 4 +++- + src/daemon/XorgDisplayServer.cpp | 10 ++++++---- + 3 files changed, 27 insertions(+), 10 deletions(-) + +diff --git a/src/daemon/Seat.cpp b/src/daemon/Seat.cpp +index eef26da45..838c2221d 100644 +--- a/src/daemon/Seat.cpp ++++ b/src/daemon/Seat.cpp +@@ -28,6 +28,7 @@ + + #include <QDebug> + #include <QFile> ++#include <QTimer> + + #include <functional> + +@@ -52,7 +53,7 @@ namespace SDDM { + return m_name; + } + +- bool Seat::createDisplay(int terminalId) { ++ void Seat::createDisplay(int terminalId) { + //reload config if needed + mainConfig.load(); + +@@ -84,12 +85,24 @@ namespace SDDM { + m_displays << display; + + // start the display +- if (!display->start()) { +- qCritical() << "Could not start Display server on vt" << terminalId; +- return false; ++ startDisplay(display); ++ } ++ ++ void Seat::startDisplay(Display *display, int tryNr) { ++ if (display->start()) ++ return; ++ ++ // It's possible that the system isn't ready yet (driver not loaded, ++ // device not enumerated, ...). It's not possible to tell when that changes, ++ // so try a few times with a delay in between. ++ qWarning() << "Attempt" << tryNr << "starting the Display server on vt" << display->terminalId() << "failed"; ++ ++ if(tryNr >= 3) { ++ qCritical() << "Could not start Display server on vt" << display->terminalId(); ++ return; + } + +- return true; ++ QTimer::singleShot(2000, display, [=] { startDisplay(display, tryNr + 1); }); + } + + void Seat::removeDisplay(Display* display) { +diff --git a/src/daemon/Seat.h b/src/daemon/Seat.h +index bf22566b7..f9fe7331f 100644 +--- a/src/daemon/Seat.h ++++ b/src/daemon/Seat.h +@@ -35,13 +35,15 @@ namespace SDDM { + const QString &name() const; + + public slots: +- bool createDisplay(int terminalId = -1); ++ void createDisplay(int terminalId = -1); + void removeDisplay(SDDM::Display* display); + + private slots: + void displayStopped(); + + private: ++ void startDisplay(SDDM::Display *display, int tryNr = 1); ++ + QString m_name; + + QVector<Display *> m_displays; +diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp +index e60c02210..5f40fe8c3 100644 +--- a/src/daemon/XorgDisplayServer.cpp ++++ b/src/daemon/XorgDisplayServer.cpp +@@ -248,6 +248,12 @@ namespace SDDM { + } + + void XorgDisplayServer::finished() { ++ // clean up ++ if (process) { ++ process->deleteLater(); ++ process = nullptr; ++ } ++ + // check flag + if (!m_started) + return; +@@ -283,10 +289,6 @@ namespace SDDM { + displayStopScript->deleteLater(); + displayStopScript = nullptr; + +- // clean up +- process->deleteLater(); +- process = nullptr; +- + // remove authority file + QFile::remove(m_authPath); + diff --git a/user/sddm/revert-fedora.patch b/user/sddm/revert-fedora.patch new file mode 100644 index 000000000..63bb58395 --- /dev/null +++ b/user/sddm/revert-fedora.patch @@ -0,0 +1,74 @@ +From 994fa67b01ccfac1aaac08572302bbbea7842dc3 Mon Sep 17 00:00:00 2001 +Subject: Revert: Prefer Wayland sessions over X11 ones + +Reference: https://fedoraproject.org/wiki/Changes/WaylandByDefaultForPlasma +--- + src/common/Session.cpp | 8 ++++---- + src/daemon/Display.cpp | 6 +++--- + src/greeter/SessionModel.cpp | 6 +++--- + 3 files changed, 10 insertions(+), 10 deletions(-) + +--- b/src/common/Session.cpp ++++ a/src/common/Session.cpp +@@ -131,14 +131,14 @@ + m_desktopNames.clear(); + + switch (type) { ++ case X11Session: ++ m_dir = QDir(mainConfig.X11.SessionDir.get()); ++ m_xdgSessionType = QStringLiteral("x11"); ++ break; + case WaylandSession: + m_dir = QDir(mainConfig.Wayland.SessionDir.get()); + m_xdgSessionType = QStringLiteral("wayland"); + break; +- case X11Session: +- m_dir = QDir(mainConfig.X11.SessionDir.get()); +- m_xdgSessionType = QStringLiteral("x11"); +- break; + default: + m_xdgSessionType.clear(); + break; +--- b/src/daemon/Display.cpp ++++ a/src/daemon/Display.cpp +@@ -115,10 +115,10 @@ + if (autologinSession.isEmpty()) { + autologinSession = stateConfig.Last.Session.get(); + } ++ if (findSessionEntry(mainConfig.X11.SessionDir.get(), autologinSession)) { ++ sessionType = Session::X11Session; ++ } else if (findSessionEntry(mainConfig.Wayland.SessionDir.get(), autologinSession)) { +- if (findSessionEntry(mainConfig.Wayland.SessionDir.get(), autologinSession)) { + sessionType = Session::WaylandSession; +- } else if (findSessionEntry(mainConfig.X11.SessionDir.get(), autologinSession)) { +- sessionType = Session::X11Session; + } else { + qCritical() << "Unable to find autologin session entry" << autologinSession; + return false; +--- b/src/greeter/SessionModel.cpp ++++ a/src/greeter/SessionModel.cpp +@@ -41,8 +41,8 @@ + SessionModel::SessionModel(QObject *parent) : QAbstractListModel(parent), d(new SessionModelPrivate()) { + // initial population + beginResetModel(); ++ populate(Session::X11Session, mainConfig.X11.SessionDir.get()); + populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get()); +- populate(Session::X11Session, mainConfig.X11.SessionDir.get()); + endResetModel(); + + // refresh everytime a file is changed, added or removed +@@ -50,12 +50,12 @@ + connect(watcher, &QFileSystemWatcher::directoryChanged, [this](const QString &path) { + beginResetModel(); + d->sessions.clear(); ++ populate(Session::X11Session, mainConfig.X11.SessionDir.get()); + populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get()); +- populate(Session::X11Session, mainConfig.X11.SessionDir.get()); + endResetModel(); + }); ++ watcher->addPath(mainConfig.X11.SessionDir.get()); + watcher->addPath(mainConfig.Wayland.SessionDir.get()); +- watcher->addPath(mainConfig.X11.SessionDir.get()); + } + + SessionModel::~SessionModel() { diff --git a/user/sddm/sddm.initd b/user/sddm/sddm.initd index cf5c1af79..8113454cf 100644 --- a/user/sddm/sddm.initd +++ b/user/sddm/sddm.initd @@ -4,7 +4,7 @@ depends() { needs localmount after bootmisc consolefont modules netmount keymaps - use consolekit dbus + use dbus elogind } description="Simple Desktop Display Manager" diff --git a/user/sddm/sddm.post-install b/user/sddm/sddm.post-install index 3e3850cde..7078e3be2 100644 --- a/user/sddm/sddm.post-install +++ b/user/sddm/sddm.post-install @@ -1,3 +1,3 @@ #!/bin/sh -useradd -G video -c "Display manager user" -d /var/lib/sddm -m -r -s /sbin/nologin -U sddm +useradd -G video -c "Display manager user" -d /var/lib/sddm -m -r -s /sbin/nologin -U sddm || exit 0 diff --git a/user/sddm/session-env.patch b/user/sddm/session-env.patch new file mode 100644 index 000000000..e73ab8fc4 --- /dev/null +++ b/user/sddm/session-env.patch @@ -0,0 +1,122 @@ +From 093e8e54c7de33c2d7332cc3a126041263e1aa71 Mon Sep 17 00:00:00 2001 +From: davidedmundson <kde@davidedmundson.co.uk> +Date: Mon, 8 Mar 2021 07:35:55 +0000 +Subject: [PATCH] Allow addition env vars to be defined in session files + (#1370) + +We have a continual problem with developers using Plasma in custom +prefixes. We need to set mulitple additional envs and it is a constant +pain point. + +Setting XDG_DATA_DIRS and alike in a script in the Exec line of the +desktop file doesn't work properly, as this is after systemd and dbus +have already been started during pam_logind. It is currently very bodged +with more manual steps. + +Things will work much better if we can set the env before pam_logind is +run. + +Using pam_env or profile.d doesn't work as that affects all the +sessions. + +It is not intended to be used for anything other than dev setups. +--- + src/common/Session.cpp | 24 ++++++++++++++++++++++++ + src/common/Session.h | 5 +++++ + src/daemon/Display.cpp | 1 + + 3 files changed, 30 insertions(+) + +diff --git a/src/common/Session.cpp b/src/common/Session.cpp +index 3de28ef13..0aa540221 100644 +--- a/src/common/Session.cpp ++++ b/src/common/Session.cpp +@@ -107,6 +107,10 @@ namespace SDDM { + return m_isNoDisplay; + } + ++ QProcessEnvironment Session::additionalEnv() const { ++ return m_additionalEnv; ++ } ++ + void Session::setTo(Type type, const QString &_fileName) + { + QString fileName(_fileName); +@@ -178,6 +182,8 @@ namespace SDDM { + m_isHidden = line.mid(7).toLower() == QLatin1String("true"); + if (line.startsWith(QLatin1String("NoDisplay="))) + m_isNoDisplay = line.mid(10).toLower() == QLatin1String("true"); ++ if (line.startsWith(QLatin1String("X-SDDM-Env="))) ++ m_additionalEnv = parseEnv(line.mid(strlen("X-SDDM-Env="))); + } + + file.close(); +@@ -191,4 +197,22 @@ namespace SDDM { + setTo(other.type(), other.fileName()); + return *this; + } ++ ++ QProcessEnvironment SDDM::Session::parseEnv(const QString &list) ++ { ++ QProcessEnvironment env; ++ ++ const QVector<QStringRef> entryList = list.splitRef(QLatin1Char(',')); ++ for (const auto &entry: entryList) { ++ int midPoint = entry.indexOf(QLatin1Char('=')); ++ if (midPoint < 0) { ++ qWarning() << "Malformed entry in" << fileName() << ":" << entry; ++ continue; ++ } ++ env.insert(entry.left(midPoint).toString(), entry.mid(midPoint+1).toString()); ++ } ++ return env; ++ } ++ ++ + } +diff --git a/src/common/Session.h b/src/common/Session.h +index 9fd86cd02..aa196e9c6 100644 +--- a/src/common/Session.h ++++ b/src/common/Session.h +@@ -23,6 +23,7 @@ + #include <QDataStream> + #include <QDir> + #include <QSharedPointer> ++#include <QProcessEnvironment> + + namespace SDDM { + class SessionModel; +@@ -59,11 +60,14 @@ namespace SDDM { + bool isHidden() const; + bool isNoDisplay() const; + ++ QProcessEnvironment additionalEnv() const; ++ + void setTo(Type type, const QString &name); + + Session &operator=(const Session &other); + + private: ++ QProcessEnvironment parseEnv(const QString &list); + bool m_valid; + Type m_type; + QDir m_dir; +@@ -75,6 +79,7 @@ namespace SDDM { + QString m_tryExec; + QString m_xdgSessionType; + QString m_desktopNames; ++ QProcessEnvironment m_additionalEnv; + bool m_isHidden; + bool m_isNoDisplay; + +diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp +index 9f1fabc68..a65df3f0b 100644 +--- a/src/daemon/Display.cpp ++++ b/src/daemon/Display.cpp +@@ -313,6 +313,7 @@ namespace SDDM { + qDebug() << "Session" << m_sessionName << "selected, command:" << session.exec(); + + QProcessEnvironment env; ++ env.insert(session.additionalEnv()); + + if (seat()->name() == QLatin1String("seat0")) { + // Use the greeter VT, for wayland sessions the helper overwrites this diff --git a/user/sddm/utmpx.patch b/user/sddm/utmpx.patch index 1edd72d7d..4402fd861 100644 --- a/user/sddm/utmpx.patch +++ b/user/sddm/utmpx.patch @@ -1,10 +1,12 @@ ---- sddm-0.18.0/src/helper/HelperApp.cpp.old 2018-07-18 10:31:40.000000000 +0000 -+++ sddm-0.18.0/src/helper/HelperApp.cpp 2018-07-25 23:11:09.840000000 +0000 -@@ -35,7 +35,6 @@ +--- sddm-0.19.0/src/helper/HelperApp.cpp.old 2020-11-03 03:47:51.000000000 -0600 ++++ sddm-0.19.0/src/helper/HelperApp.cpp 2022-08-19 21:59:19.977071884 -0500 +@@ -36,9 +36,6 @@ #include <sys/socket.h> #include <sys/time.h> +-#if defined(Q_OS_LINUX) -#include <utmp.h> +-#endif #include <utmpx.h> #include <QByteArray> diff --git a/user/sddm/xephyr.patch b/user/sddm/xephyr.patch new file mode 100644 index 000000000..142520ad4 --- /dev/null +++ b/user/sddm/xephyr.patch @@ -0,0 +1,171 @@ +From 68cc9e31d1a4c4609f42114782fc485cb07353a4 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt <fabian@ritter-vogt.de> +Date: Fri, 9 Oct 2020 21:06:01 +0200 +Subject: [PATCH] Merge normal and testing paths in XorgDisplayServer::start + +They have much in common and this means that Xephyr can also make use use +of -displayfd now. +--- + src/daemon/XorgDisplayServer.cpp | 132 ++++++++++++++----------------- + 1 file changed, 60 insertions(+), 72 deletions(-) + +diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp +index d5f29a94a..e60c02210 100644 +--- a/src/daemon/XorgDisplayServer.cpp ++++ b/src/daemon/XorgDisplayServer.cpp +@@ -136,95 +136,83 @@ namespace SDDM { + return false; + } + +- if (daemonApp->testing()) { +- QStringList args; +- QDir x11socketDir(QStringLiteral("/tmp/.X11-unix")); +- int display = 100; +- while (x11socketDir.exists(QStringLiteral("X%1").arg(display))) { +- ++display; +- } +- m_display = QStringLiteral(":%1").arg(display); +- args << m_display << QStringLiteral("-auth") << m_authPath << QStringLiteral("-br") << QStringLiteral("-noreset") << QStringLiteral("-screen") << QStringLiteral("800x600"); +- process->start(mainConfig.X11.XephyrPath.get(), args); +- +- +- // wait for display server to start +- if (!process->waitForStarted()) { +- // log message +- qCritical() << "Failed to start display server process."; ++ // set process environment ++ QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); ++ env.insert(QStringLiteral("XCURSOR_THEME"), mainConfig.Theme.CursorTheme.get()); ++ process->setProcessEnvironment(env); + +- // return fail +- return false; +- } +- emit started(); +- } else { +- // set process environment +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert(QStringLiteral("XCURSOR_THEME"), mainConfig.Theme.CursorTheme.get()); +- process->setProcessEnvironment(env); +- +- //create pipe for communicating with X server +- //0 == read from X, 1== write to from X +- int pipeFds[2]; +- if (pipe(pipeFds) != 0) { +- qCritical("Could not create pipe to start X server"); +- } ++ //create pipe for communicating with X server ++ //0 == read from X, 1== write to from X ++ int pipeFds[2]; ++ if (pipe(pipeFds) != 0) { ++ qCritical("Could not create pipe to start X server"); ++ } + +- // start display server +- QStringList args = mainConfig.X11.ServerArguments.get().split(QLatin1Char(' '), QString::SkipEmptyParts); +- args << QStringLiteral("-auth") << m_authPath ++ // start display server ++ QStringList args; ++ if (!daemonApp->testing()) { ++ process->setProgram(mainConfig.X11.ServerPath.get()); ++ args << mainConfig.X11.ServerArguments.get().split(QLatin1Char(' '), QString::SkipEmptyParts) + << QStringLiteral("-background") << QStringLiteral("none") +- << QStringLiteral("-noreset") +- << QStringLiteral("-displayfd") << QString::number(pipeFds[1]) + << QStringLiteral("-seat") << displayPtr()->seat()->name(); + + if (displayPtr()->seat()->name() == QLatin1String("seat0")) { + args << QStringLiteral("vt%1").arg(displayPtr()->terminalId()); + } +- qDebug() << "Running:" +- << qPrintable(mainConfig.X11.ServerPath.get()) +- << qPrintable(args.join(QLatin1Char(' '))); +- process->start(mainConfig.X11.ServerPath.get(), args); +- +- // wait for display server to start +- if (!process->waitForStarted()) { +- // log message +- qCritical() << "Failed to start display server process."; +- +- // return fail +- close(pipeFds[0]); +- return false; +- } ++ } else { ++ process->setProgram(mainConfig.X11.XephyrPath.get()); ++ args << QStringLiteral("-br") ++ << QStringLiteral("-screen") << QStringLiteral("800x600"); ++ } + +- // close the other side of pipe in our process, otherwise reading +- // from it may stuck even X server exit. +- close(pipeFds[1]); ++ args << QStringLiteral("-auth") << m_authPath ++ << QStringLiteral("-noreset") ++ << QStringLiteral("-displayfd") << QString::number(pipeFds[1]); + +- QFile readPipe; ++ process->setArguments(args); ++ qDebug() << "Running:" ++ << qPrintable(process->program()) ++ << qPrintable(process->arguments().join(QLatin1Char(' '))); ++ process->start(); + +- if (!readPipe.open(pipeFds[0], QIODevice::ReadOnly)) { +- qCritical("Failed to open pipe to start X Server"); ++ // wait for display server to start ++ if (!process->waitForStarted()) { ++ // log message ++ qCritical() << "Failed to start display server process."; + +- close(pipeFds[0]); +- return false; +- } +- QByteArray displayNumber = readPipe.readLine(); +- if (displayNumber.size() < 2) { +- // X server gave nothing (or a whitespace). +- qCritical("Failed to read display number from pipe"); ++ // return fail ++ close(pipeFds[0]); ++ return false; ++ } + +- close(pipeFds[0]); +- return false; +- } +- displayNumber.prepend(QByteArray(":")); +- displayNumber.remove(displayNumber.size() -1, 1); // trim trailing whitespace +- m_display = QString::fromLocal8Bit(displayNumber); ++ // close the other side of pipe in our process, otherwise reading ++ // from it may stuck even X server exit. ++ close(pipeFds[1]); ++ ++ QFile readPipe; ++ ++ if (!readPipe.open(pipeFds[0], QIODevice::ReadOnly)) { ++ qCritical("Failed to open pipe to start X Server"); + +- // close our pipe + close(pipeFds[0]); ++ return false; ++ } ++ QByteArray displayNumber = readPipe.readLine(); ++ if (displayNumber.size() < 2) { ++ // X server gave nothing (or a whitespace). ++ qCritical("Failed to read display number from pipe"); + +- emit started(); ++ close(pipeFds[0]); ++ return false; + } ++ displayNumber.prepend(QByteArray(":")); ++ displayNumber.remove(displayNumber.size() -1, 1); // trim trailing whitespace ++ m_display = QString::fromLocal8Bit(displayNumber); ++ ++ // close our pipe ++ close(pipeFds[0]); ++ ++ emit started(); + + // The file is also used by the greeter, which does care about the + // display number. Write the proper entry, if it's different. |