1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-16 21:35:24 +00:00

Don't use xscreensaver on wayland.

Fixes #1874.
This commit is contained in:
Martin Dosch 2023-08-11 13:04:08 +02:00
parent 191f571bcd
commit 2ed6211cc3

View File

@ -107,7 +107,11 @@ ui_init(void)
notifier_initialise();
cons_about();
#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
ui_idle_time = g_timer_new();
inp_size = 0;
@ -150,15 +154,17 @@ ui_get_idle_time(void)
{
// if compiled with libxss, get the x sessions idle time
#ifdef HAVE_LIBXSS
XScreenSaverInfo* info = XScreenSaverAllocInfo();
if (info && display) {
XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
unsigned long result = info->idle;
XFree(info);
return result;
}
if (info) {
XFree(info);
if (display) {
XScreenSaverInfo* info = XScreenSaverAllocInfo();
if (info && display) {
XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
unsigned long result = info->idle;
XFree(info);
return result;
}
if (info) {
XFree(info);
}
}
// if no libxss or xss idle time failed, use profanity idle time
#endif