From 6d2bfdb7107df1a9ff85164a95c05b3086479998 Mon Sep 17 00:00:00 2001 From: Debian Qt/KDE Maintainers Date: Sat, 8 Feb 2025 19:24:33 +0300 Subject: [PATCH] check D-Bus tray availability every time Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3c93dedc063bf453 Last-Update: 2024-07-24 It could appear in runtime, this allows applications to watch for it themselves and re-create QSystemTrayIcon as needed. Gbp-Pq: Name check_dbus_tray_availability_every_time.diff --- .../themes/genericunix/qgenericunixthemes.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index 5dbbcc5ef..5f376b3d3 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -104,15 +104,10 @@ enum { defaultSystemFontSize = 9 }; static bool shouldUseDBusTray() { // There's no other tray implementation to fallback to on non-X11 // and QDBusTrayIcon can register the icon on the fly after creation - static bool result = QGuiApplication::platformName() != QLatin1String("xcb"); - static bool resultKnown = result; - if (!resultKnown) { - QDBusMenuConnection conn; - if (conn.isWatcherRegistered()) - result = true; - resultKnown = true; - qCDebug(qLcTray) << "D-Bus tray available:" << result; - } + if (QGuiApplication::platformName() != QLatin1String("xcb")) + return true; + const bool result = QDBusMenuConnection().isWatcherRegistered(); + qCDebug(qLcTray) << "D-Bus tray available:" << result; return result; } #endif -- 2.30.2