summaryrefslogtreecommitdiffstats
path: root/mp_fifo.c
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-01-14 14:09:26 +0100
committerwm4 <wm4@mplayer2.org>2012-01-18 04:11:48 +0100
commita63e880400c7c840858e499a18735c6e1f8248fe (patch)
treed01de78890c2b0432fd622a5b73f27e07a748312 /mp_fifo.c
parent7700e6effca6358820cb969ddf896a2be4b77ede (diff)
downloadmpv-a63e880400c7c840858e499a18735c6e1f8248fe.tar.bz2
mpv-a63e880400c7c840858e499a18735c6e1f8248fe.tar.xz
input: allow unicode keys and reassign internal key codes
This moves all key codes above the highest valid unicode code point (which is 0x10FFFF). All key codes below MP_KEY_BASE now directly map to unicode. Configuration files (input.conf) can contain unicode characters in UTF-8 to map non-ASCII characters/keys. This shouldn't change anything user visible, except that "direct key codes" (as used in input.conf) will change their meaning.
Diffstat (limited to 'mp_fifo.c')
-rw-r--r--mp_fifo.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mp_fifo.c b/mp_fifo.c
index ffb3608fbf..701b7a0bc3 100644
--- a/mp_fifo.c
+++ b/mp_fifo.c
@@ -67,3 +67,13 @@ void mplayer_put_key(struct mp_fifo *fifo, int code)
fifo->last_down_time = now;
}
}
+
+void mplayer_put_key_utf8(struct mp_fifo *fifo, int mods, struct bstr t)
+{
+ while (t.len) {
+ int code = bstr_decode_utf8(t, &t);
+ if (code < 0)
+ break;
+ mplayer_put_key(fifo, code | mods);
+ }
+}