From f1d3ba0e3318eb4b0ac5686fed4b80acb3753919 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 14 Jun 2013 00:24:41 +0200 Subject: x11: enable screensaver when paused, rename/change --stop-xscreensaver Use the recently introduced screensaver VOCTRLs to control the screensaver in the X11 backend. This means the behavior when paused changes: the old code always kept the screensaver disabled, but now the screensaver is reenabled on pausing. Rename the --stop-xscreensaver option to --stop-screensaver and make it more generic. Now it affects all backends that respond to the screensaver VOCTRLs. --- core/mplayer.c | 5 +++-- core/options.c | 4 ++-- core/options.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'core') diff --git a/core/mplayer.c b/core/mplayer.c index 8b98e12bf0..5e1d58835e 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -2474,7 +2474,8 @@ int reinit_video_chain(struct MPContext *mpctx) mpctx->initialized_flags |= INITIALIZED_VCODEC; - vo_control(mpctx->video_out, opts->pause ? VOCTRL_RESTORE_SCREENSAVER + bool saver_state = opts->pause || !opts->stop_screensaver; + vo_control(mpctx->video_out, saver_state ? VOCTRL_RESTORE_SCREENSAVER : VOCTRL_KILL_SCREENSAVER, NULL); vo_control(mpctx->video_out, mpctx->paused ? VOCTRL_PAUSE @@ -2754,7 +2755,7 @@ void unpause_player(struct MPContext *mpctx) { mpctx->opts.pause = 0; - if (mpctx->video_out) + if (mpctx->video_out && mpctx->opts.stop_screensaver) vo_control(mpctx->video_out, VOCTRL_KILL_SCREENSAVER, NULL); if (!mpctx->paused) diff --git a/core/options.c b/core/options.c index 55297bf983..f73fcf7bb2 100644 --- a/core/options.c +++ b/core/options.c @@ -587,10 +587,10 @@ const m_option_t mp_opts[] = { OPT_CHOICE_OR_INT("cursor-autohide", vo.cursor_autohide_delay, 0, 0, 30000, ({"no", -1}, {"always", -2})), + OPT_FLAG("stop-screensaver", stop_screensaver, 0), OPT_INT64("wid", vo.WinID, CONF_GLOBAL), #ifdef CONFIG_X11 - OPT_FLAG("stop-xscreensaver", vo.stop_screensaver, 0), OPT_STRINGLIST("fstype", vo.fstype_list, 0), #endif OPT_STRING("heartbeat-cmd", heartbeat_cmd, 0), @@ -743,7 +743,6 @@ const struct MPOpts mp_default_opts = { .fs = false, .screen_id = -1, .fsscreen_id = -1, - .stop_screensaver = 1, .nomouse_input = 0, .enable_mouse_movements = 1, .fsmode = 0, @@ -756,6 +755,7 @@ const struct MPOpts mp_default_opts = { }, .wintitle = "mpv - ${media-title}", .heartbeat_interval = 30.0, + .stop_screensaver = 1, .gamma_gamma = 1000, .gamma_brightness = 1000, .gamma_contrast = 1000, diff --git a/core/options.h b/core/options.h index 36af43e3f1..f598cf267f 100644 --- a/core/options.h +++ b/core/options.h @@ -14,7 +14,6 @@ typedef struct mp_vo_opts { bool fs; int screen_id; int fsscreen_id; - int stop_screensaver; char *winname; char** fstype_list; int native_keyrepeat; @@ -72,6 +71,7 @@ typedef struct MPOpts { int gamma_saturation; int gamma_hue; + int stop_screensaver; int fullscreen; int requested_colorspace; int requested_input_range; -- cgit v1.2.3