mirror of
https://github.com/mpv-player/mpv
synced 2025-04-01 00:07:33 +00:00
options: move cursor autohiding opts to mp_vo_opts
Certain backends (i.e. wayland) will need to do special things with the mouse. It makes sense to expose the values of these options to them, so they can behave correctly.
This commit is contained in:
parent
fd28be400c
commit
65a317436d
@ -145,6 +145,9 @@ static const m_option_t mp_vo_opt_list[] = {
|
||||
({"default", -1})),
|
||||
OPT_CHOICE_OR_INT("fs-screen", fsscreen_id, 0, 0, 32,
|
||||
({"all", -2}, {"current", -1})),
|
||||
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("keepaspect", keepaspect, 0),
|
||||
OPT_FLAG("keepaspect-window", keepaspect_window, 0),
|
||||
OPT_FLAG("hidpi-window-scale", hidpi_window_scale, 0),
|
||||
@ -176,6 +179,7 @@ const struct m_sub_options vo_sub_opts = {
|
||||
.screen_id = -1,
|
||||
.fsscreen_id = -1,
|
||||
.panscan = 0.0f,
|
||||
.cursor_autohide_delay = 1000,
|
||||
.keepaspect = 1,
|
||||
.keepaspect_window = 1,
|
||||
.hidpi_window_scale = 1,
|
||||
@ -589,9 +593,6 @@ static const m_option_t mp_opts[] = {
|
||||
OPT_CHOICE_OR_INT("video-rotate", video_rotate, UPDATE_IMGPAR, 0, 359,
|
||||
({"no", -1})),
|
||||
|
||||
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, UPDATE_SCREENSAVER),
|
||||
|
||||
OPT_SUBSTRUCT("", video_equalizer, mp_csp_equalizer_conf, 0),
|
||||
@ -909,7 +910,6 @@ static const struct MPOpts mp_default_opts = {
|
||||
.gapless_audio = -1,
|
||||
.wintitle = "${?media-title:${media-title}}${!media-title:No file} - mpv",
|
||||
.stop_screensaver = 1,
|
||||
.cursor_autohide_delay = 1000,
|
||||
.video_osd = 1,
|
||||
.osd_level = 1,
|
||||
.osd_on_seek = 1,
|
||||
|
@ -41,6 +41,9 @@ typedef struct mp_vo_opts {
|
||||
struct m_geometry autofit_smaller;
|
||||
double window_scale;
|
||||
|
||||
int cursor_autohide_delay;
|
||||
int cursor_autohide_fs;
|
||||
|
||||
int keepaspect;
|
||||
int keepaspect_window;
|
||||
int hidpi_window_scale;
|
||||
@ -162,8 +165,6 @@ typedef struct MPOpts {
|
||||
struct mp_csp_equalizer_opts *video_equalizer;
|
||||
|
||||
int stop_screensaver;
|
||||
int cursor_autohide_delay;
|
||||
int cursor_autohide_fs;
|
||||
|
||||
int video_rotate;
|
||||
|
||||
|
@ -6101,7 +6101,7 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags,
|
||||
if (opt_ptr == &opts->vo->window_scale)
|
||||
update_window_scale(mpctx);
|
||||
|
||||
if (opt_ptr == &opts->cursor_autohide_delay)
|
||||
if (opt_ptr == &opts->vo->cursor_autohide_delay)
|
||||
mpctx->mouse_timer = 0;
|
||||
|
||||
if (flags & UPDATE_DVB_PROG) {
|
||||
|
@ -804,7 +804,7 @@ static void handle_cursor_autohide(struct MPContext *mpctx)
|
||||
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;
|
||||
mpctx->mouse_timer = now + opts->cursor_autohide_delay / 1000.0;
|
||||
mpctx->mouse_timer = now + vo->opts->cursor_autohide_delay / 1000.0;
|
||||
mouse_cursor_visible = true;
|
||||
}
|
||||
|
||||
@ -814,13 +814,13 @@ static void handle_cursor_autohide(struct MPContext *mpctx)
|
||||
mouse_cursor_visible = false;
|
||||
}
|
||||
|
||||
if (opts->cursor_autohide_delay == -1)
|
||||
if (vo->opts->cursor_autohide_delay == -1)
|
||||
mouse_cursor_visible = true;
|
||||
|
||||
if (opts->cursor_autohide_delay == -2)
|
||||
if (vo->opts->cursor_autohide_delay == -2)
|
||||
mouse_cursor_visible = false;
|
||||
|
||||
if (opts->cursor_autohide_fs && !opts->vo->fullscreen)
|
||||
if (vo->opts->cursor_autohide_fs && !opts->vo->fullscreen)
|
||||
mouse_cursor_visible = true;
|
||||
|
||||
if (mouse_cursor_visible != mpctx->mouse_cursor_visible)
|
||||
|
Loading…
Reference in New Issue
Block a user