Skip to content

Commit

Permalink
Take into an account SHIFT and CAPS LOCK being used at the same time
Browse files Browse the repository at this point in the history
relates to #8098

If a user has active CAPS LOCK and uses SHIFT while typing, the letters must be non-capital.
  • Loading branch information
ihhub committed Dec 24, 2023
1 parent 05b1131 commit 7db8058
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/engine/localevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,12 @@ namespace
return modifier;
}

char getCharacterFromPressedKey( const fheroes2::Key key, const int32_t mod )
char getCharacterFromPressedKey( const fheroes2::Key key, int32_t mod )
{
if ( ( mod & fheroes2::KeyModifier::KEY_MODIFIER_SHIFT ) && ( mod & fheroes2::KeyModifier::KEY_MODIFIER_CAPS ) ) {
mod = mod & ~( fheroes2::KeyModifier::KEY_MODIFIER_SHIFT | fheroes2::KeyModifier::KEY_MODIFIER_CAPS );
}

switch ( key ) {
case fheroes2::Key::KEY_1:
return ( fheroes2::KeyModifier::KEY_MODIFIER_SHIFT & mod ? '!' : '1' );
Expand Down

0 comments on commit 7db8058

Please sign in to comment.