engine: client: small refactoring and better explanation for char input handler for menus that don't query our extended API

This commit is contained in:
Alibek Omarov 2025-01-06 15:58:47 +03:00
parent 2a7f13151a
commit 93d3df81ee

View file

@ -743,18 +743,24 @@ void GAME_EXPORT Key_Event( int key, int down )
if( cls.key_dest == key_menu )
{
// only non printable keys passed
// classic Xash3D menus don't have an extension that tells engine
// to enable text input
if( !gameui.use_extended_api )
{
// we don't know if menu wants text input or not
// enable it unconditionally
Key_EnableTextInput( true, false );
//pass printable chars for old menus
if( !gameui.use_extended_api && !host.textmode && down && ( key >= 32 ) && ( key <= 'z' ) )
{
if( Key_IsDown( K_SHIFT ) )
// pass this key to the menu, if printable
if( !host.textmode && down && ( key >= 32 ) && ( key <= 'z' ))
{
if( Key_IsDown( K_SHIFT ))
key += 'A' - 'a';
}
UI_CharEvent( key );
}
}
UI_KeyEvent( key, down );
return;
}