mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Hide new windows for one frame until they calculate their size. Also fixes SetNextWindowPos() given a non-zero pivot. (#1694)
This commit is contained in:
		@@ -257,6 +257,7 @@ Other Changes:
 | 
				
			|||||||
- Window: Fixed a one frame glitch. When an appearing window claimed the focus themselves, the title bar wouldn't use the focused color for one frame.
 | 
					- Window: Fixed a one frame glitch. When an appearing window claimed the focus themselves, the title bar wouldn't use the focused color for one frame.
 | 
				
			||||||
- Window: Added ImGuiWindowFlags_ResizeFromAnySide flag to resize from any borders or from the lower-left corner of a window. This requires your backend to honor GetMouseCursor() requests for full usability. (#822)
 | 
					- Window: Added ImGuiWindowFlags_ResizeFromAnySide flag to resize from any borders or from the lower-left corner of a window. This requires your backend to honor GetMouseCursor() requests for full usability. (#822)
 | 
				
			||||||
- Window: Sizing fixes when useing SetNextWindowSize() on individual axises.
 | 
					- Window: Sizing fixes when useing SetNextWindowSize() on individual axises.
 | 
				
			||||||
 | 
					- Window: Hide new window for one frame until they calculate their size. Also fixes SetNextWindowPos() given a non-zero pivot. (#1694)
 | 
				
			||||||
- Window: Made mouse wheel scrolling accomodate better to windows that are smaller than the scroll step.
 | 
					- Window: Made mouse wheel scrolling accomodate better to windows that are smaller than the scroll step.
 | 
				
			||||||
- Window: SetNextWindowContentSize() adjust for the size of decorations (title bar/menu bar), but _not_ for borders are we consistently make borders not affect layout. 
 | 
					- Window: SetNextWindowContentSize() adjust for the size of decorations (title bar/menu bar), but _not_ for borders are we consistently make borders not affect layout. 
 | 
				
			||||||
  If you need a non-child window of an exact size with border enabled but zero window padding, you'll need to accodomate for the border size yourself.
 | 
					  If you need a non-child window of an exact size with border enabled but zero window padding, you'll need to accodomate for the border size yourself.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5597,7 +5597,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Find or create
 | 
					    // Find or create
 | 
				
			||||||
    ImGuiWindow* window = FindWindowByName(name);
 | 
					    ImGuiWindow* window = FindWindowByName(name);
 | 
				
			||||||
    if (!window)
 | 
					    const bool window_just_created = (window == NULL);
 | 
				
			||||||
 | 
					    if (window_just_created)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        ImVec2 size_on_first_use = (g.NextWindowData.SizeCond != 0) ? g.NextWindowData.SizeVal : ImVec2(0.0f, 0.0f); // Any condition flag will do since we are creating a new window here.
 | 
					        ImVec2 size_on_first_use = (g.NextWindowData.SizeCond != 0) ? g.NextWindowData.SizeVal : 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 = CreateNewWindow(name, size_on_first_use, flags);
 | 
				
			||||||
@@ -5759,7 +5760,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
 | 
				
			|||||||
        // Hide popup/tooltip window when re-opening while we measure size (because we recycle the windows)
 | 
					        // Hide popup/tooltip window when re-opening while we measure size (because we recycle the windows)
 | 
				
			||||||
        if (window->HiddenFrames > 0)
 | 
					        if (window->HiddenFrames > 0)
 | 
				
			||||||
            window->HiddenFrames--;
 | 
					            window->HiddenFrames--;
 | 
				
			||||||
        if ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0 && window_just_activated_by_user)
 | 
					        if (window_just_activated_by_user && (flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            window->HiddenFrames = 1;
 | 
					            window->HiddenFrames = 1;
 | 
				
			||||||
            if (flags & ImGuiWindowFlags_AlwaysAutoResize)
 | 
					            if (flags & ImGuiWindowFlags_AlwaysAutoResize)
 | 
				
			||||||
@@ -5772,6 +5773,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Hide new windows for one frame until they calculate their size
 | 
				
			||||||
 | 
					        if (window_just_created && (!window_size_x_set_by_api || !window_size_y_set_by_api))
 | 
				
			||||||
 | 
					            window->HiddenFrames = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Calculate auto-fit size, handle automatic resize
 | 
					        // Calculate auto-fit size, handle automatic resize
 | 
				
			||||||
        const ImVec2 size_auto_fit = CalcSizeAutoFit(window, window->SizeContents);
 | 
					        const ImVec2 size_auto_fit = CalcSizeAutoFit(window, window->SizeContents);
 | 
				
			||||||
        ImVec2 size_full_modified(FLT_MAX, FLT_MAX);
 | 
					        ImVec2 size_full_modified(FLT_MAX, FLT_MAX);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user