diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2014-10-03 12:50:41 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2014-10-03 15:57:00 +0200 |
commit | f8958c3495edf6d1563a5309e84bd68931a46213 (patch) | |
tree | 96143427eb166ddb8221e44963b5a60bc88adba7 /src/libsystemd-terminal/term.h | |
parent | fe741a85c1912ead26c1a78251e1d490a8a432b3 (diff) |
terminal/screen: add keyboard mapping
Implement the feed_keyboard() handling by mapping XKB keys according to
DEC-VT behavior.
Public information on terminal key-mappings is pretty scarce. We only
implement the most basic mapping for now. Further improvements welcome!
Diffstat (limited to 'src/libsystemd-terminal/term.h')
-rw-r--r-- | src/libsystemd-terminal/term.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/libsystemd-terminal/term.h b/src/libsystemd-terminal/term.h index a3ca252e31..5228ce0601 100644 --- a/src/libsystemd-terminal/term.h +++ b/src/libsystemd-terminal/term.h @@ -128,6 +128,21 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(term_parser*, term_parser_free); * Screens */ +enum { + TERM_KBDMOD_IDX_SHIFT, + TERM_KBDMOD_IDX_CTRL, + TERM_KBDMOD_IDX_ALT, + TERM_KBDMOD_IDX_LINUX, + TERM_KBDMOD_IDX_CAPS, + TERM_KBDMOD_CNT, + + TERM_KBDMOD_SHIFT = 1 << TERM_KBDMOD_IDX_SHIFT, + TERM_KBDMOD_CTRL = 1 << TERM_KBDMOD_IDX_CTRL, + TERM_KBDMOD_ALT = 1 << TERM_KBDMOD_IDX_ALT, + TERM_KBDMOD_LINUX = 1 << TERM_KBDMOD_IDX_LINUX, + TERM_KBDMOD_CAPS = 1 << TERM_KBDMOD_IDX_CAPS, +}; + typedef int (*term_screen_write_fn) (term_screen *screen, void *userdata, const void *buf, size_t size); typedef int (*term_screen_cmd_fn) (term_screen *screen, void *userdata, unsigned int cmd, const term_seq *seq); @@ -141,7 +156,12 @@ unsigned int term_screen_get_width(term_screen *screen); unsigned int term_screen_get_height(term_screen *screen); int term_screen_feed_text(term_screen *screen, const uint8_t *in, size_t size); -int term_screen_feed_keyboard(term_screen *screen, uint32_t keysym, uint32_t ascii, uint32_t ucs4, unsigned int mods); +int term_screen_feed_keyboard(term_screen *screen, + const uint32_t *keysyms, + size_t n_syms, + uint32_t ascii, + const uint32_t *ucs4, + unsigned int mods); int term_screen_resize(term_screen *screen, unsigned int width, unsigned int height); void term_screen_soft_reset(term_screen *screen); void term_screen_hard_reset(term_screen *screen); |