diff options
author | Martin Gräßlin <mgraesslin@kde.org> | 2014-03-06 15:01:36 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-08 11:45:34 +0100 |
commit | 0b2d73d725354def897d883fa164c263001c4693 (patch) | |
tree | 0261b1468683f4dcda061a7972834b38fd07e05d /src/x11extras | |
parent | d229decb2d9d91e407d3fb97694684a4a774cc9b (diff) | |
download | qtx11extras-0b2d73d725354def897d883fa164c263001c4693.tar.gz |
Use nativeResourceForIntegration "rootWindow" to get the appRootWindow
As the native interface can provide the root window it's better to use
that instead of going through QDesktopWidget.
Change-Id: I0a7b475b5ef2a802f603b29762bf2d9033dfa13d
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/x11extras')
-rw-r--r-- | src/x11extras/qx11info_x11.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/x11extras/qx11info_x11.cpp b/src/x11extras/qx11info_x11.cpp index 8bea591..8295243 100644 --- a/src/x11extras/qx11info_x11.cpp +++ b/src/x11extras/qx11info_x11.cpp @@ -160,18 +160,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")))); } /*! |