From 6ded892456fefec52d41f15f85787e44d3d24f1f Mon Sep 17 00:00:00 2001 From: trankillity Date: Tue, 4 Apr 2023 16:26:02 +1000 Subject: [PATCH] Pointing Update - Get custom keycodes recognized as mouse codes to keep layer active - Attempt to get toggle on multi-mode buttons working --- keymap.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/keymap.c b/keymap.c index 85b0dab..c7084fe 100644 --- a/keymap.c +++ b/keymap.c @@ -42,6 +42,7 @@ enum custom_keycodes { #define C_CENT C(KC_ENTER) #define C_SCRL LT(0,KC_S) #define C_ZOOM LT(0,KC_Z) +#define C_MTOG TG(_MOUS) // Data Grip Shortcuts #define D_FMTC C(A(KC_L)) @@ -93,9 +94,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_MOUS] = LAYOUT_ffkb( - C_SCRL, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_ACCL, - C_ZOOM, C_MLTG, KC_BTN3, KC_BTN2, KC_BTN1, C_DBLC, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_ACCL, - OSM_CTL, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_ACCL, + C_SCRL, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MTOG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_ACCL, + C_ZOOM, C_MLTG, KC_BTN3, KC_BTN2, KC_BTN1, C_DBLC, C_MTOG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_ACCL, + OSM_CTL, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_MTOG, C_MLTG, C_MLTG, C_MLTG, C_MLTG, C_ACCL, _______, C_MLTG, _______, C_MLTG, C_MLTG, C_MLTG, C_MLTG, _______ ), @@ -116,6 +117,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; +bool is_mouse_record_user(uint16_t keycode, keyrecord_t* record) { + switch(keycode) { + case C_DBLC: + case C_SCRL: + case C_ZOOM: + return true; + default: + return false; + } +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_case_modes(keycode, record)) { return false; @@ -162,7 +174,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { fp_scroll_keycode_toggle(); } else if (record->event.pressed) { fp_scroll_keycode_set(true); - } else { + } else if (!record->tap.count) { fp_scroll_keycode_set(false); } return false; @@ -171,7 +183,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { fp_zoom_keycode_toggle(); } else if (record->event.pressed) { fp_zoom_keycode_set(true); - } else { + } else if (!record->tap.count) { fp_zoom_keycode_set(false); } return false;