diff options
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/keycode_config.c | 6 | ||||
-rw-r--r-- | quantum/keymap_common.c | 22 |
2 files changed, 21 insertions, 7 deletions
diff --git a/quantum/keycode_config.c b/quantum/keycode_config.c index 5b5cc5d28e..9dd7097c86 100644 --- a/quantum/keycode_config.c +++ b/quantum/keycode_config.c @@ -16,14 +16,12 @@ #include "keycode_config.h" -extern keymap_config_t keymap_config; - /** \brief keycode_config * * This function is used to check a specific keycode against the bootmagic config, * and will return the corrected keycode, when appropriate. */ -uint16_t keycode_config(uint16_t keycode) { +__attribute__((weak)) uint16_t keycode_config(uint16_t keycode) { switch (keycode) { case KC_CAPS_LOCK: case KC_LOCKING_CAPS_LOCK: @@ -123,7 +121,7 @@ uint16_t keycode_config(uint16_t keycode) { * and will remove or replace mods, based on that. */ -uint8_t mod_config(uint8_t mod) { +__attribute__((weak)) uint8_t mod_config(uint8_t mod) { if (keymap_config.swap_lalt_lgui) { if ((mod & MOD_RGUI) == MOD_LGUI) { mod &= ~MOD_LGUI; diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index c4336440f9..f4982e8291 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -72,13 +72,21 @@ action_t action_for_keycode(uint16_t keycode) { action.code = ACTION_TRANSPARENT; break; case QK_MODS ... QK_MODS_MAX:; - // Has a modifier - // Split it up + // Has a modifier + // Split it up +#ifdef LEGACY_MAGIC_HANDLING action.code = ACTION_MODS_KEY(QK_MODS_GET_MODS(keycode), QK_MODS_GET_BASIC_KEYCODE(keycode)); // adds modifier to key +#else // LEGACY_MAGIC_HANDLING + action.code = ACTION_MODS_KEY(mod_config(QK_MODS_GET_MODS(keycode)), keycode_config(QK_MODS_GET_BASIC_KEYCODE(keycode))); // adds modifier to key +#endif // LEGACY_MAGIC_HANDLING break; #ifndef NO_ACTION_LAYER case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: +# ifdef LEGACY_MAGIC_HANDLING action.code = ACTION_LAYER_TAP_KEY(QK_LAYER_TAP_GET_LAYER(keycode), QK_LAYER_TAP_GET_TAP_KEYCODE(keycode)); +# else // LEGACY_MAGIC_HANDLING + action.code = ACTION_LAYER_TAP_KEY(QK_LAYER_TAP_GET_LAYER(keycode), keycode_config(QK_LAYER_TAP_GET_TAP_KEYCODE(keycode))); +# endif // LEGACY_MAGIC_HANDLING break; case QK_TO ... QK_TO_MAX:; // Layer set "GOTO" @@ -125,13 +133,21 @@ action_t action_for_keycode(uint16_t keycode) { #endif #ifndef NO_ACTION_TAPPING case QK_MOD_TAP ... QK_MOD_TAP_MAX: - mod = mod_config(QK_MOD_TAP_GET_MODS(keycode)); + mod = mod_config(QK_MOD_TAP_GET_MODS(keycode)); +# ifdef LEGACY_MAGIC_HANDLING action.code = ACTION_MODS_TAP_KEY(mod, QK_MOD_TAP_GET_TAP_KEYCODE(keycode)); +# else // LEGACY_MAGIC_HANDLING + action.code = ACTION_MODS_TAP_KEY(mod, keycode_config(QK_MOD_TAP_GET_TAP_KEYCODE(keycode))); +# endif // LEGACY_MAGIC_HANDLING break; #endif #ifdef SWAP_HANDS_ENABLE case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX: +# ifdef LEGACY_MAGIC_HANDLING action.code = ACTION(ACT_SWAP_HANDS, QK_SWAP_HANDS_GET_TAP_KEYCODE(keycode)); +# else // LEGACY_MAGIC_HANDLING + action.code = ACTION(ACT_SWAP_HANDS, keycode_config(QK_SWAP_HANDS_GET_TAP_KEYCODE(keycode))); +# endif // LEGACY_MAGIC_HANDLING break; #endif |