mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Focus: Reworking FocusWindow() so in Docking branch we can fix CTRL+Tab being out of order on Docked windows because WindowsFocusOreder is poorly maintained.
When merging this and d9bca0d8 in Docking we'll replace two ocurrences of RootWindow with RootWindowDockStop.
			
			
This commit is contained in:
		
							
								
								
									
										13
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -6040,17 +6040,18 @@ void ImGui::FocusWindow(ImGuiWindow* window)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Move the root window to the top of the pile
 | 
					    // Move the root window to the top of the pile
 | 
				
			||||||
    IM_ASSERT(window->RootWindow != NULL);
 | 
					    IM_ASSERT(window->RootWindow != NULL);
 | 
				
			||||||
    window = window->RootWindow;
 | 
					    ImGuiWindow* focus_front_window = window->RootWindow; // NB: In docking branch this is window->RootWindowDockStop
 | 
				
			||||||
 | 
					    ImGuiWindow* display_front_window = window->RootWindow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Steal focus on active widgets
 | 
					    // Steal focus on active widgets
 | 
				
			||||||
    if (window->Flags & ImGuiWindowFlags_Popup) // FIXME: This statement should be unnecessary. Need further testing before removing it..
 | 
					    if (focus_front_window->Flags & ImGuiWindowFlags_Popup) // FIXME: This statement may be unnecessary? Need further testing before removing it..
 | 
				
			||||||
        if (g.ActiveId != 0 && g.ActiveIdWindow && g.ActiveIdWindow->RootWindow != window)
 | 
					        if (g.ActiveId != 0 && g.ActiveIdWindow && g.ActiveIdWindow->RootWindow != focus_front_window)
 | 
				
			||||||
            ClearActiveID();
 | 
					            ClearActiveID();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Bring to front
 | 
					    // Bring to front
 | 
				
			||||||
    BringWindowToFocusFront(window);
 | 
					    BringWindowToFocusFront(focus_front_window);
 | 
				
			||||||
    if (!(window->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus))
 | 
					    if ((display_front_window->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus) == 0)
 | 
				
			||||||
        BringWindowToDisplayFront(window);
 | 
					        BringWindowToDisplayFront(display_front_window);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window)
 | 
					void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user