diff options
Diffstat (limited to 'src/x11extras')
-rw-r--r-- | src/x11extras/qx11info_x11.cpp | 19 | ||||
-rw-r--r-- | src/x11extras/qx11info_x11.h | 2 |
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(); |