From a817e01bfe2356fdd860010d46db4e4361f343a6 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Sun, 18 Dec 2022 21:20:19 +0100 Subject: Fixup utf-8 and meta handling in input --- src/keyboard.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/keyboard.h') diff --git a/src/keyboard.h b/src/keyboard.h index 4078213..18630c3 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -7,16 +7,16 @@ enum modifiers { Meta = 1 << 1, }; -// note that unicode chars are split over multiple keypresses -// TODO: make unicode chars nicer to deal with struct key { - uint8_t c; + uint8_t bytes[6]; + uint8_t nbytes; uint8_t mod; }; struct keyboard { uint32_t reactor_event_id; bool has_data; + struct key last_key; }; struct keyboard_update { @@ -31,5 +31,6 @@ struct keyboard keyboard_create(struct reactor *reactor); struct keyboard_update keyboard_update(struct keyboard *kbd, struct reactor *reactor); -bool key_equal(struct key *key, uint8_t mod, uint8_t c); +bool key_equal_char(struct key *key, uint8_t mod, uint8_t c); +bool key_equal(struct key *key1, struct key *key2); void key_name(struct key *key, char *buf, size_t capacity); -- cgit v1.2.3