#ifndef __INPUT_H__ #define __INPUT_H__ #include "linux/input.h" #include "types33.h" //#define MAX_INPUT_EVENTS 32 //#define INPUT_BUFFLEN 32 #define _KBBUFF_LEN 32 /* must be ^2 */ #define _MAX_DEVS 8 //#define KEYBOARD 0x01 //#define MOUSE 0x02 #define _RELEASE 0x00 #define _PRESS 0x01 #define _REPEAT 0x02 #define _SCROLLL 0x01 #define _NUML 0x02 #define _CAPSL 0x04 /* TODO move these */ #define _CAN_CAPSL 0x0B #define KEYDOWN(K) (__input.keyStates[K] >= _PRESS) #define KEYUP(K) (__input.keyStates[K] == _RELEASE) #define KEYREP(K) (__input.keyStates[K] == _REPEAT) #define MOUSE1 (__input.keyStates[BTN_LEFT] == 1) #define MOUSE2 (__input.keyStates[BTN_RIGHT] == 1) #define MOUSE3 (__input.keyStates[BTN_MIDDLE] == 1) #define MOUSEX (__input.relStates[REL_X]) #define MOUSEY (__input.relStates[REL_Y]) #define SCROLLW (__input.relStates[REL_WHEEL]) typedef struct { int devices[ _MAX_DEVS ]; Size deviceCount; Bitfield cnsFlags; /* [0x7] :: Caps Num Scrl */ Bitfield modFlags; /* [0x1FF] :: CS AR AL SR SL A C AGr S */ int keyStates[ KEY_MAX ]; int relStates[ REL_MAX ]; __u16 buffer[ _KBBUFF_LEN ]; Size head, tail; } Input33; extern Input33 __input; Error input33_init( void ); void input33_poll( void ); void input33_term( void ); #endif /** __INPUT_H__ **/