diff options
Diffstat (limited to 'tmk_core/common/action.c')
-rw-r--r-- | tmk_core/common/action.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index a534f818ec..f73b0fe807 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -34,6 +34,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "nodebug.h" #endif +int tp_buttons; + #ifdef FAUXCLICKY_ENABLE #include <fauxclicky.h> #endif @@ -311,11 +313,35 @@ void process_action(keyrecord_t *record, action_t action) /* Mouse key */ case ACT_MOUSEKEY: if (event.pressed) { - mousekey_on(action.key.code); - mousekey_send(); + switch (action.key.code) { + case KC_MS_BTN1: + tp_buttons |= (1<<0); + break; + case KC_MS_BTN2: + tp_buttons |= (1<<1); + break; + case KC_MS_BTN3: + tp_buttons |= (1<<2); + break; + default: + mousekey_on(action.key.code); + mousekey_send(); + } } else { - mousekey_off(action.key.code); - mousekey_send(); + switch (action.key.code) { + case KC_MS_BTN1: + tp_buttons &= ~(1<<0); + break; + case KC_MS_BTN2: + tp_buttons &= ~(1<<1); + break; + case KC_MS_BTN3: + tp_buttons &= ~(1<<2); + break; + default: + mousekey_off(action.key.code); + mousekey_send(); + } } break; #endif |