@ -3965,19 +3965,20 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
CheckStacksSize ( window , true ) ;
IM_ASSERT ( parent_window ! = NULL | | ! ( flags & ImGuiWindowFlags_ChildWindow ) ) ;
bool window_was_active = ( window - > LastFrameActive = = current_frame - 1 ) ; // Not using !WasActive because the implicit "Debug" window would always toggle off->on
// FIXME: This is currently true if we call Begin() multiple times in a row on a same window.
bool window_activated = ( window - > LastFrameActive ! = current_frame - 1 ) ; // Not using !WasActive because the implicit "Debug" window would always toggle off->on
if ( flags & ImGuiWindowFlags_Popup )
{
ImGuiPopupRef & popup_ref = g . OpenPopupStack [ g . CurrentPopupStack . Size ] ;
window_ was_active & = ( window - > PopupId = = popup_ref . PopupId ) ;
window_ was_active & = ( window = = popup_ref . Window ) ;
window_ activated | = ( window - > PopupId ! = popup_ref . PopupId ) ; // We recycle popups so treat window as activated if popup id changed
window_ activated | = ( window ! = popup_ref . Window ) ;
popup_ref . Window = window ;
g . CurrentPopupStack . push_back ( popup_ref ) ;
window - > PopupId = popup_ref . PopupId ;
}
const bool window_appearing_after_being_hidden = ( window - > HiddenFrames = = 1 ) ;
window - > Appearing = ( ! window_ was_ active | | window_appearing_after_being_hidden ) ;
window - > Appearing = ( window_ activat ed | | window_appearing_after_being_hidden ) ;
// Process SetNextWindow***() calls
bool window_pos_set_by_api = false , window_size_set_by_api = false ;
@ -4061,7 +4062,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
else
PushClipRect ( fullscreen_rect . Min , fullscreen_rect . Max , true ) ;
if ( ! window_ was_ active)
if ( window_ activat ed )
{
// Popup first latch mouse position, will position itself when it appears next frame
window - > AutoPosLastDirection = - 1 ;
@ -4095,7 +4096,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
// Hide popup/tooltip window when first appearing while we measure size (because we recycle them)
if ( window - > HiddenFrames > 0 )
window - > HiddenFrames - - ;
if ( ( flags & ( ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip ) ) ! = 0 & & ! window_ was_ active)
if ( ( flags & ( ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip ) ) ! = 0 & & window_ activat ed )
{
window - > HiddenFrames = 1 ;
if ( flags & ImGuiWindowFlags_AlwaysAutoResize )
@ -4389,7 +4390,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
window - > DC . TreeDepth = 0 ;
window - > DC . StateStorage = & window - > StateStorage ;
window - > DC . GroupStack . resize ( 0 ) ;
window - > MenuColumns . Update ( 3 , style . ItemSpacing . x , ! window_ was_ active) ;
window - > MenuColumns . Update ( 3 , style . ItemSpacing . x , window_ activat ed ) ;
if ( window - > AutoFitFramesX > 0 )
window - > AutoFitFramesX - - ;
@ -4397,7 +4398,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
window - > AutoFitFramesY - - ;
// New windows appears in front (we need to do that AFTER setting DC.CursorStartPos so our initial navigation reference rectangle can start around there)
if ( ! window_ was_ active & & ! ( flags & ImGuiWindowFlags_NoFocusOnAppearing ) )
if ( window_ activat ed & & ! ( flags & ImGuiWindowFlags_NoFocusOnAppearing ) )
if ( ! ( flags & ( ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip ) ) | | ( flags & ImGuiWindowFlags_Popup ) )
FocusWindow ( window ) ;