From: Debian Qt/KDE Maintainers Date: Thu, 25 Jul 2024 12:43:37 +0000 (+0300) Subject: check D-Bus tray availability every time X-Git-Tag: archive/raspbian/5.15.13+dfsg-4+rpi1^2~11 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2209597eadb04ecd264b34281a3d7db517cb0d76;p=qtbase-opensource-src.git 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 --- 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