summaryrefslogtreecommitdiff
path: root/src/keyboard.h
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2022-12-18 21:20:19 +0100
committerAlbert Cervin <albert@acervin.com>2022-12-18 21:20:19 +0100
commita817e01bfe2356fdd860010d46db4e4361f343a6 (patch)
treef6e34056d236b1df6e6a62573d4f9adf602b0dc7 /src/keyboard.h
parent3deb7c91056779d1f1b2be112e727bc9999ac21d (diff)
downloaddged-a817e01bfe2356fdd860010d46db4e4361f343a6.tar.gz
dged-a817e01bfe2356fdd860010d46db4e4361f343a6.tar.xz
dged-a817e01bfe2356fdd860010d46db4e4361f343a6.zip
Fixup utf-8 and meta handling in input
Diffstat (limited to 'src/keyboard.h')
-rw-r--r--src/keyboard.h9
1 files changed, 5 insertions, 4 deletions
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);