A previous commit that switched to longer name for MOUSE_ constants conflicted with internal compiler macros inside our HID library.

pull/18/head
Jesse Vincent 9 years ago
parent f2222c8dbd
commit 27cb42eade

@ -5,9 +5,9 @@
// Buttons
#define MOUSE_BUTTON_LEFT 0x01
#define MOUSE_BUTTON_MIDDLE 0x02
#define MOUSE_BUTTON_RIGHT 0x04
#define KEY_MOUSE_BUTTON_LEFT 0x01
#define KEY_MOUSE_BUTTON_MIDDLE 0x02
#define KEY_MOUSE_BUTTON_RIGHT 0x04
// Warping commands

@ -31,13 +31,13 @@ typedef struct {
#define LED_TOGGLE 1
#define MOUSE_UP B0000001
#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
#define KEY_MOUSE_UP B0000001
#define KEY_MOUSE_DOWN B0000010
#define KEY_MOUSE_LEFT B0000100
#define KEY_MOUSE_RIGHT B0001000
#define KEY_MOUSE_CENTER B0010000
#define KEY_MOUSE_WARP B0100000
#define KEY_MOUSE_WARP_END B1000000
#define KEYMAP_0 0
#define KEYMAP_1 1
@ -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_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_mouseWarpNW (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_WARP| KEY_MOUSE_UP | KEY_MOUSE_LEFT }
#define Key_mouseWarpNE (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_WARP| KEY_MOUSE_UP | KEY_MOUSE_RIGHT }
#define Key_mouseWarpSW (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_WARP| KEY_MOUSE_DOWN | KEY_MOUSE_LEFT }
#define Key_mouseWarpSE (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_WARP| KEY_MOUSE_DOWN | KEY_MOUSE_RIGHT }
#define Key_mouseWarpEnd (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_WARP| KEY_MOUSE_WARP_END}
#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_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_mouseUpL (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_UP | KEY_MOUSE_LEFT }
#define Key_mouseUp (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_UP }
#define Key_mouseUpR (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_UP | KEY_MOUSE_RIGHT }
#define Key_mouseL (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_LEFT }
#define Key_mouseR (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_RIGHT }
#define Key_mouseDnL (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_DOWN | KEY_MOUSE_LEFT }
#define Key_mouseDn (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_DOWN }
#define Key_mouseDnR (Key){ KEY_FLAGS|SYNTHETIC_KEY|IS_MOUSE_KEY, KEY_MOUSE_DOWN | KEY_MOUSE_RIGHT }
#define Key_mouseScrollUp
#define Key_mouseScrollDn
#define Key_mouseScrollL

@ -1,33 +1,32 @@
#include "key_events.h"
void handle_synthetic_key_event(byte switchState, Key mappedKey) {
if (mappedKey.flags & IS_MOUSE_KEY && !( mappedKey.rawKey & MOUSE_WARP) ) {
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
|| mappedKey.rawKey == KEY_MOUSE_BTN_M
|| mappedKey.rawKey == KEY_MOUSE_BTN_R) {
if (key_toggled_on (switchState)) {
MouseWrapper.press_button(
(mappedKey.rawKey == KEY_MOUSE_BTN_L ? MOUSE_BUTTON_LEFT : 0x00) |
(mappedKey.rawKey == KEY_MOUSE_BTN_M ? MOUSE_BUTTON_MIDDLE : 0x00) |
(mappedKey.rawKey == KEY_MOUSE_BTN_R ? MOUSE_BUTTON_RIGHT : 0x00) );
(mappedKey.rawKey == KEY_MOUSE_BTN_L ? KEY_MOUSE_BUTTON_LEFT : 0x00) |
(mappedKey.rawKey == KEY_MOUSE_BTN_M ? KEY_MOUSE_BUTTON_MIDDLE : 0x00) |
(mappedKey.rawKey == KEY_MOUSE_BTN_R ? KEY_MOUSE_BUTTON_RIGHT : 0x00) );
} else if (key_toggled_off(switchState)) {
MouseWrapper.release_button(
(mappedKey.rawKey == KEY_MOUSE_BTN_L ? MOUSE_BUTTON_LEFT : 0x00) |
(mappedKey.rawKey == KEY_MOUSE_BTN_M ? MOUSE_BUTTON_MIDDLE : 0x00) |
(mappedKey.rawKey == KEY_MOUSE_BTN_R ? MOUSE_BUTTON_RIGHT : 0x00) );
(mappedKey.rawKey == KEY_MOUSE_BTN_L ? KEY_MOUSE_BUTTON_LEFT : 0x00) |
(mappedKey.rawKey == KEY_MOUSE_BTN_M ? KEY_MOUSE_BUTTON_MIDDLE : 0x00) |
(mappedKey.rawKey == KEY_MOUSE_BTN_R ? KEY_MOUSE_BUTTON_RIGHT : 0x00) );
}
}
else if (key_toggled_on(switchState)) {
if (mappedKey.rawKey & MOUSE_WARP && mappedKey.flags & IS_MOUSE_KEY) {
if (mappedKey.rawKey & KEY_MOUSE_WARP && mappedKey.flags & IS_MOUSE_KEY) {
// we don't pass in the left and up values because those are the
// default, "no-op" conditionals
MouseWrapper.warp( (mappedKey.rawKey & MOUSE_WARP_END ? WARP_END : 0x00) |
(mappedKey.rawKey & MOUSE_DOWN ? WARP_DOWN : 0x00) |
(mappedKey.rawKey & MOUSE_RIGHT ? WARP_RIGHT : 0x00) );
MouseWrapper.warp( (mappedKey.rawKey & KEY_MOUSE_WARP_END ? WARP_END : 0x00) |
(mappedKey.rawKey & KEY_MOUSE_DOWN ? WARP_DOWN : 0x00) |
(mappedKey.rawKey & KEY_MOUSE_RIGHT ? WARP_RIGHT : 0x00) );
} else if (mappedKey.flags & IS_CONSUMER) {
ConsumerControl.press(mappedKey.rawKey);
} else if (mappedKey.flags & IS_INTERNAL) {
@ -102,16 +101,16 @@ 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) {
if (mappedKey.rawKey & KEY_MOUSE_UP) {
MouseWrapper.move(0,-1);
}
if (mappedKey.rawKey & MOUSE_DOWN) {
if (mappedKey.rawKey & KEY_MOUSE_DOWN) {
MouseWrapper.move(0,1);
}
if (mappedKey.rawKey & MOUSE_LEFT) {
if (mappedKey.rawKey & KEY_MOUSE_LEFT) {
MouseWrapper.move(-1,0);
}
if (mappedKey.rawKey & MOUSE_RIGHT) {
if (mappedKey.rawKey & KEY_MOUSE_RIGHT) {
MouseWrapper.move(1,0);
}
}

Loading…
Cancel
Save