ddnet/src/game/client
bors[bot] 59acac221c
Merge #5254 #5257
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>
2022-05-27 18:37:17 +00:00
..
components Merge #5254 #5257 2022-05-27 18:37:17 +00:00
prediction Remove predicted character from gameworld before calling base class destructor 2022-05-26 19:08:46 +02:00
animstate.cpp Fix clang-analyzer-core.UndefinedBinaryOperatorResult 2020-10-14 15:45:47 +02:00
animstate.h Remove unnecessary trailing semicolons after method declarations 2022-03-08 20:01:26 +01:00
component.cpp Unify logging infrastructure between IConsole and dbg_msg 2022-04-29 15:21:26 +02:00
component.h Unify logging infrastructure between IConsole and dbg_msg 2022-04-29 15:21:26 +02:00
gameclient.cpp Move CMenus::UseMouseButtons to CUI::SetEnabled 2022-05-27 19:43:12 +02:00
gameclient.h Mark virtual function as override using a script: 2022-05-17 23:47:32 +02:00
lineinput.cpp Remove base/tl/base.h 2022-05-15 20:36:16 +02:00
lineinput.h m_DisplayStr -> m_aDisplayStr 2022-03-31 12:52:24 +02:00
projectile_data.cpp Sanitize owner data in client (fixes #4388) 2021-11-24 15:41:27 +01:00
projectile_data.h force tunezone 2021-04-23 11:01:38 +08:00
race.cpp Add modernize-deprecated-headers 2022-02-15 00:22:52 +01:00
race.h Fix all the header guards and adjust the script a little 2018-07-06 16:11:38 +02:00
render.cpp Extract CRenderTools::RenderCursor 2022-05-27 19:43:12 +02:00
render.h Extract CRenderTools::RenderCursor 2022-05-27 19:43:12 +02:00
render_map.cpp Add missing nanosecond conversions 2022-05-22 16:08:11 +02:00
skin.h Use std::vector<CSkin> instead of sorted_array 2022-05-27 00:03:13 +02:00
ui.cpp Merge #5254 #5257 2022-05-27 18:37:17 +00:00
ui.h Merge #5254 #5257 2022-05-27 18:37:17 +00:00
ui_ex.cpp Use SetActiveItem(nullptr) instead of SetActiveItem(0) 2022-05-27 11:59:14 +02:00
ui_ex.h Auto select search string on hot key 2022-03-13 19:12:06 +01:00