summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManna Harbour <51143715+manna-harbour@users.noreply.github.com>2020-07-03 03:04:55 +1000
committerDrashna Jael're <drashna@live.com>2020-08-08 21:57:58 -0700
commitf32994a5ee56ccd45dd747a8701a94e46593239e (patch)
tree424616d995b13c81bd7ee39b494cfd27f06b53ec
parent95782d31377a94a9eaa783bc580af5619b23f01c (diff)
Fix sharing of mouse button state from mousekeys to ps2_mouse (#9124)
With this change, when ps2_mouse is disabled, mousekeys works as usual. With ps2_mouse enabled, mousekeys button state is shared with ps2_mouse for clicking, dragging, and scrolling, mousekeys clicks are produced by ps2_mouse only, and mouskeys button state is transferred to mousekeys without generating clicks to enable mousekeys dragging. Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Drashna Jaelre <drashna@live.com>
-rw-r--r--tmk_core/common/action.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 9a808f43e8..0a447018b2 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -400,7 +400,9 @@ void process_action(keyrecord_t *record, action_t action) {
/* Mouse key */
case ACT_MOUSEKEY:
if (event.pressed) {
+ mousekey_on(action.key.code);
switch (action.key.code) {
+# ifdef PS2_MOUSE_ENABLE
case KC_MS_BTN1:
tp_buttons |= (1 << 0);
break;
@@ -410,13 +412,15 @@ void process_action(keyrecord_t *record, action_t action) {
case KC_MS_BTN3:
tp_buttons |= (1 << 2);
break;
+# endif
default:
+ mousekey_send();
break;
}
- mousekey_on(action.key.code);
- mousekey_send();
} else {
+ mousekey_off(action.key.code);
switch (action.key.code) {
+# ifdef PS2_MOUSE_ENABLE
case KC_MS_BTN1:
tp_buttons &= ~(1 << 0);
break;
@@ -426,11 +430,11 @@ void process_action(keyrecord_t *record, action_t action) {
case KC_MS_BTN3:
tp_buttons &= ~(1 << 2);
break;
+# endif
default:
+ mousekey_send();
break;
}
- mousekey_off(action.key.code);
- mousekey_send();
}
break;
#endif