diff options
author | wm4 <wm4@nowhere> | 2014-02-17 02:35:00 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-02-17 02:52:58 +0100 |
commit | 03624a174702dd72adc3043e5bb3a5d7c476570d (patch) | |
tree | c4d4ba6d966d7cb5e9f530d49530a71e312eb408 /input | |
parent | 75d3267b43093161f94db5199bd36f14c06b7457 (diff) |
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.
Diffstat (limited to 'input')
-rw-r--r-- | input/input.c | 8 |
1 files changed, 6 insertions, 2 deletions
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, |