diff --git a/imgui.cpp b/imgui.cpp index 6d5b6bc9a..9154c7bf1 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1800,6 +1800,7 @@ ImGuiWindow::ImGuiWindow(const char* name) Collapsed = false; SkipItems = false; Appearing = false; + CloseButton = false; BeginCount = 0; PopupId = 0; AutoFitFramesX = AutoFitFramesY = -1; @@ -4130,6 +4131,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFrames == 1); window->Appearing = (window_just_activated_by_user || window_just_appearing_after_hidden_for_resize); + window->CloseButton = (p_open != NULL); // Process SetNextWindow***() calls bool window_pos_set_by_api = false, window_size_set_by_api = false; diff --git a/imgui_internal.h b/imgui_internal.h index be8d84d8a..6a081dfb6 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -700,6 +700,7 @@ struct IMGUI_API ImGuiWindow bool Collapsed; // Set when collapsing window to become only title-bar bool SkipItems; // Set when items can safely be all clipped (e.g. window not visible or collapsed) bool Appearing; // Set during the frame where the window is appearing (or re-appearing) + bool CloseButton; // Set when the window has a close button (p_open != NULL) int BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs) ImGuiID PopupId; // ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling) int AutoFitFramesX, AutoFitFramesY;