Commit Graph

55 Commits

Author SHA1 Message Date
Ilya Zhuravlev
17e46fcec7 Merge remote-tracking branch 'qmk/master' into merge-2024-04-15 2024-04-15 19:43:02 -06:00
Joel Challis
b824faca71
Align location of tap dance keycode (#22742) 2023-12-24 06:52:41 +00:00
Ilya Zhuravlev
e390a34128 Merge remote-tracking branch 'qmk/master' into merge-2023-09-08 2023-09-08 20:53:27 -06:00
leep-frog
2c70d38910
On-each-release tap dance function (#20255)
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
2023-07-26 21:04:35 -07:00
Ryan
eee0384167
process_keycode: remove direct quantum.h includes (#21486) 2023-07-11 17:07:24 +10:00
Ilya Zhuravlev
06a2fdcc9c Merge remote-tracking branch 'qmk/master' into merge-2023-03-12 2023-03-18 17:51:58 -06:00
Ryan
cf935d97ae
Fix functions with empty params (#19647)
* Fix functions with empty params

* Found a bunch more
2023-01-20 16:21:17 +00:00
Ryan
1978007fae
Tap Dance: remove qk_ prefix (#19313) 2022-12-14 12:40:25 -08:00
Sergey Vlasov
ca0c12847a
Fix layer switching from tap dances by redoing the keymap lookup (#17935) 2022-10-03 20:48:16 +11:00
Ilya Zhuravlev
d4fa6703b8 Merge remote-tracking branch 'qmk/master' into merge-2022-09-10 2022-09-10 04:10:44 -06:00
Ilya Zhuravlev
fde0c10bae Merge remote-tracking branch 'qmk/master' into merge-2022-07-11 2022-07-11 18:40:32 -06:00
Jouke Witteveen
1706da9054
tap-dance: Restructure code and document in more detail (#16394) 2022-06-13 22:12:55 +02:00
Jouke Witteveen
8f585153c4
Add GET_TAPPING_TERM macro to reduce duplicate code (#16681)
* Add GET_TAPPING_TERM macro to reduce duplicate code

The macro gives the right tapping term depending on whether per-key
tapping terms and/or dynamic tapping terms are enabled. Unnecessary
function calls and variable resolution are avoided.

Fixes #16472.

* Use GET_TAPPING_TERM for Cirque trackpads

Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
2022-04-16 11:24:09 -07:00
Ilya Zhuravlev
3a3c93383f Merge remote-tracking branch 'qmk/master' into merge-2022-03-06 2022-03-06 20:07:17 -06:00
QMK Bot
63646e8906
Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
precondition
7148a69d5e
Pass in the keyrecord_t of the dual-role/tapping key when calling per-key tap hold functions (#15938)
* Replace keyp by &tapping_key in the record arg of per-key tap hold funcs

* Replace NULL by &(keyrecord_t){} in 2nd arg of get_tapping_term
2022-02-11 19:53:26 +00:00
Ilya Zhuravlev
f0ae3fb701 Merge remote-tracking branch 'qmk/master' into merge-2021-12-11 2021-12-11 20:19:52 -05:00
Drashna Jaelre
0fd45d5984
Fix type of Tap Dance max index variable (#14887) 2021-10-19 20:50:44 -07:00
Ilya Zhuravlev
f406892ec3 vial: process tap dance release early, fix https://github.com/vial-kb/vial-gui/issues/50 2021-10-16 04:53:11 -04:00
Drashna Jaelre
ab34ecb669
Apply TAP_CODE_DELAY to Tap Dance key sequences (#14412)
* Add  support to tap dances

* Move default tap code defines to header file
2021-09-13 00:48:11 +01:00
Joel Challis
03d258c222
matrix_scan_x -> x_task (#13748) 2021-07-28 12:01:23 +01:00
Sergey Vlasov
da6e888a32
Do not leak weak mods from tap dance to the interrupting keypress (#12471)
Tap dance callbacks may register weak mods; one case when it happens
is when a tap dance registers a key with modifiers.  When the tap
dance is interrupted by pressing another key, these weak mods could
affect the interrupting key (normally any stale weak mods are cleared
at the start of action_exec() when handling a keypress event, but the
tap dance interrupt check code is called later, and the weak mods left
by that code were not cleared).  Add another clear_weak_mods() call to
preprocess_tap_dance() to make sure that the interrupting keypress is
not affected by unrelated weak mods from the previous tap dance.

Fixes #12445.
2021-04-25 13:41:37 +10:00
Drashna Jaelre
810eafad12
Fix Tap-Hold Configs (#11127)
* Add proper prototypes for Tap-Hold Per Key functions

* Fix handwired/tennie default keymap

* Remove unneeded references

* Fix tapping term per key check in space cadet

* Pre-emptive fix for tap dance

* Fix marksard/leftover30

* Replace hard coded tapping term with define
2021-01-04 16:37:20 -08:00
Drashna Jaelre
9d3b26a475 Update features to use Custom Tapping Term when appropriate (#6259)
* Update Space Cadet to use Custom Tapping Term functionality

* Detect correct keycode for space cadet tapping term

* Update tap dancing to use global custom tapping term

* Update documentation for Tap Dances

* formatting pass

* Apply suggestions from code review

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update docs/feature_tap_dance.md

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update for future

* Update user keymaps for space cadet

* Fix typos

* Clean up tapping term stuff

* Fix compiler issue if NO_ACTION_TAPPING is enabled

Co-authored-by: fauxpark <fauxpark@gmail.com>
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
2020-08-29 14:30:02 -07:00
Drashna Jaelre
f069e9fc09
Generalize Tap Dance Layer functions (#6629)
* made tapdance dual_role general

* updated original dual_role functionality

* added toggling layer example

* Fix dual role and add alias

* Update docs about new layer tap dances

* Fix up based on feedback
2019-09-21 11:22:27 -07:00
skullY
b624f32f94 clang-format changes 2019-08-30 15:01:52 -07:00
Giuseppe Rota
3ddec14eb8 Register the interrupting keycode in the tap dance state struct 2018-12-30 08:35:12 -08:00
Drashna Jaelre
9d949389f9 Adds default value for TAPPING_TERM if Tap Dance is enabled (#2785)
* Force require TAPPING_TERM if Tap Dance is enabled

* Handle lack of TAPPING_TERM more gracefully
2018-10-01 11:09:05 -04:00
Joe Wasson
81756d7b21 Fix tapdance when one-shot is disabled. 2018-07-15 13:29:59 -04:00
scauligi
9fcda95363 Fixes to get tap dance to fire at proper places (#2272)
* tap dance fixes: fire immediately upon completion and also get properly interrupted before macros

* bugfix for tapdance improvement

* fix build
2018-02-04 13:45:19 -05:00
pmalecka
a01dc4dd48 added the possibility to hav shifted(modded) tap dance 2018-01-12 12:56:21 -05:00
Ptomerty
68b6de60e0 fix for toggle tap dance 2017-09-10 22:57:26 -04:00
Gergely Nagy
d28b2c395b tap-dance: key + layer helper
This adds the `ACTION_TAP_DANCE_DUAL_ROLE` helper, which makes it easy to have
keys that act as a key on the first tap, and as a layer toggle on the second.

Fixes #1532, reported by @Ptomerty.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2017-08-02 16:06:16 -04:00
Nick Choi
5393bc6f4e switched to uint8 and 16 2017-05-29 21:25:50 -04:00
Nick Choi
aeb3a34636 moved specific tap term to its own function
included custom_tapping_term in action struct
2017-05-25 16:26:30 -04:00
Nick Choi
e695b5a33b Added per case tapping term, updated FF-nikchi keymap. 2017-05-25 00:41:00 -04:00
nielsenz
d1e66e2e07 Worked around some new Makefile issues. 2017-03-30 20:10:34 -07:00
skullydazed
23839b8c6d Clarify the quantum license (#1042)
* Clarify the license for files we have signoff on

* Update against the currently signed off files

* Remove unused and not clearly licensed headers

* Replace an #endif I accidentally removed while resolving merge conflicts
2017-03-28 15:20:36 -07:00
SjB
5a860b71a1 race condition between oneshot_mods and tap_dance
since the keycode for a tap dance process gets process only after the
TAPPING_TERM timeout, you really only have ONESHOT_TIMEOUT -
TAPPING_TERM time to tap or double tap on the key. This fix save the
oneshot_mods into the action.state structure and applies the mods with
the keycode when it's registered. It also unregisters the mod when the
the tap dance process gets reset.
2017-01-29 13:26:31 -05:00
Pavlos Vinieratos
e1f131db8e restore each_tap callback 2016-09-21 10:23:51 +02:00
Gergely Nagy
acda2b793f tap-dance: Do not start a sequence on keyup
There was an odd case, which confused the hell out of tap-dance: suppose
you had a number of tap-dance keys, on a layer, and as part of the
tap-dance, you turned that layer off - or had it on one-shot to begin
with. In this case, the keydown event would trigger the tap-dance key,
but the keyup would not. This had two funky consequences:

- tap-dance did not correctly register that the dance has ended.
- pressing any other tap-dance key would interrupt the previous
  tap-dance, and potentially input unwanted characters.

To fix this, we simply do not start a tap-dance sequence on keyup, only
when it is pressed. This way the previous sequence has enough time to
time-out and finish properly, and we don't get confused.

This fixes algernon/ergodox-layout#107.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-09-01 08:32:47 +02:00
Gergely Nagy
0d28787c5c Add a register/unregister_code16 pair of functions
These functions register not only the 8bit keycode, but the modifiers
too. It doesn't handle the full range of the upper 8bits, just the mods,
but that's a good start.

Changed the tap-dance pair functions to use these, so one can do:

  `ACTION_TAP_DANCE_DOUBLE (KC_COLN, KC_SCLN)`

...and that will do the right thing.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-08-18 11:29:53 +02:00
Gergely Nagy
29f64d7a93 tap-dance: Major rework, to make it more reliable
This reworks how the tap-dance feature works: instead of one global
state, we have a state for each tap-dance key, so we can cancel them
when another tap-dance key is in flight. This fixes #527.

Since we have a state for each key, we can avoid situation where a keyup
would mess with our global state. This fixes #563.

And while here, we also make sure to fire events only once, and this
fixes #574.

There is one breaking change, though: tap-dance debugging support was
removed, because dumping the whole state would increase the firmware
size too much. Any keymap that made use of this, will have to be
updated (but there's no such keymap in the repo).

Also, there's a nice trick used in this rework: we need to iterate
through tap_dance_actions in a few places, to check for timeouts, and so
on. For this, we'd need to know the size of the array. We can't discover
that at compile-time, because tap-dance gets compiled separately. We'd
like to avoid having to terminate the list with a sentinel value,
because that would require updates to all keymaps that use the feature.
So, we keep track of the highest tap-dance code seen so far, and iterate
until that index.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-08-17 15:05:58 +02:00
Gergely Nagy
d78058cc75 tap-dance: Include action_tapping.h for TAPPING_TERM
Include `action_tapping.h`, so the keymap does not have to define a
`TAPPING_TERM` for us, and we can use the default.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-08-17 10:28:08 +02:00
Gergely Nagy
b21e8b97ac tap-dance: Add some debugging support
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-07-27 14:49:19 +02:00
Gergely Nagy
44e16ffc80 tap-dance: Code cleanup
Removes a number of duplicated code, by passing actions around instead
of keycodes, so the various dance action functions do not have to look
up the action, but the caller does that for them.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-07-22 09:10:17 +02:00
Gergely Nagy
ce8cc9219f tap-dance: Support user_data for the callbacks
Refactored the code a little, so all callbacks now receive a `user_data`
pointer, which can be anything. As an example, the key pairs from
`ACTION_TAP_DANCE_DOUBLE` now use this, and custom, built-in functions.

This makes it easier to extend the tap dance functionality, and also
simplifies the code a little.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-07-22 09:10:17 +02:00
Gergely Nagy
70e42489de tap-dance: Support for holding keys
With this change, tap dance will now store the pressed state of the
tap-dance key, and allow one to make an action sooner, while the key is
still held, and only unregister when the key is released.

The registration must happen in the `on_dance_finished` callback, while
unregistering goes to `on_reset`. The surrounding code makes sure not to
call either multiple times.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-07-22 09:10:17 +02:00
Pavlos Vinieratos
4e6a8627d8 add a couple of comments 2016-07-19 18:18:57 +02:00
Pavlos Vinieratos
d5daec2a58 on_each_tap_fn is called on tap down and tap up 2016-07-19 18:18:57 +02:00