From 232180299f9aeefb1cf950ace74d776d5bc76b5b Mon Sep 17 00:00:00 2001 From: PS Date: Thu, 8 Apr 2021 14:53:41 -1000 Subject: [PATCH] Fixed a problem with dropdowns where, if you clicked a button inside them, they wouldn't register that they are no longer open. --- src/app/editor/interface.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/editor/interface.h b/src/app/editor/interface.h index a1af8c1..6a0e228 100644 --- a/src/app/editor/interface.h +++ b/src/app/editor/interface.h @@ -1386,13 +1386,20 @@ ui_BeginDropdown(ui_interface* Interface, gs_string Text) internal void ui_EndDropdown(ui_interface* Interface) { + gs_string LayoutName = MakeString("DropdownLayout"); ui_widget* Layout = Interface->ActiveLayout; ui_widget_retained_state* State = ui_GetRetainedState(Interface, Layout->WidgetReference); if (State) { - if (State->Value) + bool IsOpen = State->Value; + ui_widget* Widget = Interface->ActiveLayout; + bool IsStillHot = StringsEqualUpToLength(Widget->String, LayoutName, LayoutName.Length); + if (IsOpen && IsStillHot) { - ui_PopLayout(Interface, MakeString("DropdownLayout")); + ui_PopLayout(Interface, LayoutName); + } else if (IsOpen && !IsStillHot) + { + State->Value = false; } } }