Revert "The various types of synthetic keys never overlap."

This reverts commit a9088e9179.
pull/30/head
Jesse Vincent 8 years ago
parent da457c09a1
commit d882c14158

@ -26,9 +26,9 @@ typedef union {
// we assert that synthetic keys can never have keys held, so we reuse the _HELD bits // we assert that synthetic keys can never have keys held, so we reuse the _HELD bits
#define IS_MACRO B00000001 #define IS_MACRO B00000001
#define IS_SYSCTL B00000010 #define IS_SYSCTL B00000010
#define IS_CONSUMER B00000011 #define IS_CONSUMER B00000100
#define IS_INTERNAL B00000100 #define IS_INTERNAL B00001000
#define IS_MOUSE_KEY B00000101 #define IS_MOUSE_KEY B00010000
// IS_INTERNAL key table: // IS_INTERNAL key table:

@ -3,11 +3,9 @@
static const Key keymaps[KEYMAPS][ROWS][COLS] PROGMEM = { KEYMAP_LIST }; static const Key keymaps[KEYMAPS][ROWS][COLS] PROGMEM = { KEYMAP_LIST };
void handle_synthetic_key_event(Key mappedKey, uint8_t currentState, uint8_t previousState) { void handle_synthetic_key_event(Key mappedKey, uint8_t currentState, uint8_t previousState) {
if ( (mappedKey.flags == SYNTHETIC_KEY| IS_MOUSE_KEY ) if (mappedKey.flags & IS_MOUSE_KEY && !( mappedKey.rawKey & KEY_MOUSE_WARP) ) {
&& !( mappedKey.rawKey & KEY_MOUSE_WARP) ) {
handle_mouse_key_event(mappedKey, currentState, previousState); handle_mouse_key_event(mappedKey, currentState, previousState);
} else if (! (mappedKey.flags == SYNTHETIC_KEY| IS_INTERNAL) } else if (! (mappedKey.flags & IS_INTERNAL)
&& (mappedKey.rawKey == KEY_MOUSE_BTN_L && (mappedKey.rawKey == KEY_MOUSE_BTN_L
|| mappedKey.rawKey == KEY_MOUSE_BTN_M || mappedKey.rawKey == KEY_MOUSE_BTN_M
|| mappedKey.rawKey == KEY_MOUSE_BTN_R)) { || mappedKey.rawKey == KEY_MOUSE_BTN_R)) {
@ -20,22 +18,21 @@ void handle_synthetic_key_event(Key mappedKey, uint8_t currentState, uint8_t pre
else if (key_toggled_on(currentState,previousState)) { else if (key_toggled_on(currentState,previousState)) {
if ( (mappedKey.flags == SYNTHETIC_KEY| IS_MOUSE_KEY) if (mappedKey.rawKey & KEY_MOUSE_WARP && mappedKey.flags & IS_MOUSE_KEY) {
&& mappedKey.rawKey & KEY_MOUSE_WARP ) {
// we don't pass in the left and up values because those are the // we don't pass in the left and up values because those are the
// default, "no-op" conditionals // default, "no-op" conditionals
MouseWrapper.warp( ((mappedKey.rawKey & KEY_MOUSE_WARP_END) ? WARP_END : 0x00) | MouseWrapper.warp( ((mappedKey.rawKey & KEY_MOUSE_WARP_END) ? WARP_END : 0x00) |
((mappedKey.rawKey & KEY_MOUSE_DOWN) ? WARP_DOWN : 0x00) | ((mappedKey.rawKey & KEY_MOUSE_DOWN) ? WARP_DOWN : 0x00) |
((mappedKey.rawKey & KEY_MOUSE_RIGHT) ? WARP_RIGHT : 0x00) ); ((mappedKey.rawKey & KEY_MOUSE_RIGHT) ? WARP_RIGHT : 0x00) );
} else if (mappedKey.flags == SYNTHETIC_KEY| IS_CONSUMER) { } else if (mappedKey.flags & IS_CONSUMER) {
ConsumerControl.press(mappedKey.rawKey); ConsumerControl.press(mappedKey.rawKey);
} else if (mappedKey.flags == SYNTHETIC_KEY| IS_INTERNAL) { } else if (mappedKey.flags & IS_INTERNAL) {
if (mappedKey.rawKey == LED_TOGGLE) { if (mappedKey.rawKey == LED_TOGGLE) {
LEDControl.next_mode(); LEDControl.next_mode();
} }
} else if (mappedKey.flags == SYNTHETIC_KEY| IS_SYSCTL) { } else if (mappedKey.flags & IS_SYSCTL) {
SystemControl.press(mappedKey.rawKey); SystemControl.press(mappedKey.rawKey);
} else if (mappedKey.flags == SYNTHETIC_KEY| IS_MACRO) { } else if (mappedKey.flags & IS_MACRO) {
if (mappedKey.rawKey == 1) { if (mappedKey.rawKey == 1) {
Serial.print("Keyboard.IO keyboard driver v0.00"); Serial.print("Keyboard.IO keyboard driver v0.00");
} }

Loading…
Cancel
Save