From 03624a174702dd72adc3043e5bb3a5d7c476570d Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 17 Feb 2014 02:35:00 +0100 Subject: input: don't let builtin bindings overwrite user bindings This was already done, except when the bindings were in different input sections. This commit fixed it. Useful for scripts, probably. --- input/input.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'input') diff --git a/input/input.c b/input/input.c index d4905112dc..510048337e 100644 --- a/input/input.c +++ b/input/input.c @@ -438,6 +438,7 @@ static struct cmd_bind *find_any_bind_for_key(struct input_ctx *ictx, return bind; } + struct cmd_bind *best_bind = NULL; for (int i = ictx->num_active_sections - 1; i >= 0; i--) { struct active_section *s = &ictx->active_sections[i]; struct cmd_bind *bind = find_bind_for_key_section(ictx, s->name, n, keys); @@ -446,13 +447,16 @@ static struct cmd_bind *find_any_bind_for_key(struct input_ctx *ictx, if (!use_mouse || (bs->mouse_area_set && test_rect(&bs->mouse_area, ictx->mouse_vo_x, ictx->mouse_vo_y))) - return bind; + { + if (!best_bind || (best_bind->is_builtin && !bind->is_builtin)) + best_bind = bind; + } } if (s->flags & MP_INPUT_EXCLUSIVE) break; } - return NULL; + return best_bind; } static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, char *force_section, -- cgit v1.2.3