nix-stuff/roles/kde/patches/kwin/pr8155.patch

60 lines
2.8 KiB
Diff

From bab7c4a4c5e2fb7be83ba94fdd0da7fd196654fa Mon Sep 17 00:00:00 2001
From: David Redondo <kde@david-redondo.de>
Date: Thu, 25 Sep 2025 12:00:51 +0200
Subject: [PATCH] Make sure XdgToplevelWindow always has an icon
If the client never called set_app_id and did not set a custom
icon the window would end up without an icon at all. This ensures
that all windows always have at least the default icon.
---
autotests/integration/xdgshellwindow_test.cpp | 13 +++++++++++--
src/xdgshellwindow.cpp | 1 +
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/autotests/integration/xdgshellwindow_test.cpp b/autotests/integration/xdgshellwindow_test.cpp
index 0903043808d..a3658ee62e7 100644
--- a/autotests/integration/xdgshellwindow_test.cpp
+++ b/autotests/integration/xdgshellwindow_test.cpp
@@ -683,16 +683,25 @@ void TestXdgShellWindow::testDesktopFileName()
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
// only xdg-shell as ShellSurface misses the setter
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
- shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
+
+ // A client that never call set_app_id still gets the default icon
+ QCOMPARE(window->desktopFileName(), QString());
+ QVERIFY(window->resourceClass().startsWith("testXdgShellWindow"));
+ QVERIFY(window->resourceName().startsWith("testXdgShellWindow"));
+ QCOMPARE(window->icon().name(), QStringLiteral("wayland"));
+
+ QSignalSpy desktopFileNameChangedSpy(window, &Window::desktopFileNameChanged);
+
+ shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
+ QVERIFY(desktopFileNameChangedSpy.wait());
QCOMPARE(window->desktopFileName(), QStringLiteral("org.kde.foo"));
QCOMPARE(window->resourceClass(), QStringLiteral("org.kde.foo"));
QVERIFY(window->resourceName().startsWith("testXdgShellWindow"));
// the desktop file does not exist, so icon should be generic Wayland
QCOMPARE(window->icon().name(), QStringLiteral("wayland"));
- QSignalSpy desktopFileNameChangedSpy(window, &Window::desktopFileNameChanged);
QSignalSpy iconChangedSpy(window, &Window::iconChanged);
shellSurface->set_app_id(QStringLiteral("org.kde.bar"));
QVERIFY(desktopFileNameChangedSpy.wait());
diff --git a/src/xdgshellwindow.cpp b/src/xdgshellwindow.cpp
index f585d3aef95..092c284b8c2 100644
--- a/src/xdgshellwindow.cpp
+++ b/src/xdgshellwindow.cpp
@@ -1426,6 +1426,7 @@ void XdgToplevelWindow::initialize()
scheduleConfigure();
updateColorScheme();
updateCapabilities();
+ updateIcon();
setupWindowManagementInterface();
m_isInitialized = true;
--
GitLab