Skip to content

Commit 84e6fe4

Browse files
committed
Fix IsWindowAppearing() from returning true twice in most cases. (ocornut#3982, ocornut#1497, ocornut#1061)
1 parent 951c849 commit 84e6fe4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Other Changes:
4141

4242
- Scrolling: Fix scroll tracking with e.g. SetScrollHereX/Y() when WindowPadding < ItemSpacing.
4343
- Scrolling: Fix scroll snapping on edge of scroll region when both scrollbars are enabled.
44+
- Window: Fix IsWindowAppearing() from returning true twice in most cases. (#3982, #1497, #1061)
4445
- Tables: Expose TableSetColumnEnabled() in public api. (#3935)
4546
- TabBar: Fixed mouse reordering with very fast movements (e.g. crossing multiple tabs in a single
4647
frame and then immediately standling still (would only affect automation/bots). [@rokups]

imgui.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5703,14 +5703,13 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
57035703

57045704
// Update the Appearing flag
57055705
bool window_just_activated_by_user = (window->LastFrameActive < current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on
5706-
const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFramesCannotSkipItems > 0);
57075706
if (flags & ImGuiWindowFlags_Popup)
57085707
{
57095708
ImGuiPopupData& popup_ref = g.OpenPopupStack[g.BeginPopupStack.Size];
57105709
window_just_activated_by_user |= (window->PopupId != popup_ref.PopupId); // We recycle popups so treat window as activated if popup id changed
57115710
window_just_activated_by_user |= (window != popup_ref.Window);
57125711
}
5713-
window->Appearing = (window_just_activated_by_user || window_just_appearing_after_hidden_for_resize);
5712+
window->Appearing = window_just_activated_by_user;
57145713
if (window->Appearing)
57155714
SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, true);
57165715

@@ -5967,6 +5966,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
59675966
window->Pos = parent_window->DC.CursorPos;
59685967
}
59695968

5969+
const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFramesCannotSkipItems > 0);
59705970
const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFramesCannotSkipItems == 0);
59715971
if (window_pos_with_pivot)
59725972
SetWindowPos(window, window->SetWindowPosVal - window->Size * window->SetWindowPosPivot, 0); // Position given a pivot (e.g. for centering)

0 commit comments

Comments
 (0)