kde-plasma/plasma-workspace: Backport upstream recommended fix

...plus another one.

See also:
https://mail.kde.org/pipermail/distributions/2025-April/001571.html

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

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
This commit is contained in:
Andreas Sturmlechner
2025-04-04 09:41:30 +02:00
parent 12ee4650e5
commit 0720df53e8
3 changed files with 383 additions and 0 deletions

View File

@@ -0,0 +1,123 @@
From 580a2ed1f41640e14adf57c5c7921cdadbdbe14d Mon Sep 17 00:00:00 2001
From: Marco Martin <notmart@gmail.com>
Date: Wed, 2 Apr 2025 08:28:05 +0000
Subject: [PATCH] multiscreen: fix an incorrect assert in screenInvariants
Since OutputOrderWatcher at the time of screen removing can temporarly contain a dead entry, we can't check on screenInvariants that the count is the same as the real screen count, but check instead that outputorderwatcher doesn't have missing entries instead
BUG:494616
(cherry picked from commit 285cfe150efd941eed62b06604db0709977540c9)
Co-authored-by: Marco Martin <notmart@gmail.com>
---
shell/autotests/screenpooltest.cpp | 60 ++++++++++++++++++++++++++++++
shell/screenpool.cpp | 6 ++-
2 files changed, 65 insertions(+), 1 deletion(-)
diff --git a/shell/autotests/screenpooltest.cpp b/shell/autotests/screenpooltest.cpp
index bbb984a8738..033844e6195 100644
--- a/shell/autotests/screenpooltest.cpp
+++ b/shell/autotests/screenpooltest.cpp
@@ -41,6 +41,7 @@ private Q_SLOTS:
void testLastScreenRemoval();
void testFakeToRealScreen();
void testFakeOutputInitially();
+ void testReorderRemoveRace();
private:
ScreenPool *m_screenPool;
@@ -459,6 +460,65 @@ void ScreenPoolTest::testFakeOutputInitially()
QCOMPARE(screenPool.idForScreen(newScreen), 0);
}
+void ScreenPoolTest::testReorderRemoveRace()
+{
+ QSignalSpy addedSpy(qGuiApp, SIGNAL(screenAdded(QScreen *)));
+ QSignalSpy orderChangeSpy(m_screenPool, &ScreenPool::screenOrderChanged);
+ QSignalSpy firstScreenResizedSpy(qGuiApp->screens()[0], &QScreen::geometryChanged);
+
+ // Add a new output
+ exec([this] {
+ OutputData data;
+ data.mode.resolution = {1920, 1080};
+ data.position = {1920, 0};
+ data.physicalSize = data.mode.physicalSizeForDpi(96);
+ // NOTE: assumes that when a screen is added it will already have the final geometry
+ auto *out = add<Output>(data);
+ auto *xdgOut = xdgOutput(out);
+ xdgOut->m_name = QStringLiteral("WL-2");
+ outputOrder()->setList({u"WL-1"_s, u"WL-2"_s});
+ });
+
+ QVERIFY(orderChangeSpy.wait());
+
+ QCOMPARE(orderChangeSpy.size(), 1);
+ QCOMPARE(QGuiApplication::screens().size(), 2);
+ QCOMPARE(m_screenPool->screenOrder().size(), 2);
+ QCOMPARE(addedSpy.size(), 1);
+
+ QScreen *newScreen = addedSpy.takeFirst().at(0).value<QScreen *>();
+ QCOMPARE(newScreen->name(), QStringLiteral("WL-2"));
+ QCOMPARE(newScreen->geometry(), QRect(1920, 0, 1920, 1080));
+ // Check mapping
+ QCOMPARE(m_screenPool->idForScreen(newScreen), 1);
+ QCOMPARE(m_screenPool->screenForId(1)->name(), QStringLiteral("WL-2"));
+
+ exec([this] {
+ // BUG 494616:
+ // When there are those 3 things happening in quick order
+ // * Setting the order
+ // * resizing an output
+ // * removing another output
+ // we used to get an inconsistent state in OutputOrderWatcher
+ // where the removed output is *not* removed from outputOrder
+ outputOrder()->setList({u"WL-2"_s, u"WL-1"_s});
+ auto *out = output(0);
+ auto *xdgOut = xdgOutput(output(0));
+ xdgOut->sendLogicalSize(QSize(1024, 600));
+ remove(output(1));
+ out->m_data.physicalSize = QSize(1024, 600);
+ out->sendGeometry();
+ out->sendDone();
+ });
+
+ QVERIFY(orderChangeSpy.wait());
+ QTRY_COMPARE(firstScreenResizedSpy.size(), 1);
+ QCOMPARE(m_screenPool->screenOrder().size(), 1);
+ QCOMPARE(m_screenPool->screenOrder().first()->name(), QStringLiteral("WL-1"));
+ QCOMPARE(qApp->screens().size(), 1);
+ QCOMPARE(qApp->screens().first()->geometry(), QRect(0, 0, 1024, 600));
+}
+
QCOMPOSITOR_TEST_MAIN(ScreenPoolTest)
#include "screenpooltest.moc"
diff --git a/shell/screenpool.cpp b/shell/screenpool.cpp
index 8d9c92b0d80..3c33dab8e9d 100644
--- a/shell/screenpool.cpp
+++ b/shell/screenpool.cpp
@@ -282,6 +282,7 @@ void ScreenPool::handleScreenRemoved(QScreen *screen)
void ScreenPool::handleOutputOrderChanged(const QStringList &newOrder)
{
qCDebug(SCREENPOOL) << "handleOutputOrderChanged" << newOrder;
+
QHash<QString, QScreen *> connMap;
for (auto s : qApp->screens()) {
connMap[s->name()] = s;
@@ -369,7 +370,10 @@ void ScreenPool::screenInvariants()
// QScreen bookeeping integrity
auto allScreens = qGuiApp->screens();
// Do we actually track every screen?
- Q_ASSERT_X((m_availableScreens.count() + m_redundantScreens.count()) == m_outputOrderWatcher->outputOrder().count(),
+ // (m_availableScreens.count() + m_redundantScreens.count() must be less or equal
+ // to the number of screens tracked by OutputOrderWatcher, because it can contain
+ // for a little while a screen that has just been removed
+ Q_ASSERT_X((m_availableScreens.count() + m_redundantScreens.count()) <= m_outputOrderWatcher->outputOrder().count(),
Q_FUNC_INFO,
qUtf8Printable(debugMessage())); // https://crash-reports.kde.org/organizations/kde/issues/5249/
Q_ASSERT_X(allScreens.count() == m_sizeSortedScreens.count(),
--
GitLab

View File

@@ -0,0 +1,41 @@
From 47d502353720004fa2d0e7b0065994b75b3e0ded Mon Sep 17 00:00:00 2001
From: Nate Graham <nate@kde.org>
Date: Wed, 2 Apr 2025 20:57:09 +0000
Subject: [PATCH] applets/notifications: improve paddings again
Zero top padding is fine when there's only a summary label, but looks
bad when there's body text, an icon, or both. Correct that.
(cherry picked from commit 53b6289f84094d91745b79c3bc902e7f80f235ef)
Co-authored-by: Nate Graham <nate@kde.org>
---
.../package/contents/ui/delegates/DelegatePopup.qml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/applets/notifications/package/contents/ui/delegates/DelegatePopup.qml b/applets/notifications/package/contents/ui/delegates/DelegatePopup.qml
index 2038f49de50..e22a8322196 100644
--- a/applets/notifications/package/contents/ui/delegates/DelegatePopup.qml
+++ b/applets/notifications/package/contents/ui/delegates/DelegatePopup.qml
@@ -93,6 +93,8 @@ BaseDelegate {
Components.Summary {
id: summary
+ // Base layout intentionally has no row spacing, so add top padding here when needed
+ Layout.topMargin: delegateRoot.hasBodyText || icon.visible ? Kirigami.Units.smallSpacing : 0
Layout.fillWidth: true
Layout.row: 2
Layout.column: delegateRoot.__firstColumn
@@ -108,7 +110,7 @@ BaseDelegate {
Components.Icon {
id: icon
- // We removed the row spacing from the base layout, so re-add it just here
+ // Base layout intentionally has no row spacing, so add top padding here
Layout.topMargin: Kirigami.Units.smallSpacing
Layout.row: 2
Layout.column: delegateRoot.__firstColumn + 1
--
GitLab

View File

@@ -0,0 +1,219 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
ECM_HANDBOOK="optional"
ECM_TEST="forceoptional"
KFMIN=6.10.0
QTMIN=6.8.1
inherit ecm plasma.kde.org xdg
DESCRIPTION="KDE Plasma workspace"
LICENSE="GPL-2" # TODO: CHECK
SLOT="6"
KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~x86"
IUSE="appstream +calendar +fontconfig networkmanager +policykit screencast
+semantic-desktop systemd telemetry +wallpaper-metadata"
RESTRICT="test"
# kde-frameworks/kwindowsystem[X]: Uses KX11Extras
# slot op: Uses Qt::GuiPrivate for qtx11extras_p.h
# slot op: various private QtWaylandClient headers
COMMON_DEPEND="
dev-libs/icu:=
>=dev-libs/wayland-1.15
>=dev-qt/qt5compat-${QTMIN}:6[qml]
>=dev-qt/qtbase-${QTMIN}:6=[dbus,gui,libinput,network,opengl,sql,sqlite,widgets,xml]
>=dev-qt/qtdeclarative-${QTMIN}:6[widgets]
>=dev-qt/qtpositioning-${QTMIN}:6
>=dev-qt/qtshadertools-${QTMIN}:6
>=dev-qt/qtsvg-${QTMIN}:6
>=dev-qt/qtwayland-${QTMIN}:6=
>=kde-frameworks/karchive-${KFMIN}:6
>=kde-frameworks/kauth-${KFMIN}:6
>=kde-frameworks/kbookmarks-${KFMIN}:6
>=kde-frameworks/kcmutils-${KFMIN}:6
>=kde-frameworks/kcolorscheme-${KFMIN}:6
>=kde-frameworks/kcompletion-${KFMIN}:6
>=kde-frameworks/kconfig-${KFMIN}:6
>=kde-frameworks/kconfigwidgets-${KFMIN}:6
>=kde-frameworks/kcoreaddons-${KFMIN}:6
>=kde-frameworks/kcrash-${KFMIN}:6
>=kde-frameworks/kdbusaddons-${KFMIN}:6
>=kde-frameworks/kdeclarative-${KFMIN}:6
>=kde-frameworks/kded-${KFMIN}:6
>=kde-frameworks/kglobalaccel-${KFMIN}:6
>=kde-frameworks/kguiaddons-${KFMIN}:6
>=kde-frameworks/ki18n-${KFMIN}:6
>=kde-frameworks/kiconthemes-${KFMIN}:6
>=kde-frameworks/kidletime-${KFMIN}:6
>=kde-frameworks/kio-${KFMIN}:6
>=kde-frameworks/kitemmodels-${KFMIN}:6
>=kde-frameworks/kitemviews-${KFMIN}:6
>=kde-frameworks/kjobwidgets-${KFMIN}:6
>=kde-frameworks/knewstuff-${KFMIN}:6
>=kde-frameworks/knotifications-${KFMIN}:6
>=kde-frameworks/knotifyconfig-${KFMIN}:6
>=kde-frameworks/kpackage-${KFMIN}:6
>=kde-frameworks/kparts-${KFMIN}:6
>=kde-frameworks/krunner-${KFMIN}:6
>=kde-frameworks/kservice-${KFMIN}:6
>=kde-frameworks/kstatusnotifieritem-${KFMIN}:6
>=kde-frameworks/ksvg-${KFMIN}:6
>=kde-frameworks/ktexteditor-${KFMIN}:6
>=kde-frameworks/ktextwidgets-${KFMIN}:6
>=kde-frameworks/kunitconversion-${KFMIN}:6
>=kde-frameworks/kwallet-${KFMIN}:6
>=kde-frameworks/kwidgetsaddons-${KFMIN}:6
>=kde-frameworks/kwindowsystem-${KFMIN}:6[X]
>=kde-frameworks/kxmlgui-${KFMIN}:6
>=kde-frameworks/prison-${KFMIN}:6[qml]
>=kde-frameworks/solid-${KFMIN}:6
>=kde-plasma/breeze-${KDE_CATV}:6
>=kde-plasma/kscreenlocker-${KDE_CATV}:6
>=kde-plasma/kwayland-${KDE_CATV}:6
>=kde-plasma/kwin-${KDE_CATV}:6
>=kde-plasma/layer-shell-qt-${KDE_CATV}:6
>=kde-plasma/libkscreen-${KDE_CATV}:6
>=kde-plasma/libksysguard-${KDE_CATV}:6
>=kde-plasma/libplasma-${KDE_CATV}:6
>=kde-plasma/plasma-activities-${KDE_CATV}:6
>=kde-plasma/plasma-activities-stats-${KDE_CATV}:6
>=kde-plasma/plasma5support-${KDE_CATV}:6
media-libs/libcanberra
>=media-libs/phonon-4.12.0[qt6(+)]
sci-libs/libqalculate:=
sys-apps/dbus
sys-libs/zlib
virtual/libudev:=
x11-libs/libICE
x11-libs/libSM
x11-libs/libX11
x11-libs/libXau
x11-libs/libxcb
x11-libs/libXcursor
x11-libs/libXfixes
x11-libs/libXrender
x11-libs/libXtst
x11-libs/xcb-util
appstream? ( >=dev-libs/appstream-1[qt6] )
calendar? ( >=kde-frameworks/kholidays-${KFMIN}:6 )
fontconfig? (
media-libs/fontconfig
x11-libs/libXft
x11-libs/xcb-util-image
)
policykit? ( virtual/libcrypt:= )
networkmanager? ( >=kde-frameworks/networkmanager-qt-${KFMIN}:6 )
semantic-desktop? ( >=kde-frameworks/baloo-${KFMIN}:6 )
systemd? ( sys-apps/systemd:= )
telemetry? ( >=kde-frameworks/kuserfeedback-${KFMIN}:6 )
wallpaper-metadata? ( kde-apps/libkexiv2:6 )
"
DEPEND="${COMMON_DEPEND}
>=dev-libs/plasma-wayland-protocols-1.16.0
dev-libs/qcoro
>=dev-qt/qtbase-${QTMIN}:6[concurrent]
x11-base/xorg-proto
fontconfig? ( x11-libs/libXrender )
test? ( screencast? ( >=media-video/pipewire-0.3:* ) )
"
RDEPEND="${COMMON_DEPEND}
!kde-plasma/libkworkspace:5
!<kde-plasma/plasma-desktop-5.27.0:5
!<kde-plasma/xdg-desktop-portal-kde-6.1.90
!kde-plasma/xembed-sni-proxy:*
app-text/iso-codes
dev-libs/kirigami-addons:6
>=dev-qt/qttools-${QTMIN}:*[qdbus]
kde-apps/kio-extras:6
>=kde-frameworks/kirigami-${KFMIN}:6
>=kde-frameworks/kquickcharts-${KFMIN}:6
>=kde-plasma/kactivitymanagerd-${KDE_CATV}:6
>=kde-plasma/kdesu-gui-${KDE_CATV}:*
>=kde-plasma/milou-${KDE_CATV}:6
>=kde-plasma/plasma-integration-${KDE_CATV}:6
>=kde-plasma/plasma-login-sessions-${KDE_CATV}:6
sys-apps/dbus
x11-apps/xmessage
x11-apps/xprop
x11-apps/xrdb
policykit? ( sys-apps/accountsservice )
screencast? ( >=media-video/pipewire-0.3:* )
"
BDEPEND="
>=dev-qt/qtwayland-${QTMIN}:6
>=dev-util/wayland-scanner-1.19.0
>=kde-frameworks/kcmutils-${KFMIN}:6
virtual/pkgconfig
test? ( >=dev-qt/qtwayland-${QTMIN}:6[compositor] )
"
PATCHES=(
"${FILESDIR}/${PN}-5.22.5-krunner-cwd-at-home.patch" # TODO upstream: KDE-bug 432975, bug 767478
# in Plasma/6.3 branch:
"${FILESDIR}/${P}-multiscreen-crash.patch" # KDE-bug 494616
"${FILESDIR}/${P}-notification-padding.patch"
)
src_prepare() {
ecm_src_prepare
cmake_comment_add_subdirectory login-sessions
if ! use policykit; then
cmake_run_in kcms cmake_comment_add_subdirectory users
fi
if ! use fontconfig; then
ecm_punt_bogus_dep XCB IMAGE
sed -e "s/check_X11_lib(Xft)/#&/" -i CMakeLists.txt || die
fi
# TODO: try to get a build switch upstreamed
if ! use systemd; then
sed -e "s/^pkg_check_modules.*SYSTEMD/#&/" -i CMakeLists.txt || die
fi
}
src_configure() {
local mycmakeargs=(
-DWITH_X11=ON # TODO: broken upstream, fix it if you can
-DCMAKE_DISABLE_FIND_PACKAGE_PackageKitQt6=ON # not packaged
-DGLIBC_LOCALE_GEN=OFF
-DGLIBC_LOCALE_PREGENERATED=$(usex elibc_glibc)
$(cmake_use_find_package appstream AppStreamQt)
$(cmake_use_find_package calendar KF6Holidays)
$(cmake_use_find_package fontconfig Fontconfig)
$(cmake_use_find_package networkmanager KF6NetworkManagerQt)
-DBUILD_CAMERAINDICATOR=$(usex screencast)
$(cmake_use_find_package semantic-desktop KF6Baloo)
$(cmake_use_find_package telemetry KF6UserFeedback)
$(cmake_use_find_package wallpaper-metadata KExiv2Qt6)
)
ecm_src_configure
}
src_install() {
ecm_src_install
# default startup and shutdown scripts
insinto /etc/xdg/plasma-workspace/env
doins "${FILESDIR}"/10-agent-startup.sh
insinto /etc/xdg/plasma-workspace/shutdown
doins "${FILESDIR}"/10-agent-shutdown.sh
fperms +x /etc/xdg/plasma-workspace/shutdown/10-agent-shutdown.sh
}
pkg_postinst () {
xdg_pkg_postinst
elog "To enable gpg-agent and/or ssh-agent in Plasma sessions,"
elog "edit ${EPREFIX}/etc/xdg/plasma-workspace/env/10-agent-startup.sh"
elog "and ${EPREFIX}/etc/xdg/plasma-workspace/shutdown/10-agent-shutdown.sh"
}