summaryrefslogtreecommitdiffstats
path: root/input/keycodes.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-21 22:22:45 +0100
committerwm4 <wm4@nowhere>2019-11-22 01:15:08 +0100
commit0a6c09b96f17fa0247d3fe53ff396f61e5868d0c (patch)
tree576a79e4afd76d1c828d847eae62b936e598d883 /input/keycodes.c
parenta098e981983bc38c916ec8c61fcde24f98dde1ab (diff)
downloadmpv-0a6c09b96f17fa0247d3fe53ff396f61e5868d0c.tar.bz2
mpv-0a6c09b96f17fa0247d3fe53ff396f61e5868d0c.tar.xz
input: introduce a pseudo key name that grabs all text input
The intended target for this is the mpv.repl script, which manually added every single ASCII key as a separate key binding. This provides a simpler mechanism, that will catch any kind of text input. Due to its special nature, explicitly do not give a guarantee for compatibility; thus the warning in input.rst.
Diffstat (limited to 'input/keycodes.c')
-rw-r--r--input/keycodes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/input/keycodes.c b/input/keycodes.c
index a03f07e59a..3d7fd09d11 100644
--- a/input/keycodes.c
+++ b/input/keycodes.c
@@ -208,6 +208,7 @@ static const struct key_name key_names[] = {
{ MP_KEY_MOUSE_ENTER, "MOUSE_ENTER" },
{ MP_KEY_UNMAPPED, "UNMAPPED" },
+ { MP_KEY_ANY_UNICODE, "ANY_UNICODE" },
{ 0, NULL }
};
@@ -271,8 +272,7 @@ static void mp_input_append_key_name(bstr *buf, int key)
}
}
- // printable, and valid unicode range
- if (key >= 32 && key <= 0x10FFFF) {
+ if (MP_KEY_IS_UNICODE(key)) {
mp_append_utf8_bstr(NULL, buf, key);
return;
}