From d027b2c40d9814d189152c32086a44e508d7e901 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 29 Jan 2016 00:23:13 -0800 Subject: [PATCH] starting to move keymap dependencies from mouse control --- key_events.cpp | 2 +- mouse_movement.cpp | 12 ++++++------ mouse_movement.h | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/key_events.cpp b/key_events.cpp index 23f7000b..5eef16e0 100644 --- a/key_events.cpp +++ b/key_events.cpp @@ -7,7 +7,7 @@ void handle_synthetic_key_event(byte switchState, Key mappedKey) { if (mappedKey.flags & IS_MOUSE_KEY ) { if (mappedKey.rawKey & MOUSE_WARP) { if (key_toggled_on(switchState)) { - warp_mouse(mappedKey); + warp_mouse(mappedKey.rawKey); } } else { handle_mouse_key_event(switchState, mappedKey); diff --git a/mouse_movement.cpp b/mouse_movement.cpp index df66ebf6..2088f7ee 100644 --- a/mouse_movement.cpp +++ b/mouse_movement.cpp @@ -42,13 +42,13 @@ void end_warping() { is_warping= false; } -void warp_mouse(Key quadrant) { +void warp_mouse(uint8_t quadrant) { if (is_warping == false) { begin_warping(); } - if ( quadrant.rawKey & MOUSE_END_WARP) { + if ( quadrant & MOUSE_END_WARP) { end_warping(); return; } @@ -57,16 +57,16 @@ void warp_mouse(Key quadrant) { next_width = next_width / 2; next_height = next_height/2; - if (quadrant.rawKey & MOUSE_UP) { + if (quadrant & MOUSE_UP) { // Serial.print(" - up "); - } else if (quadrant.rawKey & MOUSE_DN) { + } else if (quadrant & MOUSE_DN) { // Serial.print(" - down "); section_top = section_top + next_height; } - if (quadrant.rawKey & MOUSE_L) { + if (quadrant & MOUSE_L) { // Serial.print(" - left "); - } else if (quadrant.rawKey & MOUSE_R) { + } else if (quadrant & MOUSE_R) { // Serial.print(" - right "); section_left = section_left + next_width; } diff --git a/mouse_movement.h b/mouse_movement.h index 56d1d6c7..f9ca2233 100644 --- a/mouse_movement.h +++ b/mouse_movement.h @@ -5,13 +5,14 @@ #include "key_defs.h" #include "matrix_state.h" #include "HID-Project.h" + // Mouse-related 'public' API methods double mouse_accel (double cycles); void move_mouse( int8_t x, int8_t y); void begin_warping(); void end_warping(); -void warp_mouse(Key key); +void warp_mouse(uint8_t quadrant);