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
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