| 1 |
Descriptionscip-debian debian qtbase-opensource-src 5.15.19+dfsg-3 qtbase-opensource-src/patches/`dont_fallback_to_x11_tray_on_non_x11.diff`#Description.: don't fallback to X11 tray backend on non-X11 |
| 2 |
This allows to have system tray support on the fly on Wayland at least |
| 3 |
where only QDBusTrayIcon is possible and no need to fallback to |
| 4 |
QSystemTrayIconSys |
| 5 |
Originscip-debian debian qtbase-opensource-src 5.15.19+dfsg-3 qtbase-opensource-src/patches/`dont_fallback_to_x11_tray_on_non_x11.diff`#Origin.: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=f6cd286e6609cfbf |
| 6 |
Last-Updatescip-debian debian qtbase-opensource-src 5.15.19+dfsg-3 qtbase-opensource-src/patches/`dont_fallback_to_x11_tray_on_non_x11.diff`#Last-Update.: 2024-07-24 |
| 7 |
|
| 8 |
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cppscip-debian debian qtbase-opensource-src 5.15.19+dfsg-3 qtbase-opensource-src/upstream/`src/platformsupport/themes/genericunix/qgenericunixthemes.cpp`: |
| 9 |
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cppscip-debian debian qtbase-opensource-src 5.15.19+dfsg-3 qtbase-opensource-src/upstream/`src/platformsupport/themes/genericunix/qgenericunixthemes.cpp`: |
| 10 |
@@ -101,17 +101,19 @@ static const char defaultFixedFontNameC[ |
| 11 |
enum { defaultSystemFontSize = 9 }; |
| 12 |
|
| 13 |
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
+static bool shouldUseDBusTray() { |
| 19 |
+ // There's no other tray implementation to fallback to on non-X11 |
| 20 |
+ // and QDBusTrayIcon can register the icon on the fly after creation |
| 21 |
+ static bool result = QGuiApplication::platformName() != QLatin1String("xcb"); |
| 22 |
+ static bool resultKnown = result; |
| 23 |
+ if (!resultKnown) { |
| 24 |
QDBusMenuConnection conn; |
| 25 |
if (conn.isWatcherRegistered()) |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
+ result = true; |
| 30 |
+ resultKnown = true; |
| 31 |
+ qCDebug(qLcTray) << "D-Bus tray available:" << result; |
| 32 |
} |
| 33 |
|
| 34 |
+ return result; |
| 35 |
} |
| 36 |
#endif |
| 37 |
|
| 38 |
@@ -204,7 +206,7 @@ QPlatformMenuBar *QGenericUnixTheme::cre |
| 39 |
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) |
| 40 |
QPlatformSystemTrayIcon *QGenericUnixTheme::createPlatformSystemTrayIcon() const |
| 41 |
{ |
| 42 |
|
| 43 |
+ if (shouldUseDBusTray()) |
| 44 |
return new QDBusTrayIcon(); |
| 45 |
return nullptr; |
| 46 |
} |
| 47 |
@@ -683,7 +685,7 @@ QPlatformMenuBar *QKdeTheme::createPlatf |
| 48 |
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) |
| 49 |
QPlatformSystemTrayIcon *QKdeTheme::createPlatformSystemTrayIcon() const |
| 50 |
{ |
| 51 |
|
| 52 |
+ if (shouldUseDBusTray()) |
| 53 |
return new QDBusTrayIcon(); |
| 54 |
return nullptr; |
| 55 |
} |
| 56 |
@@ -803,7 +805,7 @@ QPlatformMenuBar *QGnomeTheme::createPla |
| 57 |
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) |
| 58 |
QPlatformSystemTrayIcon *QGnomeTheme::createPlatformSystemTrayIcon() const |
| 59 |
{ |
| 60 |
|
| 61 |
+ if (shouldUseDBusTray()) |
| 62 |
return new QDBusTrayIcon(); |
| 63 |
return nullptr; |
| 64 |
} |