[UI] Fix ClearInput not called in ImGuiDrawer after deferred dialog removal

Also cleanup the code involved in dialog registration, and update the explanation of why dialog removal is delayed until the end of drawing (the original was written back when window listener and UI drawer callback registration during the execution of the callbacks was deferred, but that was wrong as that might result in execution of callbacks belonging to now-deleted objects).
This commit is contained in:
Triang3l
2022-10-31 18:57:54 +03:00
parent a37b57ca8d
commit 778333b1b5
2 changed files with 35 additions and 23 deletions

View File

@@ -74,6 +74,9 @@ class ImGuiDrawer : public WindowInputListener, public UIDrawer {
void UpdateMousePosition(float x, float y);
void SwitchToPhysicalMouseAndUpdateMousePosition(const MouseEvent& e);
bool IsDrawingDialogs() const { return dialog_loop_next_index_ != SIZE_MAX; }
void DetachIfLastDialogRemoved();
Window* window_;
size_t z_order_;