diff options
author | wm4 <wm4@nowhere> | 2019-12-07 14:53:33 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-12-07 14:53:33 +0100 |
commit | b36e8569a1ee8930701dad41a56045aabad4ec97 (patch) | |
tree | c9842b3dfce2f700dad8f0df0694b0ba7a0c10bc /video/csputils.h | |
parent | 855a4779ae64a53d04a7d8fcdc274bd8f2155831 (diff) | |
download | mpv-b36e8569a1ee8930701dad41a56045aabad4ec97.tar.bz2 mpv-b36e8569a1ee8930701dad41a56045aabad4ec97.tar.xz |
lua: make later key bindings always have higher priority
Later calls to mp.add_key_binding() should take priority over previous
calls with the same key. Until now, the order was random (due to using
table pairs() iteration order).
Do this by simply sorting by a counter that is never reset. Since
input.c also gives later bindings priority, this works out.
Calling mp.remove_key_binding() on a newer binding makes an older still
existing binding with the same key active again. New bindings override
older ones, but do not overwrite them. I think these are good semantics
for most use cases.
(Note that the Lua code cannot determine whether two bindings use the
same key. Keys are strings, and two different strings could refer to the
same key. The code does not have access to input.c's key name
normalization, so it cannot compare them.)
Diffstat (limited to 'video/csputils.h')
0 files changed, 0 insertions, 0 deletions