mirror of
https://github.com/libretro/RetroArch
synced 2025-04-15 23:42:30 +00:00
x11: add support for Xss screensaver disabling
in case xdg-screensaver isn't installed.
This commit is contained in:
parent
3f0d3ec393
commit
843c816fc2
@ -1305,6 +1305,9 @@ ifeq ($(HAVE_X11), 1)
|
|||||||
ifeq ($(HAVE_XCB),1)
|
ifeq ($(HAVE_XCB),1)
|
||||||
LIBS += -lX11-xcb
|
LIBS += -lX11-xcb
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(HAVE_XSCRNSAVER),1)
|
||||||
|
LIBS += -lXss
|
||||||
|
endif
|
||||||
ifneq ($(HAVE_OPENGLES), 1)
|
ifneq ($(HAVE_OPENGLES), 1)
|
||||||
OBJ += gfx/drivers_context/x_ctx.o
|
OBJ += gfx/drivers_context/x_ctx.o
|
||||||
endif
|
endif
|
||||||
|
@ -204,6 +204,28 @@ void x11_set_window_attr(Display *dpy, Window win)
|
|||||||
x11_set_window_pid(dpy, win);
|
x11_set_window_pid(dpy, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_XSCRNSAVER
|
||||||
|
#include <X11/extensions/scrnsaver.h>
|
||||||
|
static bool xss_screensaver_inhibit(Display *dpy, bool enable)
|
||||||
|
{
|
||||||
|
int dummy, min, maj;
|
||||||
|
if (!XScreenSaverQueryExtension(dpy, &dummy, &dummy) ||
|
||||||
|
!XScreenSaverQueryVersion(dpy, &maj, &min) ||
|
||||||
|
maj < 1 || (maj == 1 && min < 1)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
XScreenSaverSuspend(dpy, enable);
|
||||||
|
XResetScreenSaver(dpy);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static bool xss_screensaver_inhibit(Display *dpy, bool enable)
|
||||||
|
{
|
||||||
|
(void) dpy;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void xdg_screensaver_inhibit(Window wnd)
|
static void xdg_screensaver_inhibit(Window wnd)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -253,9 +275,11 @@ bool x11_suspend_screensaver(void *data, bool enable)
|
|||||||
if (dbus_suspend_screensaver(enable))
|
if (dbus_suspend_screensaver(enable))
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
if (enable)
|
if (!xss_screensaver_inhibit(g_x11_dpy, enable) && enable)
|
||||||
if (xdg_screensaver_available)
|
if (xdg_screensaver_available) {
|
||||||
xdg_screensaver_inhibit(wnd);
|
xdg_screensaver_inhibit(wnd);
|
||||||
|
return xdg_screensaver_available;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,6 +505,7 @@ if [ "$HAVE_X11" != 'no' ]; then
|
|||||||
check_val '' XCB -lxcb '' xcb '' '' false
|
check_val '' XCB -lxcb '' xcb '' '' false
|
||||||
check_val '' XEXT -lXext '' xext '' '' false
|
check_val '' XEXT -lXext '' xext '' '' false
|
||||||
check_val '' XF86VM -lXxf86vm '' xxf86vm '' '' false
|
check_val '' XF86VM -lXxf86vm '' xxf86vm '' '' false
|
||||||
|
check_val '' XSCRNSAVER -lXss '' xscrnsaver '' '' false
|
||||||
else
|
else
|
||||||
die : 'Notice: X11 not present. Skipping X11 code paths.'
|
die : 'Notice: X11 not present. Skipping X11 code paths.'
|
||||||
fi
|
fi
|
||||||
|
@ -92,6 +92,7 @@ HAVE_OPENGLES3_1=no # OpenGLES3.1 support
|
|||||||
HAVE_OPENGLES3_2=no # OpenGLES3.2 support
|
HAVE_OPENGLES3_2=no # OpenGLES3.2 support
|
||||||
HAVE_X11=auto # everything X11.
|
HAVE_X11=auto # everything X11.
|
||||||
HAVE_XRANDR=auto # Xrandr support.
|
HAVE_XRANDR=auto # Xrandr support.
|
||||||
|
HAVE_XSCRNSAVER=auto # Xss support.
|
||||||
HAVE_OMAP=no # OMAP video support
|
HAVE_OMAP=no # OMAP video support
|
||||||
HAVE_XINERAMA=auto # Xinerama support.
|
HAVE_XINERAMA=auto # Xinerama support.
|
||||||
HAVE_KMS=auto # KMS context support
|
HAVE_KMS=auto # KMS context support
|
||||||
|
Loading…
x
Reference in New Issue
Block a user