mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-25 00:56:35 +00:00
Reverted 11025b3160
, 129339adb0
it breaks collapsing implicit debug window
This commit is contained in:
parent
2d81a73f85
commit
c070314621
11
imgui.cpp
11
imgui.cpp
@ -1169,6 +1169,7 @@ struct ImGuiWindow
|
|||||||
float NextScrollY;
|
float NextScrollY;
|
||||||
bool ScrollbarY;
|
bool ScrollbarY;
|
||||||
bool Visible; // Set to true on Begin()
|
bool Visible; // Set to true on Begin()
|
||||||
|
bool Accessed; // Set to true when any widget access the current window
|
||||||
bool Collapsed; // Set when collapsing window to become only title-bar
|
bool Collapsed; // Set when collapsing window to become only title-bar
|
||||||
bool SkipItems; // == Visible && !Collapsed
|
bool SkipItems; // == Visible && !Collapsed
|
||||||
int AutoFitFrames;
|
int AutoFitFrames;
|
||||||
@ -1222,6 +1223,7 @@ static inline ImGuiWindow* GetCurrentWindow()
|
|||||||
{
|
{
|
||||||
ImGuiState& g = *GImGui;
|
ImGuiState& g = *GImGui;
|
||||||
IM_ASSERT(g.CurrentWindow != NULL); // ImGui::NewFrame() hasn't been called yet?
|
IM_ASSERT(g.CurrentWindow != NULL); // ImGui::NewFrame() hasn't been called yet?
|
||||||
|
g.CurrentWindow->Accessed = true;
|
||||||
return g.CurrentWindow;
|
return g.CurrentWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1510,6 +1512,7 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
|||||||
NextScrollY = 0.0f;
|
NextScrollY = 0.0f;
|
||||||
ScrollbarY = false;
|
ScrollbarY = false;
|
||||||
Visible = false;
|
Visible = false;
|
||||||
|
Accessed = false;
|
||||||
Collapsed = false;
|
Collapsed = false;
|
||||||
SkipItems = false;
|
SkipItems = false;
|
||||||
AutoFitFrames = -1;
|
AutoFitFrames = -1;
|
||||||
@ -1934,6 +1937,7 @@ void ImGui::NewFrame()
|
|||||||
{
|
{
|
||||||
ImGuiWindow* window = g.Windows[i];
|
ImGuiWindow* window = g.Windows[i];
|
||||||
window->Visible = false;
|
window->Visible = false;
|
||||||
|
window->Accessed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No window should be open at the beginning of the frame.
|
// No window should be open at the beginning of the frame.
|
||||||
@ -2060,8 +2064,7 @@ void ImGui::Render()
|
|||||||
{
|
{
|
||||||
// Hide implicit window if it hasn't been used
|
// Hide implicit window if it hasn't been used
|
||||||
IM_ASSERT(g.CurrentWindowStack.size() == 1); // Mismatched Begin/End
|
IM_ASSERT(g.CurrentWindowStack.size() == 1); // Mismatched Begin/End
|
||||||
if (ImGuiWindow* window = g.CurrentWindow)
|
if (g.CurrentWindow && !g.CurrentWindow->Accessed)
|
||||||
if (ImLengthSqr(window->DC.CursorMaxPos - window->DC.CursorStartPos) < 0.001f)
|
|
||||||
g.CurrentWindow->Visible = false;
|
g.CurrentWindow->Visible = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
@ -3194,6 +3197,10 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg
|
|||||||
clip_rect.z -= style.ScrollbarWidth;
|
clip_rect.z -= style.ScrollbarWidth;
|
||||||
PushClipRect(clip_rect);
|
PushClipRect(clip_rect);
|
||||||
|
|
||||||
|
// Clear 'accessed' flag last thing
|
||||||
|
if (first_begin_of_the_frame)
|
||||||
|
window->Accessed = false;
|
||||||
|
|
||||||
// Child window can be out of sight and have "negative" clip windows.
|
// Child window can be out of sight and have "negative" clip windows.
|
||||||
// Mark them as collapsed so commands are skipped earlier (we can't manually collapse because they have no title bar).
|
// Mark them as collapsed so commands are skipped earlier (we can't manually collapse because they have no title bar).
|
||||||
if (flags & ImGuiWindowFlags_ChildWindow)
|
if (flags & ImGuiWindowFlags_ChildWindow)
|
||||||
|
Loading…
Reference in New Issue
Block a user