summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-07-08 22:25:08 +0200
committerwm4 <wm4@nowhere>2020-07-08 22:45:07 +0200
commitc498b2846af0ee8835b9144c9f6893568a4e49c6 (patch)
tree0be6b06d2d7ec678a97f9e953d6472ccc3d33f29 /video/out
parentb93f142011381a9ad753a246ea112115f262e7a1 (diff)
downloadmpv-c498b2846af0ee8835b9144c9f6893568a4e49c6.tar.bz2
mpv-c498b2846af0ee8835b9144c9f6893568a4e49c6.tar.xz
x11: remove terrible xdg-screensaver hack
I'm tired of dealing with this frequent spawning of xdg-screensaver when debugging and what not. xdg-screensaver was never a serious tool anyway, it's more like some self-deprecating joke by FDO folks. This will affect X11 on GNOME and other DEs. I'm singling out GNOME though, because they are the ones actively sabotaging any sane technical solutions and community cooperation. I have been accused of taking it out on innocent GNOME users, while none of this will reach GNOME developers. Of course that is not the intention.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/x11_common.c39
-rw-r--r--video/out/x11_common.h9
2 files changed, 1 insertions, 47 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 9b326674dc..40228903b9 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -527,30 +527,6 @@ static void vo_x11_get_bounding_monitors(struct vo_x11_state *x11, long b[4])
XFree(screens);
}
-static void *screensaver_thread(void *arg)
-{
- struct vo_x11_state *x11 = arg;
-
- for (;;) {
- sem_wait(&x11->screensaver_sem);
- // don't queue multiple wakeups
- while (!sem_trywait(&x11->screensaver_sem)) {}
-
- if (atomic_load(&x11->screensaver_terminate))
- break;
-
- char *args[] = {"xdg-screensaver", "reset", NULL};
- int status = mp_subprocess(args, NULL, NULL, mp_devnull, mp_devnull, &(char*){0});
- if (status) {
- MP_VERBOSE(x11, "Disabling screensaver failed (%d). Make sure the "
- "xdg-screensaver script is installed.\n", status);
- break;
- }
- }
-
- return NULL;
-}
-
int vo_x11_init(struct vo *vo)
{
char *dispName;
@@ -572,13 +548,6 @@ int vo_x11_init(struct vo *vo)
x11->opts = x11->opts_cache->opts;
vo->x11 = x11;
- sem_init(&x11->screensaver_sem, 0, 0);
- if (pthread_create(&x11->screensaver_thread, NULL, screensaver_thread, x11)) {
- sem_destroy(&x11->screensaver_sem);
- goto error;
- }
- x11->screensaver_thread_running = true;
-
x11_error_output = x11->log;
XSetErrorHandler(x11_errorhandler);
@@ -808,13 +777,6 @@ void vo_x11_uninit(struct vo *vo)
XCloseDisplay(x11->display);
}
- if (x11->screensaver_thread_running) {
- atomic_store(&x11->screensaver_terminate, true);
- sem_post(&x11->screensaver_sem);
- pthread_join(x11->screensaver_thread, NULL);
- sem_destroy(&x11->screensaver_sem);
- }
-
if (x11->wakeup_pipe[0] >= 0) {
close(x11->wakeup_pipe[0]);
close(x11->wakeup_pipe[1]);
@@ -2013,7 +1975,6 @@ static void xscreensaver_heartbeat(struct vo_x11_state *x11)
(time - x11->screensaver_time_last) >= 10)
{
x11->screensaver_time_last = time;
- sem_post(&x11->screensaver_sem);
XResetScreenSaver(x11->display);
}
}
diff --git a/video/out/x11_common.h b/video/out/x11_common.h
index fffc5be294..774a76afbe 100644
--- a/video/out/x11_common.h
+++ b/video/out/x11_common.h
@@ -20,14 +20,11 @@
#include <stdint.h>
#include <stdbool.h>
-#include <pthread.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#include "osdep/atomic.h"
-#include "osdep/semaphore.h"
-
#include "common/common.h"
+#include "osdep/atomic.h"
#include "config.h"
#if !HAVE_GPL
@@ -75,10 +72,6 @@ struct vo_x11_state {
bool screensaver_enabled;
bool dpms_touched;
double screensaver_time_last;
- pthread_t screensaver_thread;
- bool screensaver_thread_running;
- sem_t screensaver_sem;
- atomic_bool screensaver_terminate;
XIM xim;
XIC xic;