Skip to content

Commit

Permalink
Fix sharing of mouse button state from mousekeys to ps2_mouse
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
manna-harbour committed Jun 10, 2020
1 parent eaab084 commit 11aaa8d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tmk_core/common/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,36 +394,46 @@ void process_action(keyrecord_t *record, action_t action) {
case ACT_MOUSEKEY:
if (event.pressed) {
switch (action.key.code) {
# ifdef PS2_MOUSE_ENABLE
case KC_MS_BTN1:
tp_buttons |= (1 << 0);
mousekey_on(action.key.code);
break;
case KC_MS_BTN2:
tp_buttons |= (1 << 1);
mousekey_on(action.key.code);
break;
case KC_MS_BTN3:
tp_buttons |= (1 << 2);
mousekey_on(action.key.code);
break;
# endif
default:
mousekey_on(action.key.code);
mousekey_send();
break;
}
mousekey_on(action.key.code);
mousekey_send();
} else {
switch (action.key.code) {
# ifdef PS2_MOUSE_ENABLE
case KC_MS_BTN1:
tp_buttons &= ~(1 << 0);
mousekey_off(action.key.code);
break;
case KC_MS_BTN2:
tp_buttons &= ~(1 << 1);
mousekey_off(action.key.code);
break;
case KC_MS_BTN3:
tp_buttons &= ~(1 << 2);
mousekey_off(action.key.code);
break;
# endif
default:
mousekey_off(action.key.code);
mousekey_send();
break;
}
mousekey_off(action.key.code);
mousekey_send();
}
break;
#endif
Expand Down

0 comments on commit 11aaa8d

Please sign in to comment.