summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Gräßlin <mgraesslin@kde.org>2013-08-08 13:44:55 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-12 11:44:21 +0200
commit9c45260942c0ee32267e651d981bfa33a6acb64d (patch)
tree71346930998624b282cea8ad5728973b49a79788
parent133da89acbbfd8acac7791a5dea0b01a3d33df96 (diff)
downloadqtx11extras-9c45260942c0ee32267e651d981bfa33a6acb64d.tar.gz
Add convenient method getTimestamp to QX11Info
Provides access to the getTimestamp method in the XCB plugin which allows users to retrieve the current X timestamp. Change-Id: Ib6acd44c8ff899265ed6826f36b88fe427ff58c3 Reviewed-by: David Faure (KDE) <faure@kde.org>
-rw-r--r--src/x11extras/qx11info_x11.cpp19
-rw-r--r--src/x11extras/qx11info_x11.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/src/x11extras/qx11info_x11.cpp b/src/x11extras/qx11info_x11.cpp
index aa35ff1..713e76c 100644
--- a/src/x11extras/qx11info_x11.cpp
+++ b/src/x11extras/qx11info_x11.cpp
@@ -253,6 +253,25 @@ void QX11Info::setAppUserTime(unsigned long time)
}
/*!
+ Fetches the current X11 time stamp from the X Server.
+
+ This method creates a property notify event and blocks till it is
+ received back from the X Server.
+
+ \since 5.2
+*/
+unsigned long QX11Info::getTimestamp()
+{
+ if (!qApp)
+ return 0;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return 0;
+ QScreen* screen = QGuiApplication::primaryScreen();
+ return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen("gettimestamp", screen)));
+}
+
+/*!
Returns the default display for the application.
\sa appScreen()
diff --git a/src/x11extras/qx11info_x11.h b/src/x11extras/qx11info_x11.h
index afc9ee4..bbc7ff4 100644
--- a/src/x11extras/qx11info_x11.h
+++ b/src/x11extras/qx11info_x11.h
@@ -65,6 +65,8 @@ public:
static void setAppTime(unsigned long time);
static void setAppUserTime(unsigned long time);
+ static unsigned long getTimestamp();
+
static Display *display();
static xcb_connection_t *connection();