5254: Fix ingame menu button behavior when holding mouse button r=def- a=Robyt3
Fixes the following behavior:
1. Player is ingame and the ingame menu is opened with Esc
2. A mouse button is held down on one of the ingame menu buttons (e.g. the spectate button)
3. The ingame menu is closed without moving the mouse away from the button
4. The mouse button is released while ingame
5. The menu is opened again
- Current behavior: The hovered button is immediately activated, as soon as the menu opens, due to the released mouse state being handled as a click.
- Fixed behavior: The button is not activated. Instead another call to `FinishCheck` is added so it's also called when the menu is not active, to clear the active UI item in that case.
As well as the following:
1. The menu is closed while the mouse cursor is hovering over a button.
2. The mouse button is pressed and held while the menu is closed.
3. The menu is opened again.
- Current behavior: The menu button is already held down and when the player releases the mouse button it will immediately be activated.
- Fixed behavior: The button is not activated immediately, by clearing the hot item and next hot item variables in `FinishCheck`.
The latter behavior can still occur when entering the editor instead of closing the ingame menu.
Closes#3560. Closes#5229.
The first two commits are identical to upstream https://github.com/teeworlds/teeworlds/pull/3158, where those issues also exist. The last commit adapts upstream behavior so buttons can only become hot when the mouse is not pressed.
## 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 if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
5257: Refactoring: Move CMenus::UseMouseButtons to CUI::SetEnabled, extract CRenderTools::RenderCursor r=def- a=Robyt3
Adopt changes from upstream.
## 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 if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] 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: Robert Müller <robytemueller@gmail.com>
As reported by louis:
> while saving a mapname while having the "Server Settings" tab open,
> pressing "m" while typing the mapname will unfocus the cursor from the
> mapname field onto the server settings field