5619: Make UI inputs more secure r=def- a=C0D3D3V

fixes #3560 finally :) what a dream xD

This in addition also fixes an input bug, if you hold a mouse button on an input and then open f1 it no longer presses that button.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [x] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
This commit is contained in:
bors[bot] 2022-07-14 16:17:55 +00:00 committed by GitHub
commit 96896ddf5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -2385,6 +2385,8 @@ void CMenus::SetActive(bool Active)
{
ms_ColorPicker.m_Active = false;
Input()->SetIMEState(Active);
UI()->SetHotItem(nullptr);
UI()->SetActiveItem(nullptr);
}
m_MenuActive = Active;
if(!m_MenuActive)

View file

@ -155,6 +155,11 @@ void CUI::Update(float MouseX, float MouseY, float MouseWorldX, float MouseWorld
if(m_pActiveItem)
m_pHotItem = m_pActiveItem;
m_pBecomingHotItem = 0;
if(!Enabled())
{
m_pHotItem = nullptr;
m_pActiveItem = nullptr;
}
}
bool CUI::MouseInside(const CUIRect *pRect) const