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 <mitya57@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
a98715c127
commit
3c93dedc06
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user