summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/options.rst5
-rw-r--r--mpvcore/mp_core.h2
-rw-r--r--mpvcore/mplayer.c41
-rw-r--r--mpvcore/options.c1
-rw-r--r--mpvcore/options.h1
5 files changed, 31 insertions, 19 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 46b894f931..81fee482af 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -566,6 +566,11 @@
``no`` will disable cursor autohide. ``always`` means the cursor will stay
hidden.
+``--cursor-autohide-fs-only``
+ If this option is given, the cursor is always visible in windowed mode. In
+ fullscreen mode, the cursor is shown or hidden according to
+ ``--cursor-autohide``.
+
``--audio-delay=<sec>``
Audio delay in seconds (positive or negative float value). Negative values
delay the audio, and positive values delay the video.
diff --git a/mpvcore/mp_core.h b/mpvcore/mp_core.h
index cb426425b1..777e04945a 100644
--- a/mpvcore/mp_core.h
+++ b/mpvcore/mp_core.h
@@ -246,7 +246,7 @@ typedef struct MPContext {
double mouse_timer;
unsigned int mouse_event_ts;
- int mouse_waiting_hide;
+ bool mouse_cursor_visible;
// used to prevent hanging in some error cases
double start_timestamp;
diff --git a/mpvcore/mplayer.c b/mpvcore/mplayer.c
index 3a2b65b31c..c9b51c8272 100644
--- a/mpvcore/mplayer.c
+++ b/mpvcore/mplayer.c
@@ -2402,10 +2402,7 @@ int reinit_video_chain(struct MPContext *mpctx)
"the selected video_out (-vo) device.\n");
goto err_out;
}
- if (opts->cursor_autohide_delay != -1) {
- vo_control(mpctx->video_out, VOCTRL_SET_CURSOR_VISIBILITY,
- &(bool){false});
- }
+ mpctx->mouse_cursor_visible = true;
mpctx->initialized_flags |= INITIALIZED_VO;
}
@@ -3454,25 +3451,33 @@ static void run_playloop(struct MPContext *mpctx)
// ================================================================
vo_check_events(vo);
+ bool mouse_cursor_visible = mpctx->mouse_cursor_visible;
+ if (opts->cursor_autohide_delay == -1)
+ mouse_cursor_visible = true;
+
unsigned mouse_event_ts = mp_input_get_mouse_event_counter(mpctx->input);
if (mpctx->mouse_event_ts != mouse_event_ts) {
mpctx->mouse_event_ts = mouse_event_ts;
- if (opts->cursor_autohide_delay > -1) {
- vo_control(vo, VOCTRL_SET_CURSOR_VISIBILITY, &(bool){true});
- if (opts->cursor_autohide_delay >= 0) {
- mpctx->mouse_waiting_hide = 1;
- mpctx->mouse_timer =
- mp_time_sec() + opts->cursor_autohide_delay / 1000.0;
- }
- }
+ mpctx->mouse_timer =
+ mp_time_sec() + opts->cursor_autohide_delay / 1000.0;
+ mouse_cursor_visible = true;
}
- if (mpctx->mouse_waiting_hide == 1 &&
- mp_time_sec() >= mpctx->mouse_timer)
- {
- vo_control(vo, VOCTRL_SET_CURSOR_VISIBILITY, &(bool){false});
- mpctx->mouse_waiting_hide = 2;
- }
+ if (mp_time_sec() >= mpctx->mouse_timer)
+ mouse_cursor_visible = false;
+
+ if (opts->cursor_autohide_delay == -1)
+ mouse_cursor_visible = true;
+
+ if (opts->cursor_autohide_delay == -2)
+ mouse_cursor_visible = false;
+
+ if (opts->cursor_autohide_fs && !opts->vo.fullscreen)
+ mouse_cursor_visible = true;
+
+ if (mouse_cursor_visible != mpctx->mouse_cursor_visible)
+ vo_control(vo, VOCTRL_SET_CURSOR_VISIBILITY, &mouse_cursor_visible);
+ mpctx->mouse_cursor_visible = mouse_cursor_visible;
if (opts->heartbeat_cmd) {
double now = mp_time_sec();
diff --git a/mpvcore/options.c b/mpvcore/options.c
index 9f87186066..cf09702dcb 100644
--- a/mpvcore/options.c
+++ b/mpvcore/options.c
@@ -606,6 +606,7 @@ const m_option_t mp_opts[] = {
OPT_CHOICE_OR_INT("cursor-autohide", cursor_autohide_delay, 0,
0, 30000, ({"no", -1}, {"always", -2})),
+ OPT_FLAG("cursor-autohide-fs-only", cursor_autohide_fs, 0),
OPT_FLAG("stop-screensaver", stop_screensaver, 0),
OPT_INT64("wid", vo.WinID, CONF_GLOBAL),
diff --git a/mpvcore/options.h b/mpvcore/options.h
index a0fe23f050..25ff391615 100644
--- a/mpvcore/options.h
+++ b/mpvcore/options.h
@@ -69,6 +69,7 @@ typedef struct MPOpts {
int stop_screensaver;
int cursor_autohide_delay;
+ int cursor_autohide_fs;
int requested_colorspace;
int requested_input_range;