summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Fedin <[email protected]>2024-04-28 12:35:39 +0400
committerIlya Fedin <[email protected]>2024-06-01 21:50:20 +0400
commit3c93dedc063bf453bcda581b4e9ccab5a810c80f (patch)
treefd93bbfbb899a1b054507bc3e7f22e5cd2dae352
parenta98715c127fb569c21a0402d3c0e76ca0bb75c0d (diff)
Check D-Bus tray availability every time
It could appear in runtime, this allows applications to watch for it themselves and re-create QSystemTrayIcon as needed. Task-number: QTBUG-94871 Pick-to: 6.7 6.5 Change-Id: I10678cca4238ec0212c69155c9f22c07755ab1a8 Reviewed-by: Dmitry Shachnev <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]>
-rw-r--r--src/gui/platform/unix/qgenericunixthemes.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/gui/platform/unix/qgenericunixthemes.cpp b/src/gui/platform/unix/qgenericunixthemes.cpp
index 53142d81968..8a7f7cd6f7a 100644
--- a/src/gui/platform/unix/qgenericunixthemes.cpp
+++ b/src/gui/platform/unix/qgenericunixthemes.cpp
@@ -81,15 +81,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() != "xcb"_L1;
- 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() != "xcb"_L1)
+ return true;
+ const bool result = QDBusMenuConnection().isWatcherRegistered();
+ qCDebug(qLcTray) << "D-Bus tray available:" << result;
return result;
}
#endif