@ -3725,7 +3725,9 @@ void ImGui::OpenPopupEx(ImGuiID id, bool reopen_existing)
ImGuiContext & g = * GImGui ;
ImGuiContext & g = * GImGui ;
ImGuiWindow * parent_window = g . CurrentWindow ;
ImGuiWindow * parent_window = g . CurrentWindow ;
int current_stack_size = g . CurrentPopupStack . Size ;
int current_stack_size = g . CurrentPopupStack . Size ;
ImGuiPopupRef popup_ref = ImGuiPopupRef ( id , parent_window , parent_window - > GetID ( " ##Menus " ) , g . IO . MousePos ) ; // Tagged as new ref because constructor sets Window to NULL.
ImVec2 mouse_pos = g . IO . MousePos ;
ImVec2 popup_pos = mouse_pos ; // NB: In the Navigation branch popup_pos may not use mouse_pos.
ImGuiPopupRef popup_ref = ImGuiPopupRef ( id , parent_window , parent_window - > GetID ( " ##Menus " ) , popup_pos , mouse_pos ) ; // Tagged as new ref because constructor sets Window to NULL.
if ( g . OpenPopupStack . Size < current_stack_size + 1 )
if ( g . OpenPopupStack . Size < current_stack_size + 1 )
g . OpenPopupStack . push_back ( popup_ref ) ;
g . OpenPopupStack . push_back ( popup_ref ) ;
else if ( reopen_existing | | g . OpenPopupStack [ current_stack_size ] . PopupId ! = id )
else if ( reopen_existing | | g . OpenPopupStack [ current_stack_size ] . PopupId ! = id )
@ -4479,7 +4481,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Popup first latch mouse position, will position itself when it appears next frame
// Popup first latch mouse position, will position itself when it appears next frame
window - > AutoPosLastDirection = ImGuiDir_None ;
window - > AutoPosLastDirection = ImGuiDir_None ;
if ( ( flags & ImGuiWindowFlags_Popup ) ! = 0 & & ! window_pos_set_by_api )
if ( ( flags & ImGuiWindowFlags_Popup ) ! = 0 & & ! window_pos_set_by_api )
window - > PosFloat = g . IO. MousePos ;
window - > PosFloat = g . CurrentPopupStack. back ( ) . PopupPosOnOpen ;
}
}
// Collapse window by double-clicking on title bar
// Collapse window by double-clicking on title bar