pull/365/head
Jesse Vincent 6 years ago
parent 47499e5b23
commit d7abd066c6

@ -119,33 +119,33 @@ kaleidoscope::EventHandlerResult MouseKeys_::onKeyswitchEvent(Key &mappedKey, by
mouseMoveIntent |= mappedKey.keyCode; mouseMoveIntent |= mappedKey.keyCode;
} }
} else if (keyToggledOff(keyState)) { } else if (keyToggledOff(keyState)) {
/* If a mouse key toggles off, we want to explicitly stop moving (or /* If a mouse key toggles off, we want to explicitly stop moving (or
* scrolling) in that direction. We want to do this to support use-cases * scrolling) in that direction. We want to do this to support use-cases
* where we send multiple reports per cycle (such as macros), and can't * where we send multiple reports per cycle (such as macros), and can't
* rely on the main loop clearing the report for us. We do not want to * rely on the main loop clearing the report for us. We do not want to
* clear the whole report either, because we want any other mouse keys * clear the whole report either, because we want any other mouse keys
* to still have their desired effect. Therefore, we selectively stop * to still have their desired effect. Therefore, we selectively stop
* movement or scrolling. */ * movement or scrolling. */
mouseMoveIntent &= ~mappedKey.keyCode; mouseMoveIntent &= ~mappedKey.keyCode;
bool x = false, y = false, vWheel = false, hWheel = false; bool x = false, y = false, vWheel = false, hWheel = false;
if (mappedKey.keyCode & KEY_MOUSE_UP || if (mappedKey.keyCode & KEY_MOUSE_UP ||
mappedKey.keyCode & KEY_MOUSE_DOWN) { mappedKey.keyCode & KEY_MOUSE_DOWN) {
if (mappedKey.keyCode & KEY_MOUSE_WHEEL) { if (mappedKey.keyCode & KEY_MOUSE_WHEEL) {
vWheel = true; vWheel = true;
} else { } else {
y = true; y = true;
}
} else if (mappedKey.keyCode & KEY_MOUSE_LEFT ||
mappedKey.keyCode & KEY_MOUSE_RIGHT) {
if (mappedKey.keyCode & KEY_MOUSE_WHEEL) {
hWheel = true;
} else {
x = true;
}
} }
} else if (mappedKey.keyCode & KEY_MOUSE_LEFT ||
mappedKey.keyCode & KEY_MOUSE_RIGHT) {
if (mappedKey.keyCode & KEY_MOUSE_WHEEL) {
hWheel = true;
} else {
x = true;
}
}
kaleidoscope::hid::stopMouse(x, y, vWheel, hWheel); kaleidoscope::hid::stopMouse(x, y, vWheel, hWheel);
} }
} else if (keyToggledOn(keyState)) { } else if (keyToggledOn(keyState)) {
if (mappedKey.keyCode & KEY_MOUSE_WARP && mappedKey.flags & IS_MOUSE_KEY) { if (mappedKey.keyCode & KEY_MOUSE_WARP && mappedKey.flags & IS_MOUSE_KEY) {

Loading…
Cancel
Save