]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Fix issue #221: LGUI(KC_LSFT) does not work
authorDidier Loiseau <didierloiseau+git@gmail.com>
Tue, 5 Apr 2016 22:19:12 +0000 (00:19 +0200)
committerDidier Loiseau <didierloiseau+git@gmail.com>
Tue, 5 Apr 2016 22:30:50 +0000 (00:30 +0200)
on mod keys, register LGUI, LSFT etc. as normal mods
 instead of weak mods:
 - they won't be cleared when pressing another key (#188)
 - they won't be cleared by layer switching
 - LSFT(KC_LGUI) will now have the same behavior as LGUI(KC_LSFT)

tmk_core/common/action.c

index 2ccc0e0b947bdd79342e3b31e02b89a02de72397..901089634368561003b95b5a5e325ddda0e08228 100644 (file)
@@ -88,14 +88,24 @@ void process_action(keyrecord_t *record)
                                                                 action.key.mods<<4;
                 if (event.pressed) {
                     if (mods) {
-                        add_weak_mods(mods);
+                        if (IS_MOD(action.key.code)) {
+                            // e.g. LSFT(KC_LGUI): we don't want the LSFT to be weak as it would make it useless.
+                            // this also makes LSFT(KC_LGUI) behave exactly the same as LGUI(KC_LSFT)
+                            add_mods(mods);
+                        } else {
+                            add_weak_mods(mods);
+                        }
                         send_keyboard_report();
                     }
                     register_code(action.key.code);
                 } else {
                     unregister_code(action.key.code);
                     if (mods) {
-                        del_weak_mods(mods);
+                        if (IS_MOD(action.key.code)) {
+                            del_mods(mods);
+                        } else {
+                            del_weak_mods(mods);
+                        }
                         send_keyboard_report();
                     }
                 }