From addc341184c4c36a875b2a24ea8888aeec3f92fa Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 24 Sep 2021 16:12:12 -0700 Subject: [PATCH] Bullet-proofing against the mouse button constants not being defined --- .../plugin/MouseKeys/MouseKeyDefs.h | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys/MouseKeyDefs.h b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys/MouseKeyDefs.h index f35aa4ba..46ac2c88 100644 --- a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys/MouseKeyDefs.h +++ b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys/MouseKeyDefs.h @@ -19,11 +19,6 @@ #define IS_MOUSE_KEY 0b00010000 // Synthetic, not internal -#define KEY_MOUSE_BTN_L MOUSE_LEFT // Synthetic key -#define KEY_MOUSE_BTN_M MOUSE_MIDDLE // Synthetic key -#define KEY_MOUSE_BTN_R MOUSE_RIGHT // Synthetic key -#define KEY_MOUSE_BTN_P MOUSE_PREV -#define KEY_MOUSE_BTN_N MOUSE_NEXT #define KEY_MOUSE_UP 0b0000001 #define KEY_MOUSE_DOWN 0b0000010 @@ -60,8 +55,31 @@ #define Key_mouseScrollDn Key(KEY_MOUSE_WHEEL | KEY_MOUSE_DOWN, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) #define Key_mouseScrollL Key(KEY_MOUSE_WHEEL | KEY_MOUSE_LEFT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) #define Key_mouseScrollR Key(KEY_MOUSE_WHEEL | KEY_MOUSE_RIGHT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) + + +// The MOUSE_xxx button definitions come from our HID driver +// If the HID driver doesn't define them, don't blow up compilation + +#ifdef MOUSE_LEFT + +#define KEY_MOUSE_BTN_L MOUSE_LEFT // Synthetic key +#define KEY_MOUSE_BTN_M MOUSE_MIDDLE // Synthetic key +#define KEY_MOUSE_BTN_R MOUSE_RIGHT // Synthetic key +#define KEY_MOUSE_BTN_P MOUSE_PREV +#define KEY_MOUSE_BTN_N MOUSE_NEXT #define Key_mouseBtnL Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_L, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) #define Key_mouseBtnM Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_M, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) #define Key_mouseBtnR Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_R, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) #define Key_mouseBtnP Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_P, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) #define Key_mouseBtnN Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_N, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) + +#else + +#define Key_mouseBtnL XXX +#define Key_mouseBtnM XXX +#define Key_mouseBtnR XXX +#define Key_mouseBtnP XXX +#define Key_mouseBtnN XXX + + +#endif