|
11 | 11 | #include <QProcessEnvironment> |
12 | 12 | #include <QRandomGenerator> |
13 | 13 |
|
14 | | -#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0) |
15 | | -# include <private/qdesktopunixservices_p.h> |
16 | | -# include <private/qguiapplication_p.h> |
17 | | -# include <qpa/qplatformintegration.h> |
18 | | -#elif QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) |
19 | | -# include <private/qgenericunixservices_p.h> |
20 | | -# include <private/qguiapplication_p.h> |
21 | | -# include <qpa/qplatformintegration.h> |
22 | | -#else |
23 | | -# include <QGuiApplication> |
24 | | -# include <QWindow> |
25 | | -#endif |
| 14 | +#include <private/qdesktopunixservices_p.h> |
| 15 | +#include <private/qguiapplication_p.h> |
| 16 | +#include <qpa/qplatformintegration.h> |
26 | 17 |
|
27 | 18 | #include "dbustypes.h" |
28 | 19 | #include "leakdetector.h" |
@@ -116,24 +107,12 @@ QString XdgPortal::parentWindow() { |
116 | 107 | if (!holder->hasWindow()) { |
117 | 108 | return QString(""); |
118 | 109 | } |
119 | | -#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0) |
| 110 | + |
120 | 111 | QDesktopUnixServices* services = dynamic_cast<QDesktopUnixServices*>( |
121 | 112 | QGuiApplicationPrivate::platformIntegration()->services()); |
122 | 113 | if (services != nullptr) { |
123 | 114 | return services->portalWindowIdentifier(holder->window()); |
124 | 115 | } |
125 | | -#elif QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) |
126 | | - QGenericUnixServices* services = dynamic_cast<QGenericUnixServices*>( |
127 | | - QGuiApplicationPrivate::platformIntegration()->services()); |
128 | | - if (services != nullptr) { |
129 | | - return services->portalWindowIdentifier(holder->window()); |
130 | | - } |
131 | | -#else |
132 | | - // X11 is the only platform that we can get a window handle on prior to 6.5.0 |
133 | | - if (QGuiApplication::platformName() == "xcb") { |
134 | | - return "x11:" + QString::number(holder->window()->winId(), 16); |
135 | | - } |
136 | | -#endif |
137 | 116 |
|
138 | 117 | // Otherwise, we don't support this windowing system. |
139 | 118 | return QString(""); |
@@ -251,14 +230,14 @@ void XdgPortal::setupAppScope(const QString& appId) { |
251 | 230 | // Qt 6.8 introduced a bug where using QDBusConnection::sessionBus() before |
252 | 231 | // QCoreApplication is created will silently break D-Bus signal connections. |
253 | 232 | // To workaround this, spin up a separate, standalone bus for these steps. |
254 | | -#if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)) && \ |
255 | | - (QT_VERSION < QT_VERSION_CHECK(6, 9, 2)) |
| 233 | +#if QT_VERSION < QT_VERSION_CHECK(6, 9, 2) |
256 | 234 | QString busName = QString("%1-appid-scope-helper").arg(appId); |
257 | 235 | QDBusConnection bus = |
258 | 236 | QDBusConnection::connectToBus(QDBusConnection::SessionBus, busName); |
259 | 237 | auto guard = |
260 | 238 | qScopeGuard([busName]() { QDBusConnection::disconnectFromBus(busName); }); |
261 | 239 | #else |
| 240 | + |
262 | 241 | // If the XDG Registry portal exists, use it to advertise our application ID. |
263 | 242 | // This is the right tool to use, but it's also very new. |
264 | 243 | QDBusInterface xdgRegistry(XDG_PORTAL_SERVICE, XDG_PORTAL_PATH, |
|
0 commit comments