aboutsummaryrefslogtreecommitdiffstats
path: root/quantum/quantum.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2019-11-04 22:59:13 -0800
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2019-11-04 22:59:13 -0800
commit542cb0a8ce3f324c6bd46751d733daf86384a8f6 (patch)
tree08128a4e00a42fa0e78199d86f757a8d562952a9 /quantum/quantum.c
parent0e664f92c4d61d685259607d7257c53f60da5fc0 (diff)
downloadfirmware-542cb0a8ce3f324c6bd46751d733daf86384a8f6.tar.gz
firmware-542cb0a8ce3f324c6bd46751d733daf86384a8f6.tar.bz2
firmware-542cb0a8ce3f324c6bd46751d733daf86384a8f6.zip
[Core] Convert Dynamic Macro to a Core Feature (#5948)
* Convert Dynamic Macro to a Core Feature This imports the code from Dynamic Macro into the core code, and handles it, as such. This deprecates the old method but does not remove it, for legacy support. This way, no existing user files need to be touched. Additionally, this reorganizes the documentation to better reflect the changes. Also, it adds user hooks to the feature so users can customize the existing functionality. Based heavily on and closes #2976 * Apply suggestions from code review Co-Authored-By: fauxpark <fauxpark@gmail.com> Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Cleanup based on feedback * Add short-form keycodes and document them - add short-form keycodes to quantum/quantum_keycodes.h - document the new aliases in docs/feature_dynamic_macros.md * Add Dynamic Macros section and keycodes to docs/keycodes.md * Make anti-nesting optional * Add documentation for DYNAMIC_MACRO_NO_NESTING option * Fix Merge artifacts * Fix formatting typo in docs Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com> * Remove DYNAMIC_MACRO_RANGE as it's not needed * Fix includes and layer var type
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r--quantum/quantum.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 571dda4c5..1f17c6ff7 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -26,7 +26,7 @@
#ifdef BACKLIGHT_ENABLE
# include "backlight.h"
- extern backlight_config_t backlight_config;
+extern backlight_config_t backlight_config;
#endif
#ifdef FAUXCLICKY_ENABLE
@@ -89,7 +89,7 @@ static void do_code16(uint16_t code, void (*f)(uint8_t)) {
uint8_t mods_to_send = 0;
- if (code & QK_RMODS_MIN) { // Right mod flag is set
+ if (code & QK_RMODS_MIN) { // Right mod flag is set
if (code & QK_LCTL) mods_to_send |= MOD_BIT(KC_RCTL);
if (code & QK_LSFT) mods_to_send |= MOD_BIT(KC_RSFT);
if (code & QK_LALT) mods_to_send |= MOD_BIT(KC_RALT);
@@ -222,6 +222,10 @@ bool process_record_quantum(keyrecord_t *record) {
// Must run first to be able to mask key_up events.
process_key_lock(&keycode, record) &&
#endif
+#if defined(DYNAMIC_MACRO_ENABLE) && !defined(DYNAMIC_MACRO_USER_CALL)
+ // Must run asap to ensure all keypresses are recorded.
+ process_dynamic_macro(keycode, record) &&
+#endif
#if defined(AUDIO_ENABLE) && defined(AUDIO_CLICKY)
process_clicky(keycode, record) &&
#endif // AUDIO_CLICKY
@@ -563,7 +567,7 @@ bool process_record_quantum(keyrecord_t *record) {
keymap_config.swap_backslash_backspace = true;
break;
case MAGIC_HOST_NKRO:
- clear_keyboard(); // clear first buffer to prevent stuck keys
+ clear_keyboard(); // clear first buffer to prevent stuck keys
keymap_config.nkro = true;
break;
case MAGIC_SWAP_ALT_GUI:
@@ -606,7 +610,7 @@ bool process_record_quantum(keyrecord_t *record) {
keymap_config.swap_backslash_backspace = false;
break;
case MAGIC_UNHOST_NKRO:
- clear_keyboard(); // clear first buffer to prevent stuck keys
+ clear_keyboard(); // clear first buffer to prevent stuck keys
keymap_config.nkro = false;
break;
case MAGIC_UNSWAP_ALT_GUI:
@@ -644,7 +648,7 @@ bool process_record_quantum(keyrecord_t *record) {
#endif
break;
case MAGIC_TOGGLE_NKRO:
- clear_keyboard(); // clear first buffer to prevent stuck keys
+ clear_keyboard(); // clear first buffer to prevent stuck keys
keymap_config.nkro = !keymap_config.nkro;
break;
case MAGIC_EE_HANDS_LEFT: