mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Fixed segfault when compiled with X11 but run in bare terminal
This commit is contained in:
parent
402a54772e
commit
a281d396d6
@ -203,11 +203,16 @@ ui_get_idle_time(void)
|
||||
{
|
||||
#ifdef HAVE_LIBXSS
|
||||
XScreenSaverInfo *info = XScreenSaverAllocInfo();
|
||||
XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
|
||||
unsigned long result = info->idle;
|
||||
XFree(info);
|
||||
|
||||
return result;
|
||||
if (info != NULL && display != NULL) {
|
||||
XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
|
||||
unsigned long result = info->idle;
|
||||
XFree(info);
|
||||
return result;
|
||||
} else {
|
||||
gdouble seconds_elapsed = g_timer_elapsed(ui_idle_time, NULL);
|
||||
unsigned long ms_elapsed = seconds_elapsed * 1000.0;
|
||||
return ms_elapsed;
|
||||
}
|
||||
#else
|
||||
gdouble seconds_elapsed = g_timer_elapsed(ui_idle_time, NULL);
|
||||
unsigned long ms_elapsed = seconds_elapsed * 1000.0;
|
||||
|
Loading…
Reference in New Issue
Block a user