@ -1,4 +1,4 @@
// dear imgui, v1.90.4
// dear imgui, v1.90.5 WIP
// (main code and documentation)
// Help:
@ -6879,7 +6879,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
PushFocusScope ( ( flags & ImGuiWindowFlags_NavFlattened ) ? g . CurrentFocusScopeId : window - > ID ) ;
window - > NavRootFocusScopeId = g . CurrentFocusScopeId ;
// Add to popup stack
// Add to popup stacks: update OpenPopupStack[] data, push to BeginPopupStack[]
if ( flags & ImGuiWindowFlags_Popup )
{
ImGuiPopupData & popup_ref = g . OpenPopupStack [ g . BeginPopupStack . Size ] ;
@ -11444,7 +11444,7 @@ void ImGui::OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags)
ImGuiPopupData popup_ref ; // Tagged as new ref as Window will be set back to NULL if we write this into OpenPopupStack.
popup_ref . PopupId = id ;
popup_ref . Window = NULL ;
popup_ref . Backup NavWindow = g . NavWindow ; // When popup closes focus may be restored to NavWindow (depend on window type).
popup_ref . Restore NavWindow = g . NavWindow ; // When popup closes focus may be restored to NavWindow (depend on window type).
popup_ref . OpenFrameCount = g . FrameCount ;
popup_ref . OpenParentId = parent_window - > IDStack . back ( ) ;
popup_ref . OpenPopupPos = NavCalcPreferredRefPos ( ) ;
@ -11493,6 +11493,7 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to
return ;
// Don't close our own child popup windows.
//IMGUI_DEBUG_LOG_POPUP("[popup] ClosePopupsOverWindow(\"%s\") restore_under=%d\n", ref_window ? ref_window->Name : "<NULL>", restore_focus_to_window_under_popup);
int popup_count_to_keep = 0 ;
if ( ref_window )
{
@ -11550,17 +11551,18 @@ void ImGui::ClosePopupsExceptModals()
void ImGui : : ClosePopupToLevel ( int remaining , bool restore_focus_to_window_under_popup )
{
ImGuiContext & g = * GImGui ;
IMGUI_DEBUG_LOG_POPUP ( " [popup] ClosePopupToLevel(%d), restore_focus_to_window_ under_popup =%d \n " , remaining , restore_focus_to_window_under_popup ) ;
IMGUI_DEBUG_LOG_POPUP ( " [popup] ClosePopupToLevel(%d), restore_under=%d \n " , remaining , restore_focus_to_window_under_popup ) ;
IM_ASSERT ( remaining > = 0 & & remaining < g . OpenPopupStack . Size ) ;
// Trim open popup stack
ImGuiWindow * popup_window = g . OpenPopupStack [ remaining ] . Window ;
ImGuiWindow * popup_backup_nav_window = g . OpenPopupStack [ remaining ] . BackupNavWindow ;
ImGuiPopupData prev_popup = g . OpenPopupStack [ remaining ] ;
g . OpenPopupStack . resize ( remaining ) ;
if ( restore_focus_to_window_under_popup )
// Restore focus (unless popup window was not yet submitted, and didn't have a chance to take focus anyhow. See #7325 for an edge case)
if ( restore_focus_to_window_under_popup & & prev_popup . Window )
{
ImGuiWindow * focus_window = ( popup_window & & popup_window - > Flags & ImGuiWindowFlags_ChildMenu ) ? popup_window - > ParentWindow : popup_backup_nav_window ;
ImGuiWindow * popup_window = prev_popup . Window ;
ImGuiWindow * focus_window = ( popup_window & & popup_window - > Flags & ImGuiWindowFlags_ChildMenu ) ? popup_window - > ParentWindow : prev_popup . RestoreNavWindow ;
if ( focus_window & & ! focus_window - > WasActive & & popup_window )
FocusTopMostWindowUnderOne ( popup_window , NULL , NULL , ImGuiFocusRequestFlags_RestoreFocusedChild ) ; // Fallback
else
@ -20128,9 +20130,9 @@ void ImGui::ShowMetricsWindow(bool* p_open)
{
// As it's difficult to interact with tree nodes while popups are open, we display everything inline.
ImGuiWindow * window = popup_data . Window ;
BulletText ( " PopupID: %08x, Window: '%s' (%s%s), Backup NavWindow '%s', ParentWindow '%s' " ,
BulletText ( " PopupID: %08x, Window: '%s' (%s%s), Restore NavWindow '%s', ParentWindow '%s' " ,
popup_data . PopupId , window ? window - > Name : " NULL " , window & & ( window - > Flags & ImGuiWindowFlags_ChildWindow ) ? " Child; " : " " , window & & ( window - > Flags & ImGuiWindowFlags_ChildMenu ) ? " Menu; " : " " ,
popup_data . Backup NavWindow ? popup_data . Backup NavWindow- > Name : " NULL " , window & & window - > ParentWindow ? window - > ParentWindow - > Name : " NULL " ) ;
popup_data . Restore NavWindow ? popup_data . Restore NavWindow- > Name : " NULL " , window & & window - > ParentWindow ? window - > ParentWindow - > Name : " NULL " ) ;
}
TreePop ( ) ;
}