From 637bb7652ad73c8cf6338ea1e3d825ed8a8d43c5 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 31 Jan 2016 22:38:00 -0800 Subject: [PATCH] We'd broken LED toggling (non-mouse IS_INTERNAL keys) --- key_defs.h | 14 ++++++++++---- key_events.cpp | 5 +++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/key_defs.h b/key_defs.h index 00ce7be9..39481406 100644 --- a/key_defs.h +++ b/key_defs.h @@ -28,7 +28,16 @@ typedef struct { // IS_INTERNAL key table: -#define LED_TOGGLE 1 +#define LED_TOGGLE 0x01 // Synthetic, internal + + +// Synthetic, not internal +#define KEY_MOUSE_BTN_L 0x01 // Synthetic key +#define KEY_MOUSE_BTN_M 0x04 // Synthetic key +#define KEY_MOUSE_BTN_R 0x02 // Synthetic key + + + #define KEY_MOUSE_UP B0000001 @@ -80,9 +89,6 @@ typedef struct { #define Key_mouseScrollDn #define Key_mouseScrollL #define Key_mouseScrollR -#define KEY_MOUSE_BTN_L 0x01 // Synthetic key -#define KEY_MOUSE_BTN_M 0x04 // Synthetic key -#define KEY_MOUSE_BTN_R 0x02 // Synthetic key #define Key_mouseBtnL (Key){ KEY_FLAGS | SYNTHETIC_KEY, KEY_MOUSE_BTN_L } #define Key_mouseBtnM (Key){ KEY_FLAGS | SYNTHETIC_KEY , KEY_MOUSE_BTN_M } #define Key_mouseBtnR (Key){ KEY_FLAGS | SYNTHETIC_KEY, KEY_MOUSE_BTN_R } diff --git a/key_events.cpp b/key_events.cpp index fecafd3d..3236b72a 100644 --- a/key_events.cpp +++ b/key_events.cpp @@ -3,9 +3,10 @@ void handle_synthetic_key_event(byte switchState, Key mappedKey) { if (mappedKey.flags & IS_MOUSE_KEY && !( mappedKey.rawKey & KEY_MOUSE_WARP) ) { handle_mouse_key_event(switchState, mappedKey); - } else if (mappedKey.rawKey == KEY_MOUSE_BTN_L + } else if (! (mappedKey.flags & IS_INTERNAL) + && (mappedKey.rawKey == KEY_MOUSE_BTN_L || mappedKey.rawKey == KEY_MOUSE_BTN_M - || mappedKey.rawKey == KEY_MOUSE_BTN_R) { + || mappedKey.rawKey == KEY_MOUSE_BTN_R)) { if (key_toggled_on (switchState)) { MouseWrapper.press_button( (mappedKey.rawKey == KEY_MOUSE_BTN_L ? KEY_MOUSE_BUTTON_LEFT : 0x00) |