diff options
author | Martin Gräßlin <mgraesslin@kde.org> | 2013-08-02 06:24:36 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-07 13:49:43 +0200 |
commit | 45ab9d0c336f686d009061893dd8144eacd90040 (patch) | |
tree | ff13f2370f245cda2eca88c9501376d72dce32ed /src/plugins | |
parent | 4780e5326f3ec858252f0ef3b8bb779dbf37b4fe (diff) |
Export getTimestamp to the native interface
The functionality to get the current x11 timestamp is also needed by
applications which need to interact with the X11 directly. With XCB
it is not possible to inspect the event queue and by that an
application is not able to retrieve the current timestamp using the
property change pattern and waiting for the matching event.
Change-Id: Ie7ba78ecbe509ed3a902c702266917f65bf5ad07
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
Reviewed-by: David Faure (KDE) <faure@kde.org>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbnativeinterface.h | 4 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 1c9903e234..99e9932847 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -85,6 +85,7 @@ public: insert("hintstyle", QXcbNativeInterface::ScreenHintStyle); insert("startupid", QXcbNativeInterface::StartupId); insert(QByteArrayLiteral("traywindow"), QXcbNativeInterface::TrayWindow); + insert(QByteArrayLiteral("gettimestamp"), QXcbNativeInterface::GetTimestamp); } }; @@ -200,6 +201,9 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q if (QXcbSystemTrayTracker *s = systemTrayTracker(screen)) result = (void *)quintptr(s->trayWindow()); break; + case GetTimestamp: + result = getTimestamp(xcbScreen); + break; default: break; } @@ -254,6 +258,11 @@ void *QXcbNativeInterface::appUserTime(const QXcbScreen *screen) return reinterpret_cast<void *>(quintptr(screen->connection()->netWmUserTime())); } +void *QXcbNativeInterface::getTimestamp(const QXcbScreen *screen) +{ + return reinterpret_cast<void *>(quintptr(screen->connection()->getTimestamp())); +} + void *QXcbNativeInterface::startupId() { QXcbIntegration* integration = static_cast<QXcbIntegration *>(QGuiApplicationPrivate::platformIntegration()); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index c671d417e9..86b94e62e4 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -69,7 +69,8 @@ public: AppUserTime, ScreenHintStyle, StartupId, - TrayWindow + TrayWindow, + GetTimestamp }; QXcbNativeInterface(); @@ -91,6 +92,7 @@ public: void *graphicsDeviceForWindow(QWindow *window); void *appTime(const QXcbScreen *screen); void *appUserTime(const QXcbScreen *screen); + void *getTimestamp(const QXcbScreen *screen); void *startupId(); static void setAppTime(QScreen *screen, xcb_timestamp_t time); static void setAppUserTime(QScreen *screen, xcb_timestamp_t time); |