Prevent error spam when XScreenSaver not supported
If XScreenSaver is available but not supported (e.g. when running in XWayland), return -1 for Utils.idleMilliseconds(), instead of letting the code fail and print an error every time this function gets called to check for the machine's idle time.
This commit is contained in:
parent
ed74592769
commit
acce5d60ae
|
@ -65,8 +65,13 @@ public slots:
|
|||
Display *display = XOpenDisplay(NULL);
|
||||
if (! display) return -1;
|
||||
|
||||
int supportedVersion = 0, error = 0;
|
||||
if (! XScreenSaverQueryExtension(display, &supportedVersion, &error))
|
||||
return -1;
|
||||
|
||||
XScreenSaverInfo *info = XScreenSaverAllocInfo();
|
||||
XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
|
||||
XFree(info);
|
||||
const int idle = info->idle;
|
||||
|
||||
XCloseDisplay(display);
|
||||
|
@ -77,6 +82,7 @@ public slots:
|
|||
|
||||
#else
|
||||
return -1;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user