diff options
| author | TerryMathews <terry@terrymathews.net> | 2017-04-08 00:30:54 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-08 00:30:54 -0400 |
| commit | 3899bec4b603a0880055c60df534c5a86ad44a52 (patch) | |
| tree | dd3ac70f403290fafff4bf8005925a3d5eed69cd /quantum/process_keycode/process_tap_dance.c | |
| parent | 2a2be010d9d8c10d872c01637f4b4cd263f9bc1b (diff) | |
| parent | 154305ce1be16b2c8abce5e5d4dee421f295d6b3 (diff) | |
| download | qmk_firmware-3899bec4b603a0880055c60df534c5a86ad44a52.tar.gz qmk_firmware-3899bec4b603a0880055c60df534c5a86ad44a52.zip | |
Merge pull request #1 from qmk/master
Catchup
Diffstat (limited to 'quantum/process_keycode/process_tap_dance.c')
| -rw-r--r-- | quantum/process_keycode/process_tap_dance.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 6ae362c4c..b807ec3c3 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c | |||
| @@ -1,6 +1,23 @@ | |||
| 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 | ||
| 19 | uint8_t get_oneshot_mods(void); | ||
| 20 | |||
| 4 | static uint16_t last_td; | 21 | static uint16_t last_td; |
| 5 | static int8_t highest_td = -1; | 22 | static int8_t highest_td = -1; |
| 6 | 23 | ||
| @@ -43,12 +60,16 @@ static inline void process_tap_dance_action_on_dance_finished (qk_tap_dance_acti | |||
| 43 | if (action->state.finished) | 60 | if (action->state.finished) |
| 44 | return; | 61 | return; |
| 45 | action->state.finished = true; | 62 | action->state.finished = true; |
| 63 | add_mods(action->state.oneshot_mods); | ||
| 64 | send_keyboard_report(); | ||
| 46 | _process_tap_dance_action_fn (&action->state, action->user_data, action->fn.on_dance_finished); | 65 | _process_tap_dance_action_fn (&action->state, action->user_data, action->fn.on_dance_finished); |
| 47 | } | 66 | } |
| 48 | 67 | ||
| 49 | static inline void process_tap_dance_action_on_reset (qk_tap_dance_action_t *action) | 68 | static inline void process_tap_dance_action_on_reset (qk_tap_dance_action_t *action) |
| 50 | { | 69 | { |
| 51 | _process_tap_dance_action_fn (&action->state, action->user_data, action->fn.on_reset); | 70 | _process_tap_dance_action_fn (&action->state, action->user_data, action->fn.on_reset); |
| 71 | del_mods(action->state.oneshot_mods); | ||
| 72 | send_keyboard_report(); | ||
| 52 | } | 73 | } |
| 53 | 74 | ||
| 54 | bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { | 75 | bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { |
| @@ -70,6 +91,7 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { | |||
| 70 | action->state.keycode = keycode; | 91 | action->state.keycode = keycode; |
| 71 | action->state.count++; | 92 | action->state.count++; |
| 72 | action->state.timer = timer_read(); | 93 | action->state.timer = timer_read(); |
| 94 | action->state.oneshot_mods = get_oneshot_mods(); | ||
| 73 | process_tap_dance_action_on_each_tap (action); | 95 | process_tap_dance_action_on_each_tap (action); |
| 74 | 96 | ||
| 75 | if (last_td && last_td != keycode) { | 97 | if (last_td && last_td != keycode) { |
| @@ -109,7 +131,7 @@ void matrix_scan_tap_dance () { | |||
| 109 | if (highest_td == -1) | 131 | if (highest_td == -1) |
| 110 | return; | 132 | return; |
| 111 | 133 | ||
| 112 | for (int i = 0; i <= highest_td; i++) { | 134 | for (int i = 0; i <= highest_td; i++) { |
| 113 | qk_tap_dance_action_t *action = &tap_dance_actions[i]; | 135 | qk_tap_dance_action_t *action = &tap_dance_actions[i]; |
| 114 | 136 | ||
| 115 | if (action->state.count && timer_elapsed (action->state.timer) > TAPPING_TERM) { | 137 | if (action->state.count && timer_elapsed (action->state.timer) > TAPPING_TERM) { |
