File: check_dbus_tray_availability_every_time.diff

package info (click to toggle)
qtbase-opensource-src-gles 5.15.17%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 349,996 kB
  • sloc: cpp: 2,097,620; ansic: 343,242; xml: 115,491; python: 9,447; java: 7,499; asm: 4,023; sh: 2,086; perl: 2,047; yacc: 1,687; lex: 1,333; javascript: 878; makefile: 260; objc: 70
file content (28 lines) | stat: -rw-r--r-- 1,260 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Description: 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.
Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3c93dedc063bf453
Last-Update: 2024-07-24

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