|
@@ -15,6 +15,9 @@ bool slop::Keyboard::getKey( KeySym key ) {
|
15
|
15
|
}
|
16
|
16
|
}
|
17
|
17
|
|
|
18
|
+// This returns if a key is currently pressed.
|
|
19
|
+// Ignores arrow key presses specifically so users can
|
|
20
|
+// adjust their selection.
|
18
|
21
|
bool slop::Keyboard::anyKeyDown() {
|
19
|
22
|
return keyDown;
|
20
|
23
|
}
|
|
@@ -22,6 +25,16 @@ bool slop::Keyboard::anyKeyDown() {
|
22
|
25
|
void slop::Keyboard::update() {
|
23
|
26
|
char keys[32];
|
24
|
27
|
XQueryKeymap( x11->display, keys );
|
|
28
|
+ // We first delete the arrow key buttons from the mapping.
|
|
29
|
+ // This allows the user to press the arrow keys without triggering anyKeyDown
|
|
30
|
+ KeyCode keycode = XKeysymToKeycode( x11->display, XK_Left );
|
|
31
|
+ keys[ keycode / 8 ] = keys[ keycode / 8 ] & ~( 1 << ( keycode % 8 ) );
|
|
32
|
+ keycode = XKeysymToKeycode( x11->display, XK_Right );
|
|
33
|
+ keys[ keycode / 8 ] = keys[ keycode / 8 ] & ~( 1 << ( keycode % 8 ) );
|
|
34
|
+ keycode = XKeysymToKeycode( x11->display, XK_Up );
|
|
35
|
+ keys[ keycode / 8 ] = keys[ keycode / 8 ] & ~( 1 << ( keycode % 8 ) );
|
|
36
|
+ keycode = XKeysymToKeycode( x11->display, XK_Down );
|
|
37
|
+ keys[ keycode / 8 ] = keys[ keycode / 8 ] & ~( 1 << ( keycode % 8 ) );
|
25
|
38
|
keyDown = false;
|
26
|
39
|
for ( int i=0;i<32;i++ ) {
|
27
|
40
|
if ( deltaState[i] == keys[i] ) {
|