From b50559164d64ed3298d4c6da68a7e77f7101ff11 Mon Sep 17 00:00:00 2001 From: Szymon Tomasz Stefanek Date: Sun, 23 Aug 2015 03:48:14 +0200 Subject: Port the Xss based idle time measurement tool to Qt5 --- src/modules/my/Idle_x11.cpp | 21 ++++++--------------- src/modules/my/libkvimy.cpp | 3 ++- 2 files changed, 8 insertions(+), 16 deletions(-) (limited to 'src/modules') diff --git a/src/modules/my/Idle_x11.cpp b/src/modules/my/Idle_x11.cpp index cc82cf81e..410ddaf7e 100644 --- a/src/modules/my/Idle_x11.cpp +++ b/src/modules/my/Idle_x11.cpp @@ -17,8 +17,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#ifndef COMPILE_ON_MAC -#if !defined(COMPILE_ON_WINDOWS) && !defined(COMPILE_ON_MINGW) + +#if !defined(COMPILE_ON_WINDOWS) && !defined(COMPILE_ON_MINGW) && !defined(COMPILE_ON_MAC) #include"Idle.h" @@ -30,10 +30,7 @@ #else #include #include -#if (QT_VERSION < 0x050000) #include -#endif // QT_VERSION < 0x050000 - #include #include #include @@ -80,14 +77,12 @@ old_handler = XSetErrorHandler(xerrhandler); int event_base, error_base; -#if (QT_VERSION < 0x050000) + if(XScreenSaverQueryExtension(QX11Info::display(), &event_base, &error_base)) { d->ss_info = XScreenSaverAllocInfo(); return true; } -#else - // FIXME: Need a replacement for this? -#endif + return false; } @@ -95,16 +90,12 @@ { if(!d->ss_info) return 0; -#if (QT_VERSION < 0x050000) + if(!XScreenSaverQueryInfo(QX11Info::display(), QX11Info::appRootWindow(), d->ss_info)) return 0; -#else - // FIXME: Need a replacement for this? - return 0; -#endif return d->ss_info->idle / 1000; } -#endif + #endif #endif diff --git a/src/modules/my/libkvimy.cpp b/src/modules/my/libkvimy.cpp index c8ac52741..4f0e5fd5a 100644 --- a/src/modules/my/libkvimy.cpp +++ b/src/modules/my/libkvimy.cpp @@ -136,7 +136,8 @@ static bool my_kvs_cmd_stopIdleTimer(KviKvsModuleCommandCall *) @syntax: $my.globalIdle() @description: - Returns the current user global idle time + Returns the current user global idle time. + You must execute [cmd]my.startIdleTimer[/cmd] before using this function. */ static bool my_kvs_fnc_globalIdle(KviKvsModuleFunctionCall * c) -- cgit v1.3.1-10-gc9f91