aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Szymon Tomasz Stefanek2015-08-23 03:48:14 +0200
committerGravatar Szymon Tomasz Stefanek2015-08-23 03:48:14 +0200
commitb50559164d64ed3298d4c6da68a7e77f7101ff11 (patch)
treee92425ac34fedbf088654d6c26ef9a3e3cd528e4 /src/modules
parentRegister http and ftp classes also with Qt5 (diff)
downloadKVIrc-b50559164d64ed3298d4c6da68a7e77f7101ff11.tar.gz
KVIrc-b50559164d64ed3298d4c6da68a7e77f7101ff11.tar.bz2
KVIrc-b50559164d64ed3298d4c6da68a7e77f7101ff11.zip
Port the Xss based idle time measurement tool to Qt5
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/my/Idle_x11.cpp21
-rw-r--r--src/modules/my/libkvimy.cpp3
2 files changed, 8 insertions, 16 deletions
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 <QApplication>
#include <QDesktopWidget>
-#if (QT_VERSION < 0x050000)
#include <QX11Info>
-#endif // QT_VERSION < 0x050000
-
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/scrnsaver.h>
@@ -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:
<int> $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)