4746: Fix listbox item double click behavior r=def- a=Robyt3

Closes #4745.

## 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>
This commit is contained in:
bors[bot] 2022-02-20 19:24:01 +00:00 committed by GitHub
commit 4581233882
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -634,8 +634,10 @@ CMenus::CListboxItem CMenus::UiDoListboxNextItem(const void *pId, bool Selected,
HitRect.h = minimum(HitRect.h, (gs_ListBoxOriginalView.y + gs_ListBoxOriginalView.h) - HitRect.y);
bool DoubleClickable = false;
if(Item.m_Visible && UI()->DoButtonLogic(pId, "", gs_ListBoxSelectedIndex == gs_ListBoxItemIndex, &HitRect))
{
DoubleClickable |= gs_ListBoxNewSelected == ThisItemIndex;
gs_ListBoxClicked = true;
gs_ListBoxNewSelected = ThisItemIndex;
}
@ -647,7 +649,7 @@ CMenus::CListboxItem CMenus::UiDoListboxNextItem(const void *pId, bool Selected,
{
gs_ListBoxDoneEvents = 1;
if(m_EnterPressed || (UI()->ActiveItem() == pId && Input()->MouseDoubleClick()))
if(m_EnterPressed || (DoubleClickable && Input()->MouseDoubleClick()))
{
gs_ListBoxItemActivated = true;
UI()->SetActiveItem(0);