aboutsummaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorフィルターペーパー2025-11-07 00:03:28 +0100
committerGitHub2025-11-07 00:03:28 +0100
commit1a991ffd24b8a5414b72c10dfc0fbea0afc085c2 (patch)
treef59c443f603f5331a10745d2e102981dedc65c72 /quantum
parent01d81b95508f8411490467fe785b84d73495bdb9 (diff)
Guard remapping logic with MAGIC_ENABLE (#25537)
* Only perform key and mod remapping in keycode_config() and mod_config() when MAGIC_ENABLE is defined. * If not set, these functions now return the original keycode or modifier unchanged. * Reduces firmware size, and unnecessary code when MAGIC_ENABLE is not enabled. * Removed space saving suggestion with magic functions from squeezing AVR documentation
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keycode_config.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/quantum/keycode_config.c b/quantum/keycode_config.c
index cbfbcc8140..f5068902d5 100644
--- a/quantum/keycode_config.c
+++ b/quantum/keycode_config.c
@@ -24,6 +24,7 @@ keymap_config_t keymap_config;
* and will return the corrected keycode, when appropriate.
*/
__attribute__((weak)) uint16_t keycode_config(uint16_t keycode) {
+#ifdef MAGIC_ENABLE
switch (keycode) {
case KC_CAPS_LOCK:
case KC_LOCKING_CAPS_LOCK:
@@ -115,6 +116,9 @@ __attribute__((weak)) uint16_t keycode_config(uint16_t keycode) {
default:
return keycode;
}
+#else
+ return keycode;
+#endif // MAGIC_ENABLE
}
/** \brief mod_config
@@ -124,6 +128,7 @@ __attribute__((weak)) uint16_t keycode_config(uint16_t keycode) {
*/
__attribute__((weak)) uint8_t mod_config(uint8_t mod) {
+#ifdef MAGIC_ENABLE
/**
* Note: This function is for the 5-bit packed mods, NOT the full 8-bit mods.
* More info about the mods can be seen in modifiers.h.
@@ -161,5 +166,6 @@ __attribute__((weak)) uint8_t mod_config(uint8_t mod) {
mod &= ~MOD_RGUI;
}
+#endif // MAGIC_ENABLE
return mod;
}