commit:     c6d2f39f1e75acd270d6213e7f52c0383647718e
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 24 20:41:18 2022 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Nov 24 21:05:00 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c6d2f39f

x11-misc/sddm: Backport several 0.19.0 and master branch fixes

- Nvidia VT switching glitch
- Crash w/ Qt 5.15.7 (KDE QtPatchCollection)
- Prevent duplicate (Wayland) session suffix

Alex (1):
      Prevent duplicate session name.

David Edmundson (1):
      Enable QSurfaceFormat::ResetNotification on new Qt

Harald Sitter (1):
      disable automatic portal launching

KDE-bug: https://bugs.kde.org/show_bug.cgi?id=458865

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/sddm-0.18.1-drop-wayland-suffix.patch    |  28 +++++
 .../sddm/files/sddm-0.18.1-fix-qt-5.15.7.patch     |  33 ++++++
 .../sddm-0.18.1-nvidia-glitches-vt-switch.patch    |  46 +++++++
 x11-misc/sddm/sddm-0.18.1-r7.ebuild                | 132 +++++++++++++++++++++
 4 files changed, 239 insertions(+)

diff --git a/x11-misc/sddm/files/sddm-0.18.1-drop-wayland-suffix.patch 
b/x11-misc/sddm/files/sddm-0.18.1-drop-wayland-suffix.patch
new file mode 100644
index 000000000000..70efa284803f
--- /dev/null
+++ b/x11-misc/sddm/files/sddm-0.18.1-drop-wayland-suffix.patch
@@ -0,0 +1,28 @@
+From 9a440ba5917ff93c6a78726380c6267d91c13f19 Mon Sep 17 00:00:00 2001
+From: Alex <[email protected]>
+Date: Mon, 30 Sep 2019 16:50:16 -0400
+Subject: [PATCH] Prevent duplicate session name.
+
+Several desktop sessions (e.g. KDE Plasma) already include the string " 
(Wayland)" in the session name. When this happens, the session name displayed 
to the user is "Plasma (Wayland) (Wayland)". This change makes it so that only 
"Plasma (Wayland)" will be displayed.
+
+(cherry picked from commit f9a0648ff3f841b68a07c139c3540b9e75bfd279)
+---
+ src/common/Session.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/common/Session.cpp b/src/common/Session.cpp
+index aa4dad3..923ecd4 100644
+--- a/src/common/Session.cpp
++++ b/src/common/Session.cpp
+@@ -169,7 +169,7 @@ namespace SDDM {
+ 
+             if (line.startsWith(QLatin1String("Name="))) {
+                 if (type == WaylandSession)
+-                    m_displayName = QObject::tr("%1 
(Wayland)").arg(line.mid(5));
++                    m_displayName = QObject::tr("%1").arg(line.mid(5));
+                 else
+                     m_displayName = line.mid(5);
+             }
+-- 
+2.38.1
+

diff --git a/x11-misc/sddm/files/sddm-0.18.1-fix-qt-5.15.7.patch 
b/x11-misc/sddm/files/sddm-0.18.1-fix-qt-5.15.7.patch
new file mode 100644
index 000000000000..65e9b8573356
--- /dev/null
+++ b/x11-misc/sddm/files/sddm-0.18.1-fix-qt-5.15.7.patch
@@ -0,0 +1,33 @@
+From 5fe712d0e73c6263647bf306f40fbac94a52f4a6 Mon Sep 17 00:00:00 2001
+From: Harald Sitter <[email protected]>
+Date: Mon, 24 Oct 2022 13:15:48 +0200
+Subject: disable automatic portal launching
+
+in Qt6 (and the KDE patch collection for Qt 5) genericunixservices will
+internally attempt to probe the portal tech early on in the app life
+cycle. this causes the protal system to launch app and then crash
+because we aren't actually providing a fully functional session. instead
+opt out of this altogether
+
+(cherry picked from commit fc24321541f6f65b7d1aac89cd82336ffd53e1a0)
+---
+ src/greeter/GreeterApp.cpp | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/greeter/GreeterApp.cpp b/src/greeter/GreeterApp.cpp
+index 4e117a7..a491f4d 100644
+--- a/src/greeter/GreeterApp.cpp
++++ b/src/greeter/GreeterApp.cpp
+@@ -318,6 +318,9 @@ int main(int argc, char **argv)
+         QSurfaceFormat::setDefaultFormat(format);
+     }
+ 
++    // Qt internally may load the xdg portal system early on, prevent this, 
we do not have a functional session running.
++    qputenv("QT_NO_XDG_DESKTOP_PORTAL", "1");
++
+     QGuiApplication app(argc, argv);
+ 
+     QCommandLineParser parser;
+-- 
+2.38.1
+

diff --git a/x11-misc/sddm/files/sddm-0.18.1-nvidia-glitches-vt-switch.patch 
b/x11-misc/sddm/files/sddm-0.18.1-nvidia-glitches-vt-switch.patch
new file mode 100644
index 000000000000..ab2fc18cbcbf
--- /dev/null
+++ b/x11-misc/sddm/files/sddm-0.18.1-nvidia-glitches-vt-switch.patch
@@ -0,0 +1,46 @@
+From 76c11653522453efcf86f6f2f53bca1a497ea350 Mon Sep 17 00:00:00 2001
+From: David Edmundson <[email protected]>
+Date: Thu, 28 Mar 2019 11:43:37 +0000
+Subject: Enable QSurfaceFormat::ResetNotification on new Qt
+
+This fixes graphical glitches on nvidia after VT switching.
+
+It's opt-in as it requires code paths to handle glGetError differently.
+The version comparison is because my early implementations missed a code
+path. This was fixed in 5.12.2, but we may as well play safe
+
+(cherry picked from commit cd4e1fa21e1ab7178fa5d2ef858f3271575fd315)
+---
+ src/greeter/GreeterApp.cpp | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/greeter/GreeterApp.cpp b/src/greeter/GreeterApp.cpp
+index d47998e..4e117a7 100644
+--- a/src/greeter/GreeterApp.cpp
++++ b/src/greeter/GreeterApp.cpp
+@@ -40,6 +40,9 @@
+ #include <QDebug>
+ #include <QTimer>
+ #include <QTranslator>
++#include <QLibraryInfo>
++#include <QVersionNumber>
++#include <QSurfaceFormat>
+ 
+ #include <iostream>
+ 
+@@ -309,6 +312,12 @@ int main(int argc, char **argv)
+         qDebug() << "High-DPI autoscaling not Enabled";
+     }
+ 
++    if (QLibraryInfo::version() >= QVersionNumber(5, 13, 0)) {
++        auto format(QSurfaceFormat::defaultFormat());
++        format.setOption(QSurfaceFormat::ResetNotification);
++        QSurfaceFormat::setDefaultFormat(format);
++    }
++
+     QGuiApplication app(argc, argv);
+ 
+     QCommandLineParser parser;
+-- 
+2.38.1
+

diff --git a/x11-misc/sddm/sddm-0.18.1-r7.ebuild 
b/x11-misc/sddm/sddm-0.18.1-r7.ebuild
new file mode 100644
index 000000000000..a7e8f1c35a3e
--- /dev/null
+++ b/x11-misc/sddm/sddm-0.18.1-r7.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake linux-info systemd tmpfiles
+
+DESCRIPTION="Simple Desktop Display Manager"
+HOMEPAGE="https://github.com/sddm/sddm";
+SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}.tar.xz";
+
+LICENSE="GPL-2+ MIT CC-BY-3.0 CC-BY-SA-3.0 public-domain"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
+IUSE="+elogind +pam systemd test"
+
+REQUIRED_USE="?? ( elogind systemd )"
+RESTRICT="!test? ( test )"
+
+COMMON_DEPEND="
+       acct-group/sddm
+       acct-user/sddm
+       dev-qt/qtcore:5
+       dev-qt/qtdbus:5
+       dev-qt/qtdeclarative:5
+       dev-qt/qtgui:5
+       dev-qt/qtnetwork:5
+       x11-base/xorg-server
+       x11-libs/libxcb[xkb]
+       elogind? ( sys-auth/elogind )
+       pam? ( sys-libs/pam )
+       !pam? ( virtual/libcrypt:= )
+       systemd? ( sys-apps/systemd:= )
+       !systemd? ( sys-power/upower )
+"
+DEPEND="${COMMON_DEPEND}
+       test? ( dev-qt/qttest:5 )
+"
+RDEPEND="${COMMON_DEPEND}
+       !systemd? ( gui-libs/display-manager-init )
+"
+BDEPEND="
+       dev-python/docutils
+       dev-qt/linguist-tools:5
+       kde-frameworks/extra-cmake-modules:5
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}-respect-user-flags.patch"
+       "${FILESDIR}/${P}-Xsession.patch" # bug 611210
+       "${FILESDIR}/${PN}-0.18.0-sddmconfdir.patch"
+       # fix for groups: https://github.com/sddm/sddm/issues/1159
+       "${FILESDIR}/${P}-revert-honor-PAM-supplemental-groups.patch"
+       "${FILESDIR}/${P}-honor-PAM-supplemental-groups-v2.patch"
+       # fix for ReuseSession=true
+       "${FILESDIR}/${P}-only-reuse-online-sessions.patch"
+       # TODO: fix properly
+       "${FILESDIR}/pam-1.4-substack.patch"
+       # upstream git develop branch:
+       "${FILESDIR}/${P}-qt-5.15.2.patch"
+       "${FILESDIR}/${P}-cve-2020-28049.patch" # bug 753104
+       "${FILESDIR}/${P}-nvidia-glitches-vt-switch.patch"
+       "${FILESDIR}/${P}-drop-wayland-suffix.patch"
+       "${FILESDIR}/${P}-fix-qt-5.15.7.patch" # KDE-bug 458865
+)
+
+pkg_setup() {
+       local CONFIG_CHECK="~DRM"
+       use kernel_linux && linux-info_pkg_setup
+}
+
+src_prepare() {
+       cmake_src_prepare
+
+       if ! use test; then
+               sed -e "/^find_package/s/ Test//" -i CMakeLists.txt || die
+               cmake_comment_add_subdirectory test
+       fi
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DENABLE_PAM=$(usex pam)
+               -DNO_SYSTEMD=$(usex '!systemd')
+               -DUSE_ELOGIND=$(usex 'elogind')
+               -DBUILD_MAN_PAGES=ON
+               -DDBUS_CONFIG_FILENAME="org.freedesktop.sddm.conf"
+       )
+       cmake_src_configure
+}
+
+src_install() {
+       cmake_src_install
+
+       newtmpfiles "${FILESDIR}/${PN}.tmpfiles" "${PN}.conf"
+
+       # Create a default.conf as upstream dropped /etc/sddm.conf w/o 
replacement
+       local confd="/usr/share/sddm/sddm.conf.d"
+       dodir ${confd}
+       "${D}"/usr/bin/sddm --example-config > "${D}/${confd}"/00default.conf \
+               || die "Failed to create 00default.conf"
+
+       sed -e "/^InputMethod/s/qtvirtualkeyboard//" \
+               -e "/^ReuseSession/s/false/true/" \
+               -e "/^EnableHiDPI/s/false/true/" \
+               -i "${D}/${confd}"/00default.conf || die
+}
+
+pkg_postinst() {
+       tmpfiles_process "${PN}.conf"
+
+       elog "Starting with 0.18.0, SDDM no longer installs /etc/sddm.conf"
+       elog "Use it to override specific options. SDDM defaults are now"
+       elog "found in: /usr/share/sddm/sddm.conf.d/00default.conf"
+       elog
+       elog "NOTE: If SDDM startup appears to hang then entropy pool is too 
low."
+       elog "This can be fixed by configuring one of the following:"
+       elog "  - Enable CONFIG_RANDOM_TRUST_CPU in linux kernel"
+       elog "  - # emerge sys-apps/haveged && rc-update add haveged boot"
+       elog "  - # emerge sys-apps/rng-tools && rc-update add rngd boot"
+       elog
+       elog "For more information on how to configure SDDM, please visit the 
wiki:"
+       elog "  https://wiki.gentoo.org/wiki/SDDM";
+       if has_version x11-drivers/nvidia-drivers; then
+               elog
+               elog "  Nvidia GPU owners in particular should pay attention"
+               elog "  to the troubleshooting section."
+       fi
+
+       systemd_reenable sddm.service
+}

Reply via email to