Merge pull request #16 from cyrossignol/fix-warp-dragging

Fix warping while dragging the mouse
pull/365/head
Gergely Nagy 7 years ago committed by GitHub
commit 2130521b6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -89,6 +89,12 @@ Key MouseKeys_::eventHandlerHook(Key mappedKey, byte row, byte col, uint8_t keyS
uint8_t button = mappedKey.keyCode & ~KEY_MOUSE_BUTTON;
if (keyIsPressed(keyState)) {
// Reset warp state on initial mouse button key-down only so we can use
// warp keys to drag-and-drop:
if (keyToggledOn(keyState)) {
MouseWrapper.reset_warping();
}
MouseWrapper.pressButton(button);
} else if (keyToggledOff(keyState)) {
MouseWrapper.release_button(button);

@ -25,11 +25,11 @@ void MouseWrapper_::begin(void) {
void MouseWrapper_::pressButton(uint8_t button) {
kaleidoscope::hid::pressMouseButtons(button);
end_warping();
}
void MouseWrapper_::release_button(uint8_t button) {
kaleidoscope::hid::releaseMouseButtons(button);
end_warping();
}
void MouseWrapper_::warp_jump(uint16_t left, uint16_t top, uint16_t height, uint16_t width) {
@ -50,6 +50,12 @@ void MouseWrapper_::end_warping() {
is_warping = false;
}
void MouseWrapper_::reset_warping() {
if (is_warping == true) {
begin_warping();
}
}
void MouseWrapper_::warp(uint8_t warp_cmd) {
if (is_warping == false) {
begin_warping();

@ -29,6 +29,7 @@ class MouseWrapper_ {
static void begin(void);
static void move(int8_t x, int8_t y);
static void warp(uint8_t warp_cmd);
static void reset_warping();
static void pressButton(uint8_t button);
static void release_button(uint8_t button);
static uint8_t accelStep;

Loading…
Cancel
Save