20 #include <QtCore/qsystemdetection.h>
24 #include <X11/extensions/scrnsaver.h>
26 uint32_t Platform::getIdleTime()
28 uint32_t idleTime = 0;
30 Display* display = X11Display::lock();
32 qDebug() <<
"XOpenDisplay failed";
37 int32_t x11event = 0, x11error = 0;
38 static int32_t hasExtension = XScreenSaverQueryExtension(display, &x11event, &x11error);
40 XScreenSaverInfo* info = XScreenSaverAllocInfo();
42 #pragma GCC diagnostic push
43 #pragma GCC diagnostic ignored "-Wold-style-cast"
44 XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
45 #pragma GCC diagnostic pop
46 idleTime = info->idle;
49 qDebug() <<
"XScreenSaverAllocInfo() failed";