@ -10577,7 +10577,9 @@ bool ImGui::BeginPopup(const char* str_id, ImGuiWindowFlags flags)
}
}
// If 'p_open' is specified for a modal popup window, the popup will have a regular close button which will close the popup.
// If 'p_open' is specified for a modal popup window, the popup will have a regular close button which will close the popup.
// Note that popup visibility status is owned by Dear ImGui (and manipulated with e.g. OpenPopup) so the actual value of *p_open is meaningless here.
// Note that popup visibility status is owned by Dear ImGui (and manipulated with e.g. OpenPopup).
// - *p_open set back to false in BeginPopupModal() when popup is not open.
// - if you set *p_open to false before calling BeginPopupModal(), it will close the popup.
bool ImGui : : BeginPopupModal ( const char * name , bool * p_open , ImGuiWindowFlags flags )
bool ImGui : : BeginPopupModal ( const char * name , bool * p_open , ImGuiWindowFlags flags )
{
{
ImGuiContext & g = * GImGui ;
ImGuiContext & g = * GImGui ;
@ -10586,6 +10588,8 @@ bool ImGui::BeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags fla
if ( ! IsPopupOpen ( id , ImGuiPopupFlags_None ) )
if ( ! IsPopupOpen ( id , ImGuiPopupFlags_None ) )
{
{
g . NextWindowData . ClearFlags ( ) ; // We behave like Begin() and need to consume those values
g . NextWindowData . ClearFlags ( ) ; // We behave like Begin() and need to consume those values
if ( p_open & & * p_open )
* p_open = false ;
return false ;
return false ;
}
}