From 0b2d73d725354def897d883fa164c263001c4693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 6 Mar 2014 15:01:36 +0100 Subject: 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 --- src/x11extras/qx11info_x11.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src') 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(reinterpret_cast(native->nativeResourceForIntegration(QByteArrayLiteral("rootwindow")))); } /*! -- cgit v1.2.3