idleMilliseconds: return -1 if WAYLAND_DISPLAY set

CppUtils.idleMilliseconds(): If the WAYLAND_DISPLAY environment
variable is set, assume we're running under a Wayland environment
and return early before trying to connect to an X11 display.
This commit is contained in:
miruka 2020-11-07 04:47:09 -04:00
parent acce5d60ae
commit 9ef13c9d50

View File

@ -62,6 +62,8 @@ public slots:
return -1; return -1;
#elif defined(USE_LINUX_AUTOAWAY) #elif defined(USE_LINUX_AUTOAWAY)
if (! this->waylandDisplay.isEmpty()) return -1;
Display *display = XOpenDisplay(NULL); Display *display = XOpenDisplay(NULL);
if (! display) return -1; if (! display) return -1;
@ -88,6 +90,7 @@ public slots:
private: private:
QLocale appLocale; QLocale appLocale;
QString waylandDisplay = qEnvironmentVariable("WAYLAND_DISPLAY");
}; };