mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-11-04 09:44:29 +00:00 
			
		
		
		
	Begin: Remove unnecessary usage of window_is_new flag, as both fields are zero on window creation.
This commit is contained in:
		@@ -4270,13 +4270,11 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
 | 
			
		||||
        flags |= ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
 | 
			
		||||
 | 
			
		||||
    // Find or create
 | 
			
		||||
    bool window_is_new = false;
 | 
			
		||||
    ImGuiWindow* window = FindWindowByName(name);
 | 
			
		||||
    if (!window)
 | 
			
		||||
    {
 | 
			
		||||
        ImVec2 size_on_first_use = (g.SetNextWindowSizeCond != 0) ? g.SetNextWindowSizeVal : ImVec2(0.0f, 0.0f); // Any condition flag will do since we are creating a new window here.
 | 
			
		||||
        window = CreateNewWindow(name, size_on_first_use, flags);
 | 
			
		||||
        window_is_new = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const int current_frame = g.FrameCount;
 | 
			
		||||
@@ -4420,8 +4418,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
 | 
			
		||||
        // SIZE
 | 
			
		||||
 | 
			
		||||
        // Update contents size from last frame for auto-fitting (unless explicitly specified)
 | 
			
		||||
        window->SizeContents.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.x - window->Pos.x) + window->Scroll.x));
 | 
			
		||||
        window->SizeContents.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.y - window->Pos.y) + window->Scroll.y));
 | 
			
		||||
        window->SizeContents.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : (window->DC.CursorMaxPos.x - window->Pos.x + window->Scroll.x));
 | 
			
		||||
        window->SizeContents.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : (window->DC.CursorMaxPos.y - window->Pos.y + window->Scroll.y));
 | 
			
		||||
        window->SizeContents += window->WindowPadding;
 | 
			
		||||
 | 
			
		||||
        // Hide popup/tooltip window when re-opening while we measure size (because we recycle the windows)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user