mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	Minor optimization so that mass-calling BeginPopupContext* functions can early out more commonly without hashing ID
This commit is contained in:
		| @@ -3208,7 +3208,8 @@ void ImGui::CloseCurrentPopup() | |||||||
| static inline void ClearSetNextWindowData() | static inline void ClearSetNextWindowData() | ||||||
| { | { | ||||||
|     ImGuiState& g = *GImGui; |     ImGuiState& g = *GImGui; | ||||||
|     g.SetNextWindowPosCond = g.SetNextWindowSizeCond = g.SetNextWindowContentSizeCond = g.SetNextWindowCollapsedCond = g.SetNextWindowFocus = 0; |     g.SetNextWindowPosCond = g.SetNextWindowSizeCond = g.SetNextWindowContentSizeCond = g.SetNextWindowCollapsedCond = 0; | ||||||
|  |     g.SetNextWindowFocus = false; | ||||||
| } | } | ||||||
|  |  | ||||||
| static bool BeginPopupEx(const char* str_id, ImGuiWindowFlags extra_flags) | static bool BeginPopupEx(const char* str_id, ImGuiWindowFlags extra_flags) | ||||||
| @@ -3243,6 +3244,11 @@ static bool BeginPopupEx(const char* str_id, ImGuiWindowFlags extra_flags) | |||||||
|  |  | ||||||
| bool ImGui::BeginPopup(const char* str_id) | bool ImGui::BeginPopup(const char* str_id) | ||||||
| { | { | ||||||
|  |     if (GImGui->OpenedPopupStack.Size <= GImGui->CurrentPopupStack.Size)	// Early out for performance | ||||||
|  |     { | ||||||
|  |         ClearSetNextWindowData(); // We behave like Begin() and need to consume those values | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|     return BeginPopupEx(str_id, ImGuiWindowFlags_ShowBorders); |     return BeginPopupEx(str_id, ImGuiWindowFlags_ShowBorders); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user