diff options
author | Drashna Jaelre <drashna@live.com> | 2019-08-22 00:22:32 -0700 |
---|---|---|
committer | Florian Didron <fdidron@users.noreply.github.com> | 2019-08-28 14:49:46 +0900 |
commit | aa074cf592d367b86803a21fb53e185743cccab9 (patch) | |
tree | 853202d2c8b029499b746a52945f55f5a14fd9e9 /quantum | |
parent | e5224082f197399a8d549f04e6f5a6343e46152d (diff) |
Fixup Bootmagic code (#6386)
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/keycode_config.c | 11 | ||||
-rw-r--r-- | quantum/quantum.c | 16 |
2 files changed, 17 insertions, 10 deletions
diff --git a/quantum/keycode_config.c b/quantum/keycode_config.c index 73fe15861d..bfd40d045c 100644 --- a/quantum/keycode_config.c +++ b/quantum/keycode_config.c @@ -18,6 +18,11 @@ 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) { switch (keycode) { @@ -109,6 +114,12 @@ uint16_t keycode_config(uint16_t keycode) { } } +/** \brief mod_config + * + * This function checks the mods passed to it against the bootmagic config, + * and will remove or replace mods, based on that. + */ + uint8_t mod_config(uint8_t mod) { if (keymap_config.swap_lalt_lgui) { if ((mod & MOD_RGUI) == MOD_LGUI) { diff --git a/quantum/quantum.c b/quantum/quantum.c index b87fedbf70..c5a44d1074 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -609,15 +609,13 @@ bool process_record_quantum(keyrecord_t *record) { keymap_config.nkro = true; break; case MAGIC_SWAP_ALT_GUI: - keymap_config.swap_lalt_lgui = true; - keymap_config.swap_ralt_rgui = true; + keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = true; #ifdef AUDIO_ENABLE PLAY_SONG(ag_swap_song); #endif break; case MAGIC_SWAP_CTL_GUI: - keymap_config.swap_lctl_lgui = true; - keymap_config.swap_rctl_rgui = true; + keymap_config.swap_lctl_lgui = keymap_config.swap_rctl_rgui = true; #ifdef AUDIO_ENABLE PLAY_SONG(cg_swap_song); #endif @@ -653,22 +651,20 @@ bool process_record_quantum(keyrecord_t *record) { keymap_config.nkro = false; break; case MAGIC_UNSWAP_ALT_GUI: - keymap_config.swap_lalt_lgui = false; - keymap_config.swap_ralt_rgui = false; + keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = false; #ifdef AUDIO_ENABLE PLAY_SONG(ag_norm_song); #endif break; case MAGIC_UNSWAP_CTL_GUI: - keymap_config.swap_lctl_lgui = false; - keymap_config.swap_rctl_rgui = false; + keymap_config.swap_lctl_lgui = keymap_config.swap_rctl_rgui = false; #ifdef AUDIO_ENABLE PLAY_SONG(cg_norm_song); #endif break; case MAGIC_TOGGLE_ALT_GUI: keymap_config.swap_lalt_lgui = !keymap_config.swap_lalt_lgui; - keymap_config.swap_ralt_rgui = !keymap_config.swap_ralt_rgui; + keymap_config.swap_ralt_rgui = keymap_config.swap_lalt_lgui; #ifdef AUDIO_ENABLE if (keymap_config.swap_ralt_rgui) { PLAY_SONG(ag_swap_song); @@ -679,7 +675,7 @@ bool process_record_quantum(keyrecord_t *record) { break; case MAGIC_TOGGLE_CTL_GUI: keymap_config.swap_lctl_lgui = !keymap_config.swap_lctl_lgui; - keymap_config.swap_rctl_rgui = !keymap_config.swap_rctl_rgui; + keymap_config.swap_rctl_rgui = keymap_config.swap_lctl_lgui; #ifdef AUDIO_ENABLE if (keymap_config.swap_rctl_rgui) { PLAY_SONG(cg_swap_song); |