summaryrefslogtreecommitdiffstats
path: root/input/keycodes.h
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.h
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.h')
-rw-r--r--input/keycodes.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/input/keycodes.h b/input/keycodes.h
index 12b45e528a..7385440851 100644
--- a/input/keycodes.h
+++ b/input/keycodes.h
@@ -22,6 +22,10 @@
// Special keys come after this.
#define MP_KEY_BASE (1<<21)
+// printable, and valid unicode range (we don't care too much about whether
+// certain sub-ranges are reserved and disallowed, like surrogate pairs)
+#define MP_KEY_IS_UNICODE(key) ((key) >= 32 && (key) <= 0x10FFFF)
+
#define MP_KEY_ENTER 13
#define MP_KEY_TAB 9
@@ -210,7 +214,8 @@
(MP_KEY_IS_MOUSE_CLICK(code) || MP_KEY_IS_MOUSE_MOVE(code))
// No input source should generate this.
-#define MP_KEY_UNMAPPED (MP_KEY_INTERN+4)
+#define MP_KEY_UNMAPPED (MP_KEY_INTERN+4)
+#define MP_KEY_ANY_UNICODE (MP_KEY_INTERN+5)
// Emit a command even on key-up (normally key-up is ignored). This means by
// default they binding will be triggered on key-up instead of key-down.