diff options
Diffstat (limited to 'quantum/process_keycode/process_tap_dance.c')
| -rw-r--r-- | quantum/process_keycode/process_tap_dance.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 6ae362c4c..68c8425bb 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | /* Copyright 2016 Jack Humbert | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 1 | #include "quantum.h" | 16 | #include "quantum.h" |
| 2 | #include "action_tapping.h" | 17 | #include "action_tapping.h" |
| 3 | 18 | ||
| @@ -43,12 +58,16 @@ static inline void process_tap_dance_action_on_dance_finished (qk_tap_dance_acti | |||
| 43 | if (action->state.finished) | 58 | if (action->state.finished) |
| 44 | return; | 59 | return; |
| 45 | action->state.finished = true; | 60 | action->state.finished = true; |
| 61 | add_mods(action->state.oneshot_mods); | ||
| 62 | send_keyboard_report(); | ||
| 46 | _process_tap_dance_action_fn (&action->state, action->user_data, action->fn.on_dance_finished); | 63 | _process_tap_dance_action_fn (&action->state, action->user_data, action->fn.on_dance_finished); |
| 47 | } | 64 | } |
| 48 | 65 | ||
| 49 | static inline void process_tap_dance_action_on_reset (qk_tap_dance_action_t *action) | 66 | static inline void process_tap_dance_action_on_reset (qk_tap_dance_action_t *action) |
| 50 | { | 67 | { |
| 51 | _process_tap_dance_action_fn (&action->state, action->user_data, action->fn.on_reset); | 68 | _process_tap_dance_action_fn (&action->state, action->user_data, action->fn.on_reset); |
| 69 | del_mods(action->state.oneshot_mods); | ||
| 70 | send_keyboard_report(); | ||
| 52 | } | 71 | } |
| 53 | 72 | ||
| 54 | bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { | 73 | bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { |
| @@ -70,6 +89,7 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { | |||
| 70 | action->state.keycode = keycode; | 89 | action->state.keycode = keycode; |
| 71 | action->state.count++; | 90 | action->state.count++; |
| 72 | action->state.timer = timer_read(); | 91 | action->state.timer = timer_read(); |
| 92 | action->state.oneshot_mods = get_oneshot_mods(); | ||
| 73 | process_tap_dance_action_on_each_tap (action); | 93 | process_tap_dance_action_on_each_tap (action); |
| 74 | 94 | ||
| 75 | if (last_td && last_td != keycode) { | 95 | if (last_td && last_td != keycode) { |
| @@ -109,7 +129,7 @@ void matrix_scan_tap_dance () { | |||
| 109 | if (highest_td == -1) | 129 | if (highest_td == -1) |
| 110 | return; | 130 | return; |
| 111 | 131 | ||
| 112 | for (int i = 0; i <= highest_td; i++) { | 132 | for (int i = 0; i <= highest_td; i++) { |
| 113 | qk_tap_dance_action_t *action = &tap_dance_actions[i]; | 133 | qk_tap_dance_action_t *action = &tap_dance_actions[i]; |
| 114 | 134 | ||
| 115 | if (action->state.count && timer_elapsed (action->state.timer) > TAPPING_TERM) { | 135 | if (action->state.count && timer_elapsed (action->state.timer) > TAPPING_TERM) { |
