diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/x11extras/qx11info_x11.cpp | 18 | ||||
-rw-r--r-- | src/x11extras/x11extras.pro | 2 |
2 files changed, 6 insertions, 14 deletions
diff --git a/src/x11extras/qx11info_x11.cpp b/src/x11extras/qx11info_x11.cpp index 8bea591..9e2cc3b 100644 --- a/src/x11extras/qx11info_x11.cpp +++ b/src/x11extras/qx11info_x11.cpp @@ -52,9 +52,8 @@ #include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformwindow.h> #include <qscreen.h> -#include <qdesktopwidget.h> #include <qwindow.h> -#include <qapplication.h> +#include <qguiapplication.h> #include <xcb/xcb.h> QT_BEGIN_NAMESPACE @@ -160,18 +159,11 @@ unsigned long QX11Info::appRootWindow(int screen) { if (!qApp) return 0; -#if 0 - // This looks like it should work, but gives the wrong value. - QDesktopWidget *desktop = QApplication::desktop(); - QWidget *screenWidget = desktop->screen(screen); - QWindow *window = screenWidget->windowHandle(); -#else Q_UNUSED(screen); - - QDesktopWidget *desktop = QApplication::desktop(); - QWindow *window = desktop->windowHandle(); -#endif - return window->winId(); + QPlatformNativeInterface *native = qApp->platformNativeInterface(); + if (!native) + return 0; + return static_cast<xcb_window_t>(reinterpret_cast<quintptr>(native->nativeResourceForIntegration(QByteArrayLiteral("rootwindow")))); } /*! diff --git a/src/x11extras/x11extras.pro b/src/x11extras/x11extras.pro index 80dc421..730a145 100644 --- a/src/x11extras/x11extras.pro +++ b/src/x11extras/x11extras.pro @@ -6,7 +6,7 @@ QMAKE_DOCS = $$PWD/doc/qtx11extras.qdocconf load(qt_module) -QT += widgets gui-private +QT += gui-private HEADERS += qx11info_x11.h SOURCES += qx11info_x11.cpp |