diff options
author | Martin Gräßlin <mgraesslin@kde.org> | 2013-09-02 20:41:54 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-17 14:35:59 +0200 |
commit | 9c3b79200b4bb413a27e4341d7c201c1799e2ef0 (patch) | |
tree | 2d8e49567f75bc5570b59ce5770987666cd59276 /src/plugins/platforms/xcb/qxcbnativeinterface.cpp | |
parent | 75ffb131ed13183ef65a04e12d7506dedc0f1aaa (diff) |
Export x11 screen of the QXcbConnection to the native interface
With XCB a client cannot retrieve the information on which X screen it
is running. This information is only available when opening the xcb
connection. As this is done by Qt no application is able to retrieve
this information. By exporting the x11 screen we can provide this
information again in QtX11Extras.
Change-Id: I50f1d3e803dc7e3afac0e5c7f1648ccda4502e7c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbnativeinterface.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 72299d5a9a..aeda1e11d1 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -80,7 +80,7 @@ static int resourceType(const QByteArray &key) QByteArrayLiteral("glxcontext"), QByteArrayLiteral("apptime"), QByteArrayLiteral("appusertime"), QByteArrayLiteral("hintstyle"), QByteArrayLiteral("startupid"), QByteArrayLiteral("traywindow"), - QByteArrayLiteral("gettimestamp") + QByteArrayLiteral("gettimestamp"), QByteArrayLiteral("x11screen") }; const QByteArray *end = names + sizeof(names) / sizeof(names[0]); const QByteArray *result = std::find(names, end, key); @@ -139,6 +139,9 @@ void *QXcbNativeInterface::nativeResourceForIntegration(const QByteArray &resour case StartupId: result = startupId(); break; + case X11Screen: + result = x11Screen(); + break; default: break; } @@ -252,6 +255,15 @@ void *QXcbNativeInterface::startupId() return 0; } +void *QXcbNativeInterface::x11Screen() +{ + QXcbIntegration *integration = static_cast<QXcbIntegration *>(QGuiApplicationPrivate::platformIntegration()); + QXcbConnection *defaultConnection = integration->defaultConnection(); + if (defaultConnection) + return reinterpret_cast<void *>(defaultConnection->primaryScreen()); + return 0; +} + void QXcbNativeInterface::setAppTime(QScreen* screen, xcb_timestamp_t time) { static_cast<QXcbScreen *>(screen->handle())->connection()->setTime(time); |