summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-09-21 21:55:18 +0200
committerGitHub <noreply@github.com>2016-09-21 21:55:18 +0200
commitbd57faa7bf21e7ef9a381b7a354c3b3bdf5065e8 (patch)
tree1038538d465205741114ede7f57a9f7d6eb9f215
parent3dc1f39d4028e18c5b11101e4f0d492e26d0cba5 (diff)
parentcda4b534fa4921c2d8f9884aa6a144333e7b07c4 (diff)
downloadqmk_firmware-bd57faa7bf21e7ef9a381b7a354c3b3bdf5065e8.tar.gz
qmk_firmware-bd57faa7bf21e7ef9a381b7a354c3b3bdf5065e8.tar.xz
Merge pull request #769 from pvinis/fix/tap-dance-each-tap-restore
[tap dance] restore each_tap functionality
-rw-r--r--quantum/process_keycode/process_tap_dance.c1
-rw-r--r--quantum/process_keycode/process_tap_dance.h10
-rw-r--r--readme.md2
3 files changed, 8 insertions, 5 deletions
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c
index 79ade4d00..6ae362c4c 100644
--- a/quantum/process_keycode/process_tap_dance.c
+++ b/quantum/process_keycode/process_tap_dance.c
@@ -70,6 +70,7 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
action->state.keycode = keycode;
action->state.count++;
action->state.timer = timer_read();
+ process_tap_dance_action_on_each_tap (action);
if (last_td && last_td != keycode) {
qk_tap_dance_action_t *paction = &tap_dance_actions[last_td - QK_TAP_DANCE];
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h
index d7b857bdc..f753cbba6 100644
--- a/quantum/process_keycode/process_tap_dance.h
+++ b/quantum/process_keycode/process_tap_dance.h
@@ -39,15 +39,17 @@ typedef struct
#define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) { \
.fn = { NULL, qk_tap_dance_pair_finished, qk_tap_dance_pair_reset }, \
- .user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }) \
+ .user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }), \
}
#define ACTION_TAP_DANCE_FN(user_fn) { \
- .fn = { NULL, user_fn, NULL } \
+ .fn = { NULL, user_fn, NULL }, \
+ .user_data = NULL, \
}
-#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_reset) { \
- .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_reset } \
+#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) { \
+ .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \
+ .user_data = NULL, \
}
extern qk_tap_dance_action_t tap_dance_actions[];
diff --git a/readme.md b/readme.md
index ea20b5e01..a7320202b 100644
--- a/readme.md
+++ b/readme.md
@@ -526,7 +526,7 @@ This array specifies what actions shall be taken when a tap-dance key is in acti
* `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: Sends the `kc1` keycode when tapped once, `kc2` otherwise. When the key is held, the appropriate keycode is registered: `kc1` when pressed and held, `kc2` when tapped once, then pressed and held.
* `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action.
-* `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function on when the dance action finishes (like the previous option), and the last function when the tap dance action resets.
+* `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function on when the dance action finishes (like the previous option), and the last function when the tap dance action resets.
The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise.