move handle_mouse_key_event next to other key event handling

pull/18/head
Jesse Vincent 9 years ago
parent 605f0039ea
commit 5d7139c8f0

@ -44,6 +44,7 @@ void handle_synthetic_key_event(byte switchState, Key mappedKey);
void handle_key_event(byte row, byte col); void handle_key_event(byte row, byte col);
void press_key(Key mappedKey); void press_key(Key mappedKey);
void handle_keymap_key_event(byte switchState, Key keymapEntry); void handle_keymap_key_event(byte switchState, Key keymapEntry);
void handle_mouse_key_event(byte switchState, Key mappedKey);
#ifndef VERSION #ifndef VERSION
#define VERSION "locally-built" #define VERSION "locally-built"

@ -58,7 +58,7 @@ void handle_synthetic_key_event(byte switchState, Key mappedKey) {
warp_mouse(mappedKey); warp_mouse(mappedKey);
} }
} else { } else {
handle_mouse_key_press(switchState, mappedKey); handle_mouse_key_event(switchState, mappedKey);
} }
} }
if (mappedKey.flags & IS_CONSUMER) { if (mappedKey.flags & IS_CONSUMER) {
@ -156,3 +156,21 @@ void handle_keymap_key_event(byte switchState, Key keymapEntry) {
} }
} }
} }
void handle_mouse_key_event(byte switchState, Key mappedKey) {
if (key_is_pressed(switchState)) {
if (mappedKey.rawKey & MOUSE_UP) {
move_mouse(0,-1);
}
if (mappedKey.rawKey & MOUSE_DN) {
move_mouse(0,1);
}
if (mappedKey.rawKey & MOUSE_L) {
move_mouse(-1,0);
}
if (mappedKey.rawKey & MOUSE_R) {
move_mouse(1,0);
}
}
}

@ -121,21 +121,3 @@ void move_mouse( int8_t x, int8_t y) {
} }
void handle_mouse_key_press(byte switchState, Key mappedKey) {
if (key_is_pressed(switchState)) {
if (mappedKey.rawKey & MOUSE_UP) {
move_mouse(0,-1);
}
if (mappedKey.rawKey & MOUSE_DN) {
move_mouse(0,1);
}
if (mappedKey.rawKey & MOUSE_L) {
move_mouse(-1,0);
}
if (mappedKey.rawKey & MOUSE_R) {
move_mouse(1,0);
}
}
}

@ -4,7 +4,6 @@
// Mouse-related 'public' API methods // Mouse-related 'public' API methods
double mouse_accel (double cycles); double mouse_accel (double cycles);
void handle_mouse_key_press(byte switchState, Key mappedKey);
void move_mouse( int8_t x, int8_t y); void move_mouse( int8_t x, int8_t y);
void begin_warping(); void begin_warping();
void end_warping(); void end_warping();

Loading…
Cancel
Save