Revert "x11: drop xscrnsaver use"

This broke screensaver/powersave inhibition with at least KDE and
LXDE. This is a release blocker.

Since fdo, KDE and GNOME idiots seem to be unable to reach
a consensus on a simple protocol, this seems unlikely to get
fixed upstream this year, so revert this change.

Fixes #4752.
Breaks #4706 but I don’t give a damn.

This reverts commit 3f75b3c343.
This commit is contained in:
Martin Herkt 2017-08-20 09:11:26 +02:00
parent a82007dd1e
commit 82d9419f62
No known key found for this signature in database
GPG Key ID: C24B9CD04DC6AE7F
3 changed files with 18 additions and 1 deletions

View File

@ -96,7 +96,7 @@ Example:
Essential dependencies (incomplete list):
- gcc or clang
- X development headers (xlib, xrandr, xext, xinerama, libvdpau,
- X development headers (xlib, xrandr, xext, xscrnsaver, xinerama, libvdpau,
libGL, GLX, EGL, xv, ...)
- Audio output development headers (libasound/ALSA, pulseaudio)
- FFmpeg libraries (libavutil libavcodec libavformat libswscale libavfilter

View File

@ -33,6 +33,7 @@
#include <X11/XKBlib.h>
#include <X11/XF86keysym.h>
#include <X11/extensions/scrnsaver.h>
#include <X11/extensions/dpms.h>
#include <X11/extensions/Xinerama.h>
#include <X11/extensions/Xrandr.h>
@ -1907,9 +1908,22 @@ static void xscreensaver_heartbeat(struct vo_x11_state *x11)
{
x11->screensaver_time_last = time;
sem_post(&x11->screensaver_sem);
XResetScreenSaver(x11->display);
}
}
static int xss_suspend(Display *mDisplay, Bool suspend)
{
int event, error, major, minor;
if (XScreenSaverQueryExtension(mDisplay, &event, &error) != True ||
XScreenSaverQueryVersion(mDisplay, &major, &minor) != True)
return 0;
if (major < 1 || (major == 1 && minor < 1))
return 0;
XScreenSaverSuspend(mDisplay, suspend);
return 1;
}
static void set_screensaver(struct vo_x11_state *x11, bool enabled)
{
Display *mDisplay = x11->display;
@ -1917,6 +1931,8 @@ static void set_screensaver(struct vo_x11_state *x11, bool enabled)
return;
MP_VERBOSE(x11, "%s screensaver.\n", enabled ? "Enabling" : "Disabling");
x11->screensaver_enabled = enabled;
if (xss_suspend(mDisplay, !enabled))
return;
int nothing;
if (DPMSQueryExtension(mDisplay, &nothing, &nothing)) {
BOOL onoff = 0;

View File

@ -578,6 +578,7 @@ video_output_features = [
'name': '--x11',
'desc': 'X11',
'func': check_pkg_config('x11', '>= 1.0.0',
'xscrnsaver', '>= 1.0.0',
'xext', '>= 1.0.0',
'xinerama', '>= 1.0.0',
'xrandr', '>= 1.2.0'),