summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-25 22:09:20 +0100
committerwm4 <wm4@nowhere>2014-02-25 22:09:20 +0100
commit70ff543029068188a3de39a80a764267c6671e7c (patch)
treef5012ae8ff3b5e626ee8a3f123a51fa3ffa6ff8b
parenta85ff44511deb04a1f844a4dd8a2b85b509ba0d1 (diff)
downloadmpv-70ff543029068188a3de39a80a764267c6671e7c.tar.bz2
mpv-70ff543029068188a3de39a80a764267c6671e7c.tar.xz
input: allow input.conf bindings to be declared as builtin
This might be helpful if we ever want cascading config files. Also, we will probably need it if we change the default input.conf bindings, and want to provide compatibility input.conf files.
-rw-r--r--etc/input.conf3
-rw-r--r--input/input.c11
2 files changed, 14 insertions, 0 deletions
diff --git a/etc/input.conf b/etc/input.conf
index fa0db45e28..943050eb75 100644
--- a/etc/input.conf
+++ b/etc/input.conf
@@ -39,6 +39,9 @@
# file, if unedited, doesn't define any bindings).
# Lines that have a space after the '#' are always ignored as real comments.
+# If this is enabled, treat all the following bindings as default.
+#default-bindings start
+
#MOUSE_BTN0 ignore # don't do anything
#MOUSE_BTN0_DBL cycle fullscreen # toggle fullscreen on/off
#MOUSE_BTN2 cycle pause # toggle pause on/off
diff --git a/input/input.c b/input/input.c
index 9061f2008a..cc36020af7 100644
--- a/input/input.c
+++ b/input/input.c
@@ -1386,6 +1386,17 @@ static int parse_config(struct input_ctx *ictx, bool builtin, bstr data,
line = bstr_lstrip(line);
if (line.len == 0 || bstr_startswith0(line, "#"))
continue;
+ if (bstr_eatstart0(&line, "default-bindings ")) {
+ bstr orig = line;
+ bstr_split_tok(line, "#", &line, &(bstr){0});
+ line = bstr_strip(line);
+ if (bstr_equals0(line, "start")) {
+ builtin = true;
+ } else {
+ MP_ERR(ictx, "Broken line: %.*s at %s\n", BSTR_P(orig), cur_loc);
+ }
+ continue;
+ }
struct bstr command;
// Find the key name starting a line
struct bstr keyname = bstr_split(line, WHITESPACE, &command);