blob: e0d7df03d1aa13ac58448e99aeb6dbd2ec8c5e10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#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__ **/
|