-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapper_unix.cpp
53 lines (48 loc) · 859 Bytes
/
mapper_unix.cpp
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
#ifdef __linux__ // and X11
#include "mapper.hpp"
#include <X11/Xlib.h>
#include <X11/keysym.h>
namespace Input {
static long mouseTable[] = {
Button1, // left
Button2, // middle
Button3, // right
};
static long keyTable[] = {
XK_A,
XK_B,
XK_C,
XK_D,
XK_E,
XK_F,
XK_G,
XK_H,
XK_I,
XK_J,
XK_K,
XK_L,
XK_M,
XK_N,
XK_O,
XK_P,
XK_Q,
XK_R,
XK_S,
XK_T,
XK_U,
XK_V,
XK_W,
XK_X,
XK_Y,
XK_Z,
};
long mapMouseButton(MouseButton mouseBtn)
{
return mouseTable[static_cast<int>(mouseBtn)];
}
unsigned long mapKey(KeyType key)
{
return keyTable[static_cast<int>(key)];
}
};
#endif