Created
August 12, 2017 04:29
-
-
Save mc4man/d4f183fd916515e6038654877070d3a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 3f75b3c3439241c209349908fa190c0382e44f05 | |
Author: wm4 <wm4@nowhere> | |
Date: Tue Aug 8 12:55:41 2017 +0200 | |
x11: drop xscrnsaver use | |
It's an ancient X11 protocol extension that apparently nobody uses | |
anymore (desktop environments in particular have replaced it with | |
equally bad protocols that require tons of dependencies). Users keep | |
complaining about it being a required dependency. | |
The impact is likely minimal to none. | |
Fixes #4706 and other annoying people. | |
Diff reverts this. | |
diff --git b/README.md a/README.md | |
index 5fa0c4c..ce38279 100644 | |
--- b/README.md | |
+++ a/README.md | |
@@ -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 | |
diff --git b/video/out/x11_common.c a/video/out/x11_common.c | |
index 41c9d8b..30ad897 100644 | |
--- b/video/out/x11_common.c | |
+++ a/video/out/x11_common.c | |
@@ -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, ¬hing, ¬hing)) { | |
BOOL onoff = 0; | |
diff --git b/wscript a/wscript | |
index feb2085..ad57df9 100644 | |
--- b/wscript | |
+++ a/wscript | |
@@ -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'), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
However, it compiles...