Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent tap dance from wiping dynamic macros #17880

Merged
merged 2 commits into from
Oct 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions quantum/process_keycode/process_dynamic_macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ __attribute__((weak)) void dynamic_macro_record_end_user(int8_t direction) {
dynamic_macro_led_blink();
}

__attribute__((weak)) bool dynamic_macro_valid_key_user(uint16_t keycode, keyrecord_t *record) {
return true;
}

/* Convenience macros used for retrieving the debug info. All of them
* need a `direction` variable accessible at the call site.
*/
Expand Down Expand Up @@ -249,14 +253,16 @@ bool process_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
return false;
#endif
default:
/* Store the key in the macro buffer and process it normally. */
switch (macro_id) {
case 1:
dynamic_macro_record_key(macro_buffer, &macro_pointer, r_macro_end, +1, record);
break;
case 2:
dynamic_macro_record_key(r_macro_buffer, &macro_pointer, macro_end, -1, record);
break;
if (dynamic_macro_valid_key_user(keycode, record)) {
/* Store the key in the macro buffer and process it normally. */
switch (macro_id) {
case 1:
dynamic_macro_record_key(macro_buffer, &macro_pointer, r_macro_end, +1, record);
break;
case 2:
dynamic_macro_record_key(r_macro_buffer, &macro_pointer, macro_end, -1, record);
break;
}
}
return true;
break;
Expand Down