| #ifndef INPUT_H |
| #define INPUT_H |
| |
| |
| #include "common.h" |
| |
| |
| #define IN_MAXKEYS 256 |
| |
| enum { |
| IM_SHIFT, |
| IM_CAPSLOCK, |
| IM_SHIFTLOCK, |
| IM_NUMLOCK, |
| IM_GROUP, |
| IM_SCRLOCK, |
| IM_COUNT }; |
| |
| enum { |
| IM_SHIFT_BIT = 1 << IM_SHIFT, |
| IM_CAPSLOCK_BIT = 1 << IM_CAPSLOCK, |
| IM_SHIFTLOCK_BIT = 1 << IM_SHIFTLOCK, |
| IM_NUMLOCK_BIT = 1 << IM_NUMLOCK, |
| IM_GROUP_BIT = 1 << IM_GROUP, |
| IM_SCRLOCK_BIT = 1 << IM_SCRLOCK }; |
| |
| |
| typedef struct Input { |
| App *app; |
| int key0, key1; |
| unsigned int keys[IN_MAXKEYS][1 << IM_COUNT]; |
| unsigned int masks[IM_COUNT]; |
| |
| int mapKey; |
| int mapDown; |
| unsigned int modifiers; |
| } Input; |
| |
| |
| void inputPrepareKeysyms(unsigned int *ks0, unsigned int *ks1, int *isLetter, int *isKeypad); |
| int inputChooseKeysym(unsigned int modifiers, unsigned int ks0, unsigned int ks1, int isLetter, int isKeypad); |
| |
| int inputInit(Input *in, App *app); |
| void inputDeinit(Input *in); |
| void inputUpdateLayout(Input *in, int key0, int key1); |
| void inputUpdateModifiers(Input *in); |
| int inputKeycode(Input *in, unsigned int keySym); |
| void inputEvent(Input *in, int keycode, int press); |
| |
| |
| |
| #endif |