From ead525e17a0e81bdac915dccbb0503f07cb426bf Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 1 Sep 2013 17:06:11 +0200 Subject: input: comment all default bindings in input.conf I suspect most users will just copy etc/input.conf when they want to remap some default bindings. But usually this means the user even copies bindings he doesn't care about, and it's better if the user maps only the bindings in his input.conf the user intends to remap. Comment all bindings in etc/input.conf. Since this file also defines the builtin defaults and is baked into the mpv binary, we have to do something to get them anyway, even though they are commented. Do this by having input.c "uncomment" the bindings in the baked in input.conf. (Of course this is done only for the builtin config, not configs loaded from disk.) --- mpvcore/input/input.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'mpvcore') diff --git a/mpvcore/input/input.c b/mpvcore/input/input.c index 76d157afac..b89b6eecf2 100644 --- a/mpvcore/input/input.c +++ b/mpvcore/input/input.c @@ -2169,7 +2169,15 @@ struct input_ctx *mp_input_init(struct MPOpts *opts) mp_input_enable_section(ictx, NULL, 0); - parse_config(ictx, true, bstr0(builtin_input_conf), "", NULL); + // "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) { + bstr line = bstr_getline(builtin, &builtin); + bstr_eatstart0(&line, "#"); + if (!bstr_startswith0(line, " ")) + parse_config(ictx, true, line, "", NULL); + } #ifndef __MINGW32__ long ret = pipe(ictx->wakeup_pipe); -- cgit v1.2.3