mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-25 03:26:22 +00:00
Merge pull request #1876 from mdosch/fix-screensaver-spam
Don't use xscreensaver on wayland.
This commit is contained in:
@@ -107,7 +107,11 @@ ui_init(void)
|
|||||||
notifier_initialise();
|
notifier_initialise();
|
||||||
cons_about();
|
cons_about();
|
||||||
#ifdef HAVE_LIBXSS
|
#ifdef HAVE_LIBXSS
|
||||||
display = XOpenDisplay(0);
|
char* x11_display = getenv("DISPLAY");
|
||||||
|
char* wayland_display = getenv("WAYLAND_DISPLAY");
|
||||||
|
if (x11_display && !wayland_display) {
|
||||||
|
display = XOpenDisplay(0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
ui_idle_time = g_timer_new();
|
ui_idle_time = g_timer_new();
|
||||||
inp_size = 0;
|
inp_size = 0;
|
||||||
@@ -150,15 +154,17 @@ ui_get_idle_time(void)
|
|||||||
{
|
{
|
||||||
// if compiled with libxss, get the x sessions idle time
|
// if compiled with libxss, get the x sessions idle time
|
||||||
#ifdef HAVE_LIBXSS
|
#ifdef HAVE_LIBXSS
|
||||||
XScreenSaverInfo* info = XScreenSaverAllocInfo();
|
if (display) {
|
||||||
if (info && display) {
|
XScreenSaverInfo* info = XScreenSaverAllocInfo();
|
||||||
XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
|
if (info && display) {
|
||||||
unsigned long result = info->idle;
|
XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
|
||||||
XFree(info);
|
unsigned long result = info->idle;
|
||||||
return result;
|
XFree(info);
|
||||||
}
|
return result;
|
||||||
if (info) {
|
}
|
||||||
XFree(info);
|
if (info) {
|
||||||
|
XFree(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// if no libxss or xss idle time failed, use profanity idle time
|
// if no libxss or xss idle time failed, use profanity idle time
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user