diff options
-rw-r--r-- | DOCS/man/en/options.rst | 3 | ||||
-rw-r--r-- | input/input.c | 8 | ||||
-rw-r--r-- | options/options.c | 3 | ||||
-rw-r--r-- | options/options.h | 1 |
4 files changed, 14 insertions, 1 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index 644ff7bfee..338413c211 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -2764,6 +2764,9 @@ OPTIONS See also ``--slave-broken``. +``--no-window-dragging`` + Don't move the window when clicking on it and moving the mouse pointer. + ``--x11-netwm=no`` (X11 only) Disable use of the NetWM protocol when switching to or from fullscreen. diff --git a/input/input.c b/input/input.c index b6dc43c79d..6748e5930d 100644 --- a/input/input.c +++ b/input/input.c @@ -127,6 +127,7 @@ struct input_ctx { bool using_alt_gr; bool using_ar; bool using_cocoa_media_keys; + bool win_drag; // Autorepeat stuff short ar_state; @@ -1237,7 +1238,10 @@ bool mp_input_test_mouse_active(struct input_ctx *ictx, int x, int y) bool mp_input_test_dragging(struct input_ctx *ictx, int x, int y) { - return test_mouse(ictx, x, y, MP_INPUT_ALLOW_VO_DRAGGING); + input_lock(ictx); + bool r = !ictx->win_drag || test_mouse(ictx, x, y, MP_INPUT_ALLOW_VO_DRAGGING); + input_unlock(ictx); + return r; } static void bind_dealloc(struct cmd_bind *bind) @@ -1546,6 +1550,8 @@ struct input_ctx *mp_input_init(struct mpv_global *global) } #endif + ictx->win_drag = global->opts->allow_win_drag; + if (input_conf->in_file) { int mode = O_RDONLY; #ifndef __MINGW32__ diff --git a/options/options.c b/options/options.c index 37bea53472..3b9347ebb8 100644 --- a/options/options.c +++ b/options/options.c @@ -448,6 +448,8 @@ const m_option_t mp_opts[] = { OPT_FLAG("ontop", vo.ontop, M_OPT_FIXED), OPT_FLAG("border", vo.border, M_OPT_FIXED), + OPT_FLAG("window-dragging", allow_win_drag, CONF_GLOBAL), + OPT_CHOICE("softvol", softvol, 0, ({"no", SOFTVOL_NO}, {"yes", SOFTVOL_YES}, @@ -662,6 +664,7 @@ const struct MPOpts mp_default_opts = { .WinID = -1, .x11_netwm = 1, }, + .allow_win_drag = 1, .wintitle = "mpv - ${media-title}", .heartbeat_interval = 30.0, .stop_screensaver = 1, diff --git a/options/options.h b/options/options.h index d512089b3a..5da933d41d 100644 --- a/options/options.h +++ b/options/options.h @@ -74,6 +74,7 @@ typedef struct MPOpts { int gapless_audio; mp_vo_opts vo; + int allow_win_drag; char *wintitle; int force_rgba_osd; |