From 451b133e3ab57438d42e75e877fd0f71c5ea0c0f Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 29 Jan 2016 16:19:11 -0800 Subject: [PATCH] Standardize mouse movement constants to LEFT RIGHT and DOWN rather than L R and DN. (UP was already ok) --- key_defs.h | 28 ++++++++++++++-------------- key_events.cpp | 10 +++++----- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/key_defs.h b/key_defs.h index 8df6f577..f578f7ec 100644 --- a/key_defs.h +++ b/key_defs.h @@ -32,9 +32,9 @@ typedef struct { #define MOUSE_UP B0000001 -#define MOUSE_DN B0000010 -#define MOUSE_L B0000100 -#define MOUSE_R B0001000 +#define MOUSE_DOWN B0000010 +#define MOUSE_LEFT B0000100 +#define MOUSE_RIGHT B0001000 #define MOUSE_CENTER B0010000 #define MOUSE_WARP B0100000 #define MOUSE_WARP_END B1000000 @@ -60,22 +60,22 @@ typedef struct { #define Key_macroKey1 (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MACRO, 1} -#define Key_mouseWarpNW (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_WARP| MOUSE_UP | MOUSE_L } -#define Key_mouseWarpNE (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_WARP| MOUSE_UP | MOUSE_R } -#define Key_mouseWarpSW (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_WARP| MOUSE_DN | MOUSE_L } -#define Key_mouseWarpSE (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_WARP| MOUSE_DN | MOUSE_R } +#define Key_mouseWarpNW (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_WARP| MOUSE_UP | MOUSE_LEFT } +#define Key_mouseWarpNE (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_WARP| MOUSE_UP | MOUSE_RIGHT } +#define Key_mouseWarpSW (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_WARP| MOUSE_DOWN | MOUSE_LEFT } +#define Key_mouseWarpSE (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_WARP| MOUSE_DOWN | MOUSE_RIGHT } #define Key_mouseWarpEnd (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_WARP| MOUSE_WARP_END} -#define Key_mouseUpL (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_UP | MOUSE_L } +#define Key_mouseUpL (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_UP | MOUSE_LEFT } #define Key_mouseUp (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_UP } -#define Key_mouseUpR (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_UP | MOUSE_R } -#define Key_mouseL (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_L } -#define Key_mouseR (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_R } -#define Key_mouseDnL (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_DN | MOUSE_L } -#define Key_mouseDn (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_DN } -#define Key_mouseDnR (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_DN | MOUSE_R } +#define Key_mouseUpR (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_UP | MOUSE_RIGHT } +#define Key_mouseL (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_LEFT } +#define Key_mouseR (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_RIGHT } +#define Key_mouseDnL (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_DOWN | MOUSE_LEFT } +#define Key_mouseDn (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_DOWN } +#define Key_mouseDnR (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, MOUSE_DOWN | MOUSE_RIGHT } #define Key_mouseScrollUp #define Key_mouseScrollDn #define Key_mouseScrollL diff --git a/key_events.cpp b/key_events.cpp index d454b217..7e0e5e73 100644 --- a/key_events.cpp +++ b/key_events.cpp @@ -10,8 +10,8 @@ void handle_synthetic_key_event(byte switchState, Key mappedKey) { // we don't pass in the left and up values because those are the // default, "no-op" conditionals warp_mouse( (mappedKey.rawKey & MOUSE_WARP_END ? WARP_END : 0x00) | - (mappedKey.rawKey & MOUSE_DN ? WARP_DOWN : 0x00) | - (mappedKey.rawKey & MOUSE_R ? WARP_RIGHT : 0x00) ); + (mappedKey.rawKey & MOUSE_DOWN ? WARP_DOWN : 0x00) | + (mappedKey.rawKey & MOUSE_RIGHT ? WARP_RIGHT : 0x00) ); } } else { handle_mouse_key_event(switchState, mappedKey); @@ -116,13 +116,13 @@ void handle_mouse_key_event(byte switchState, Key mappedKey) { if (mappedKey.rawKey & MOUSE_UP) { move_mouse(0,-1); } - if (mappedKey.rawKey & MOUSE_DN) { + if (mappedKey.rawKey & MOUSE_DOWN) { move_mouse(0,1); } - if (mappedKey.rawKey & MOUSE_L) { + if (mappedKey.rawKey & MOUSE_LEFT) { move_mouse(-1,0); } - if (mappedKey.rawKey & MOUSE_R) { + if (mappedKey.rawKey & MOUSE_RIGHT) { move_mouse(1,0); } }