diff options
Diffstat (limited to 'quantum/process_keycode/process_tap_dance.c')
| -rw-r--r-- | quantum/process_keycode/process_tap_dance.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 186889bc2..40fba2a6a 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c | |||
| @@ -40,7 +40,24 @@ void process_tap_dance_action (uint16_t keycode) | |||
| 40 | action.pair.kc1, action.pair.kc2); | 40 | action.pair.kc1, action.pair.kc2); |
| 41 | break; | 41 | break; |
| 42 | case QK_TAP_DANCE_TYPE_FN: | 42 | case QK_TAP_DANCE_TYPE_FN: |
| 43 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.fn); | 43 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.fn.regular); |
| 44 | break; | ||
| 45 | |||
| 46 | default: | ||
| 47 | break; | ||
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 51 | void process_tap_dance_action_anyway (uint16_t keycode) | ||
| 52 | { | ||
| 53 | uint16_t idx = keycode - QK_TAP_DANCE; | ||
| 54 | qk_tap_dance_action_t action; | ||
| 55 | |||
| 56 | action = tap_dance_actions[idx]; | ||
| 57 | |||
| 58 | switch (action.type) { | ||
| 59 | case QK_TAP_DANCE_TYPE_FN: | ||
| 60 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.fn.anyway); | ||
| 44 | break; | 61 | break; |
| 45 | 62 | ||
| 46 | default: | 63 | default: |
| @@ -53,6 +70,7 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { | |||
| 53 | 70 | ||
| 54 | switch(keycode) { | 71 | switch(keycode) { |
| 55 | case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: | 72 | case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: |
| 73 | process_tap_dance_action_anyway (qk_tap_dance_state.keycode); | ||
| 56 | if (qk_tap_dance_state.keycode && qk_tap_dance_state.keycode != keycode) { | 74 | if (qk_tap_dance_state.keycode && qk_tap_dance_state.keycode != keycode) { |
| 57 | process_tap_dance_action (qk_tap_dance_state.keycode); | 75 | process_tap_dance_action (qk_tap_dance_state.keycode); |
| 58 | } else { | 76 | } else { |
| @@ -68,6 +86,7 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { | |||
| 68 | 86 | ||
| 69 | default: | 87 | default: |
| 70 | if (qk_tap_dance_state.keycode) { | 88 | if (qk_tap_dance_state.keycode) { |
| 89 | //process_tap_dance_action_anyway (qk_tap_dance_state.keycode); | ||
| 71 | process_tap_dance_action (qk_tap_dance_state.keycode); | 90 | process_tap_dance_action (qk_tap_dance_state.keycode); |
| 72 | 91 | ||
| 73 | reset_tap_dance (&qk_tap_dance_state); | 92 | reset_tap_dance (&qk_tap_dance_state); |
| @@ -87,6 +106,21 @@ void matrix_scan_tap_dance () { | |||
| 87 | } | 106 | } |
| 88 | 107 | ||
| 89 | void reset_tap_dance (qk_tap_dance_state_t *state) { | 108 | void reset_tap_dance (qk_tap_dance_state_t *state) { |
| 109 | uint16_t idx = state->keycode - QK_TAP_DANCE; | ||
| 110 | qk_tap_dance_action_t action; | ||
| 111 | |||
| 112 | action = tap_dance_actions[idx]; | ||
| 113 | switch (action.type) { | ||
| 114 | case QK_TAP_DANCE_TYPE_FN: | ||
| 115 | if (action.fn.reset) { | ||
| 116 | action.fn.reset(); | ||
| 117 | } | ||
| 118 | break; | ||
| 119 | |||
| 120 | default: | ||
| 121 | break; | ||
| 122 | } | ||
| 123 | |||
| 90 | state->keycode = 0; | 124 | state->keycode = 0; |
| 91 | state->count = 0; | 125 | state->count = 0; |
| 92 | } | 126 | } |
