qmk_sweep_skeletyl/quantum/process_keycode
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
..
process_audio.c
process_audio.h
process_auto_shift.c Fix Caps Word capitalization when used with Combos + Auto Shift. (#17549) 2022-08-13 23:48:51 +10:00
process_auto_shift.h
process_backlight.c
process_backlight.h
process_caps_word.c Fix Caps Word to treat mod-taps more consistently. (#17463) 2022-08-14 20:25:32 +01:00
process_caps_word.h
process_clicky.c
process_clicky.h
process_combo.c Fix Caps Word capitalization when used with Combos + Auto Shift. (#17549) 2022-08-13 23:48:51 +10:00
process_combo.h
process_dynamic_macro.c Added Wait time to sending each Keys for Dynamic Macros function (#16800) 2022-07-02 21:48:26 +10:00
process_dynamic_macro.h
process_dynamic_tapping_term.c Feature-ify Send String (#17275) 2022-07-02 22:10:08 +10:00
process_dynamic_tapping_term.h
process_grave_esc.c
process_grave_esc.h
process_haptic.c
process_haptic.h
process_joystick.c Fix check when compiling HID Joystick with digital driver (#17844) 2022-07-30 01:32:06 +01:00
process_joystick.h
process_key_lock.c
process_key_lock.h
process_key_override.c
process_key_override.h
process_leader.c Fix keys being discarded after using the leader key (#17287) 2022-07-02 22:03:40 +10:00
process_leader.h
process_magic.c PoC: Swap Escape and Caps (#16336) 2022-07-02 22:08:48 +10:00
process_magic.h
process_midi.c
process_midi.h
process_music.c
process_music.h
process_printer.c
process_printer.h
process_printer_bb.c
process_programmable_button.c
process_programmable_button.h
process_rgb.c Allow for RGB actions to take place on Keydown instead of Keyup (#16886) 2022-07-02 22:49:49 +10:00
process_rgb.h
process_secure.c
process_secure.h
process_sequencer.c
process_sequencer.h
process_space_cadet.c
process_space_cadet.h
process_steno.c Rename postprocess_steno_user → post_process_steno_user (#17823) 2022-07-28 21:51:01 -07:00
process_steno.h Refactor steno and add STENO_PROTOCOL = [all|txbolt|geminipr] (#17065) 2022-06-23 20:43:24 +02:00
process_tap_dance.c tap-dance: Restructure code and document in more detail (#16394) 2022-06-13 22:12:55 +02:00
process_tap_dance.h tap-dance: Restructure code and document in more detail (#16394) 2022-06-13 22:12:55 +02:00
process_ucis.c
process_ucis.h
process_unicode.c
process_unicode.h
process_unicode_common.c Added emacs as an "operating system" for input mode. (#16949) 2022-08-14 20:24:52 +01:00
process_unicode_common.h Added emacs as an "operating system" for input mode. (#16949) 2022-08-14 20:24:52 +01:00
process_unicodemap.c
process_unicodemap.h