diff options
author | Alex Auvolat <alex@adnab.me> | 2016-07-15 23:12:14 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2016-07-15 23:12:14 +0200 |
commit | 32407e728971006ed3d0885e01c22fb66c8adc57 (patch) | |
tree | 89483d39e8e2638383f815d4e73b647334fe2fe9 /src/lib/include/kogata/keyboard.h | |
parent | ba4e59a1d687173ac5cfa74d26d71d6059dc6bc6 (diff) | |
download | kogata-32407e728971006ed3d0885e01c22fb66c8adc57.tar.gz kogata-32407e728971006ed3d0885e01c22fb66c8adc57.zip |
Move stuff around, again
Diffstat (limited to 'src/lib/include/kogata/keyboard.h')
-rw-r--r-- | src/lib/include/kogata/keyboard.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/lib/include/kogata/keyboard.h b/src/lib/include/kogata/keyboard.h new file mode 100644 index 0000000..63c6c2c --- /dev/null +++ b/src/lib/include/kogata/keyboard.h @@ -0,0 +1,39 @@ +#pragma once + +#include <proto/keyboard.h> + +#include <proto/keymap_file.h> + +#define KBD_CHAR 0x01 +#define KBD_ALT 0x02 +#define KBD_CTRL 0x04 +#define KBD_SUPER 0x08 +#define KBD_SHIFT 0x10 +#define KBD_CAPS 0x20 +#define KBD_MOD 0x40 + +typedef struct { + union { + int chr; // if flags & KBD_CHAR, chr is a character number + int key; // if !(flags & KBD_CHAR), key is one of KBD_CODE_* defined in <proto/keyboard.h> + }; + uint32_t flags; // one of kbd_* +} key_t; + +typedef struct { + keymap_t km; + int key_char[256]; + uint32_t status; // mask of alt/ctrl/super +} keyboard_t; + +keyboard_t *init_keyboard(); +void free_keyboard(keyboard_t *t); + +bool load_keymap(keyboard_t *kb, const char* kmname); + +key_t keyboard_press(keyboard_t *t, int scancode); // what key is pressed? +key_t keyboard_release(keyboard_t *t, int scancode); // what key is released? + + + +/* vim: set ts=4 sw=4 tw=0 noet :*/ |