mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Windows: fixed background order of overlapping childs submitted sequentially. (#4493)
Amend 07704496
			
			
This commit is contained in:
		@@ -42,6 +42,7 @@ Breaking Changes:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Other Changes:
 | 
					Other Changes:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Windows: fixed background order of overlapping childs submitted sequentially. (#4493)
 | 
				
			||||||
- InputTextMultiline: Fixed label size not being included into window contents rect unless
 | 
					- InputTextMultiline: Fixed label size not being included into window contents rect unless
 | 
				
			||||||
  the whole widget is clipped.
 | 
					  the whole widget is clipped.
 | 
				
			||||||
- TextUnformatted: Accept null ranges including (NULL,NULL) without asserting, in order to conform
 | 
					- TextUnformatted: Accept null ranges including (NULL,NULL) without asserting, in order to conform
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										15
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -6214,16 +6214,21 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
 | 
				
			|||||||
                window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha * 0.25f), g.Style.WindowRounding);
 | 
					                window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha * 0.25f), g.Style.WindowRounding);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Since 1.71, child window can render their decoration (bg color, border, scrollbars, etc.) within their parent to save a draw call.
 | 
					        // Child windows can render their decoration (bg color, border, scrollbars, etc.) within their parent to save a draw call (since 1.71)
 | 
				
			||||||
        // When using overlapping child windows, this will break the assumption that child z-order is mapped to submission order.
 | 
					        // When using overlapping child windows, this will break the assumption that child z-order is mapped to submission order.
 | 
				
			||||||
        // We disable this when the parent window has zero vertices, which is a common pattern leading to laying out multiple overlapping child.
 | 
					        // FIXME: User code may rely on explicit sorting of overlapping child window and would need to disable this somehow. Please get in contact if you are affected (github #4493)
 | 
				
			||||||
        // We also disabled this when we have dimming overlay behind this specific one child.
 | 
					 | 
				
			||||||
        // FIXME: More code may rely on explicit sorting of overlapping child window and would need to disable this somehow. Please get in contact if you are affected.
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            bool render_decorations_in_parent = false;
 | 
					            bool render_decorations_in_parent = false;
 | 
				
			||||||
            if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip)
 | 
					            if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip)
 | 
				
			||||||
                if (window->DrawList->CmdBuffer.back().ElemCount == 0 && parent_window->DrawList->VtxBuffer.Size > 0)
 | 
					            {
 | 
				
			||||||
 | 
					                // - We test overlap with the previous child window only (testing all would end up being O(log N) not a good investment here)
 | 
				
			||||||
 | 
					                // - We disable this when the parent window has zero vertices, which is a common pattern leading to laying out multiple overlapping childs
 | 
				
			||||||
 | 
					                ImGuiWindow* previous_child = parent_window->DC.ChildWindows.Size >= 2 ? parent_window->DC.ChildWindows[parent_window->DC.ChildWindows.Size - 2] : NULL;
 | 
				
			||||||
 | 
					                bool previous_child_overlapping = previous_child ? previous_child->Rect().Overlaps(window->Rect()) : false;
 | 
				
			||||||
 | 
					                bool parent_is_empty = parent_window->DrawList->VtxBuffer.Size > 0;
 | 
				
			||||||
 | 
					                if (window->DrawList->CmdBuffer.back().ElemCount == 0 && parent_is_empty && !previous_child_overlapping)
 | 
				
			||||||
                    render_decorations_in_parent = true;
 | 
					                    render_decorations_in_parent = true;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            if (render_decorations_in_parent)
 | 
					            if (render_decorations_in_parent)
 | 
				
			||||||
                window->DrawList = parent_window->DrawList;
 | 
					                window->DrawList = parent_window->DrawList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								imgui.h
									
									
									
									
									
								
							@@ -61,7 +61,7 @@ Index of this file:
 | 
				
			|||||||
// Version
 | 
					// Version
 | 
				
			||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
 | 
					// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
 | 
				
			||||||
#define IMGUI_VERSION               "1.85 WIP"
 | 
					#define IMGUI_VERSION               "1.85 WIP"
 | 
				
			||||||
#define IMGUI_VERSION_NUM           18408
 | 
					#define IMGUI_VERSION_NUM           18409
 | 
				
			||||||
#define IMGUI_CHECKVERSION()        ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
 | 
					#define IMGUI_CHECKVERSION()        ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
 | 
				
			||||||
#define IMGUI_HAS_TABLE
 | 
					#define IMGUI_HAS_TABLE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user