Commit graph

10 commits

Author SHA1 Message Date
Ricardo Hermida Ruiz
d3b8179f46
Prevent Tri-Layer keys from stopping caps words (#20398) 2023-04-10 13:45:25 +01:00
Pascal Getreuer
ae63c0f509
[Core] Caps Word "Invert on shift" option: pressing Shift inverts the shift state. (#20092)
Co-authored-by: Nick Brassel <nick@tzarc.org>
2023-04-04 09:11:26 +10:00
Drashna Jaelre
48a79b08cc
Fix functions when NO_ACTION_TAPPING is defined (#11528) 2023-02-19 12:08:03 +11:00
Ryan
2d843088a2
Normalise Swap Hands keycodes (#19720) 2023-01-30 18:37:19 +00:00
Sergey Vlasov
a7b2f4233c
Fix keycode parameter extraction to match the new DD keycodes (#18977)
* Add macros to extract parameters from keycode values

Implement both encoding and decoding for keycodes like TO(layer) or
LM(layer, mod) in one place, so that the decoding won't get out of sync
with the encoding.

While at it, fix some macros for creating keycode values that did not
apply the appropriate masks to parameters (and therefore could allow the
result to be out of range if a wrong parameter was passed).

* keymap_common: Use extraction macros for keycodes

* pointing_device_auto_mouse: Use extraction macros for keycodes

Fixes #18970.

* process_autocorrect: Use extraction macros for keycodes

* process_caps_word: Use extraction macros for keycodes

(Also fix a minor bug - SH_TG was not handled properly)

* process_leader: Use extraction macros for keycodes

(Technically the code is not 100% correct, because it always assumes
that the LT() or MT() action was a tap, but it's a separate issue that
already existed before the keycode changes.)

* process_unicode: Use extraction macros for keycodes

* process_unicodemap: Use extraction macros for keycodes
2022-11-06 21:39:05 +00:00
Ryan
a80b886751
Deprecate CAPS_WORD/CAPSWRD for CW_TOGG (#18834) 2022-10-24 17:30:37 +01:00
Pascal Getreuer
95c43a2759
Fix Caps Word to treat mod-taps more consistently. (#17463)
* Fix Caps Word to treat mod-taps more consistently.

Previously, holding any mod-tap key while Caps Word is active stops Caps
Word, and this happens regardless of `caps_word_press_user()`. Yet for
regular mod keys, AltGr (KC_RALT) is ignored, Shift keys are passed to
`caps_word_press_user()` to determine whether to continue, and
similarly, a key `RSFT(KC_RALT)` representing Right Shift + Alt is
passed to `caps_word_press_user()` to determine whether to continue.

This commit makes held mod-tap keys consistent with regular mod keys:

* Holding a `RALT_T` mod-tap is ignored.
* When holding a shift mod-tap key, `KC_LSFT` or `KC_RSFT` is passed to
  `caps_word_press_user()` to determine whether to continue.
* When holding a Right Shift + Alt (`RSA_T`) mod-tap, `RSFT(KC_RALT)` is
  passed to `caps_word_press_user()`.

Particularly, with this fix a user may choose to continue Caps Word when
a shift mod-tap key is held by adding `KC_LSFT` and `KC_RSFT` cases in
`caps_word_press_user()`. For instance as

```
bool caps_word_press_user(uint16_t keycode) {
  switch (keycode) {
    // Keycodes that continue Caps Word, with shift applied.
    case KC_A ... KC_Z:
    case KC_MINS:
      add_weak_mods(MOD_BIT(KC_LSFT));  // Apply shift to the next key.
      return true;

    // Keycodes that continue Caps Word, without shifting.
    case KC_1 ... KC_0:
    case KC_BSPC:
    case KC_DEL:
    case KC_UNDS:
    case KC_LSFT:  // <<< Added here.
    case KC_RSFT:
      return true;

    default:
      return false;  // Deactivate Caps Word.
  }
}
```

* Fix Caps Word to treat mod-taps more consistently.

Previously, holding any mod-tap key while Caps Word is active stops Caps
Word, and this happens regardless of `caps_word_press_user()`. Yet for
regular mod keys, AltGr (KC_RALT) is ignored, Shift keys are passed to
`caps_word_press_user()` to determine whether to continue, and
similarly, a key `RSFT(KC_RALT)` representing Right Shift + Alt is
passed to `caps_word_press_user()` to determine whether to continue.

This commit makes held mod-tap keys consistent with regular mod keys:

* Holding a `RALT_T` mod-tap is ignored.
* When holding a shift mod-tap key, `KC_LSFT` or `KC_RSFT` is passed to
  `caps_word_press_user()` to determine whether to continue.
* When holding a Right Shift + Alt (`RSA_T`) mod-tap, `RSFT(KC_RALT)` is
  passed to `caps_word_press_user()`.

Particularly, with this fix a user may choose to continue Caps Word when
a shift mod-tap key is held by adding `KC_LSFT` and `KC_RSFT` cases in
`caps_word_press_user()`. For instance as

```
bool caps_word_press_user(uint16_t keycode) {
  switch (keycode) {
    // Keycodes that continue Caps Word, with shift applied.
    case KC_A ... KC_Z:
    case KC_MINS:
      add_weak_mods(MOD_BIT(KC_LSFT));  // Apply shift to the next key.
      return true;

    // Keycodes that continue Caps Word, without shifting.
    case KC_1 ... KC_0:
    case KC_BSPC:
    case KC_DEL:
    case KC_UNDS:
    case KC_LSFT:  // <<< Added here.
    case KC_RSFT:
      return true;

    default:
      return false;  // Deactivate Caps Word.
  }
}
```

* Update quantum/process_keycode/process_caps_word.c

Co-authored-by: Joel Challis <git@zvecr.com>
2022-08-14 20:25:32 +01:00
Pascal Getreuer
6a0d90f81a
Fix Caps Word capitalization when used with Combos + Auto Shift. (#17549) 2022-08-13 23:48:51 +10:00
Pascal Getreuer
b5608cbb6d
Continue Caps Word when AltGr (right Alt) is held. (#17156)
This is a minor bug fix for Caps Word. Currently, Caps Word turns off
whenever a non-shift mod becomes active. This is done to avoid
interfering with hotkeys.

This commit makes an exception to continue Caps Word when AltGr (right
Alt) is held. Outside the US, the AltGr key is used to type additional
symbols (https://en.wikipedia.org/wiki/AltGr_key). Depending on the
language, these may include symbols used within words like accented
letters where it would be desirable to continue Caps Word.
2022-05-20 01:39:00 +01:00
Pascal Getreuer
68b16bba68
[Core] Add Caps Word feature to core (#16588)
Co-authored-by: precondition <57645186+precondition@users.noreply.github.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
2022-05-14 16:00:32 +10:00