check D-Bus tray availability every time
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Mon, 24 Mar 2025 12:42:48 +0000 (15:42 +0300)
committerDmitry Shachnev <mitya57@debian.org>
Mon, 24 Mar 2025 12:42:48 +0000 (15:42 +0300)
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

src/platformsupport/themes/genericunix/qgenericunixthemes.cpp

index 5dbbcc5ef453b045144d660f708bd02acdd30c1f..5f376b3d35d50bbbacb9843cd70c5236738547ba 100644 (file)
@@ -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