diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index ee84bc8f1c..759d5fa9ea 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -43,6 +43,9 @@ Interface changes - add a `--watch-later-options` option to allow configuring which options quit-watch-later saves - make `current-window-scale` writeable and use it in the default input.conf + - add `--input-builtin-bindings` flag to control loading of built-in key + bindings during start-up (default: yes). + --- mpv 0.33.0 --- - add `--d3d11-exclusive-fs` flag to enable D3D11 exclusive fullscreen mode when the player enters fullscreen. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 34d29db083..812b66639f 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -3842,6 +3842,11 @@ Input using ``mp.add_key_binding`` (but not ``mp.add_forced_key_binding``). This might change in the future to exclude ``mp.add_key_binding``. +``--no-input-builtin-bindings`` + Disable loading of built-in key bindings during start-up. This option is + applied only during (lib)mpv initialization, and if used then it will not + be not possible to enable them later. May be useful to libmpv clients. + ``--input-cmdlist`` Prints all commands that can be bound to keys. diff --git a/input/input.c b/input/input.c index 40abd7d0fa..f69517f748 100644 --- a/input/input.c +++ b/input/input.c @@ -176,6 +176,7 @@ struct input_opts { int use_gamepad; int use_media_keys; int default_bindings; + int builtin_bindings; int enable_mouse_movements; int vo_key_input; int test; @@ -190,6 +191,7 @@ const struct m_sub_options input_config = { {"input-keylist", OPT_PRINT(mp_print_key_list)}, {"input-cmdlist", OPT_PRINT(mp_print_cmd_list)}, {"input-default-bindings", OPT_FLAG(default_bindings)}, + {"input-builtin-bindings", OPT_FLAG(builtin_bindings)}, {"input-test", OPT_FLAG(test)}, {"input-doubleclick-time", OPT_INT(doubleclick_time), M_RANGE(0, 1000)}, @@ -218,6 +220,7 @@ const struct m_sub_options input_config = { .enable_mouse_movements = 1, .use_media_keys = 1, .default_bindings = 1, + .builtin_bindings = 1, .vo_key_input = 1, .allow_win_drag = 1, }, @@ -1367,7 +1370,7 @@ void mp_input_load_config(struct input_ctx *ictx) // "Uncomment" the default key bindings in etc/input.conf and add them. // All lines that do not start with '# ' are parsed. bstr builtin = bstr0(builtin_input_conf); - while (builtin.len) { + while (ictx->opts->builtin_bindings && builtin.len) { bstr line = bstr_getline(builtin, &builtin); bstr_eatstart0(&line, "#"); if (!bstr_startswith0(line, " "))