engine: client: touch: forcefully disable edit mode when setclientonly was called

This commit is contained in:
Alibek Omarov
2025-10-08 03:52:50 +05:00
parent d16ef9bf2a
commit 0a5a081a9d

View File

@@ -527,12 +527,32 @@ static touch_button_t *Touch_FindFirst( touchbuttonlist_t *list, const char *nam
return Touch_FindNext( list->first, name, privileged );
}
static void Touch_DisableEdit_f( void )
{
touch.state = state_none;
if( touch.edit )
touch.edit->finger = -1;
if( touch.selection )
touch.selection->finger = -1;
touch.edit = touch.selection = NULL;
touch.resize_finger = touch.move_finger = touch.look_finger = touch.wheel_finger = -1;
if( touch_in_menu.value )
Cvar_DirectSet( &touch_in_menu, "0" );
else if( cls.key_dest == key_game )
Touch_WriteConfig();
}
void Touch_SetClientOnly( byte state )
{
// TODO: fix clash with vgui cursors
if( touch.clientonly == state )
return;
// a1ba: the way client only touch buttons are used, they might come from
// client.dll, locking user in edit state, so disable it first
Touch_DisableEdit_f();
touch.clientonly = state;
touch.resize_finger = touch.move_finger = touch.look_finger = touch.wheel_finger = -1;
@@ -1021,22 +1041,6 @@ static void Touch_EnableEdit_f( void )
}
}
static void Touch_DisableEdit_f( void )
{
touch.state = state_none;
if( touch.edit )
touch.edit->finger = -1;
if( touch.selection )
touch.selection->finger = -1;
touch.edit = touch.selection = NULL;
touch.resize_finger = touch.move_finger = touch.look_finger = touch.wheel_finger = -1;
if( touch_in_menu.value )
Cvar_DirectSet( &touch_in_menu, "0" );
else if( cls.key_dest == key_game )
Touch_WriteConfig();
}
static void Touch_DeleteProfile_f( void )
{
if( Cmd_Argc() != 2 )