mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #4746
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:
commit
4581233882
|
@ -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);
|
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))
|
if(Item.m_Visible && UI()->DoButtonLogic(pId, "", gs_ListBoxSelectedIndex == gs_ListBoxItemIndex, &HitRect))
|
||||||
{
|
{
|
||||||
|
DoubleClickable |= gs_ListBoxNewSelected == ThisItemIndex;
|
||||||
gs_ListBoxClicked = true;
|
gs_ListBoxClicked = true;
|
||||||
gs_ListBoxNewSelected = ThisItemIndex;
|
gs_ListBoxNewSelected = ThisItemIndex;
|
||||||
}
|
}
|
||||||
|
@ -647,7 +649,7 @@ CMenus::CListboxItem CMenus::UiDoListboxNextItem(const void *pId, bool Selected,
|
||||||
{
|
{
|
||||||
gs_ListBoxDoneEvents = 1;
|
gs_ListBoxDoneEvents = 1;
|
||||||
|
|
||||||
if(m_EnterPressed || (UI()->ActiveItem() == pId && Input()->MouseDoubleClick()))
|
if(m_EnterPressed || (DoubleClickable && Input()->MouseDoubleClick()))
|
||||||
{
|
{
|
||||||
gs_ListBoxItemActivated = true;
|
gs_ListBoxItemActivated = true;
|
||||||
UI()->SetActiveItem(0);
|
UI()->SetActiveItem(0);
|
||||||
|
|
Loading…
Reference in a new issue