mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-11-04 09:44:29 +00:00 
			
		
		
		
	Popup taking focus deactivate focused widget of other window (#126)
e.g. focus InputText(), open contextual popup, input text used to stay focused
This commit is contained in:
		@@ -4015,6 +4015,11 @@ static void FocusWindow(ImGuiWindow* window)
 | 
				
			|||||||
    if (window->RootWindow)
 | 
					    if (window->RootWindow)
 | 
				
			||||||
        window = window->RootWindow;
 | 
					        window = window->RootWindow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Steal focus on active widgets
 | 
				
			||||||
 | 
					    if (window->Flags & ImGuiWindowFlags_Popup) // FIXME: This statement should be unnecessary. Need further testing before removing it..
 | 
				
			||||||
 | 
					        if (g.ActiveId != 0 && g.ActiveIdWindow && g.ActiveIdWindow->RootWindow != window)
 | 
				
			||||||
 | 
					            SetActiveId(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (g.Windows.back() == window)
 | 
					    if (g.Windows.back() == window)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -6786,11 +6791,11 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
 | 
				
			|||||||
// Edit a string of text
 | 
					// Edit a string of text
 | 
				
			||||||
bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data)
 | 
					bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ImGuiState& g = *GImGui;
 | 
					 | 
				
			||||||
    ImGuiWindow* window = GetCurrentWindow();
 | 
					    ImGuiWindow* window = GetCurrentWindow();
 | 
				
			||||||
    if (window->SkipItems)
 | 
					    if (window->SkipItems)
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ImGuiState& g = *GImGui;
 | 
				
			||||||
    const ImGuiIO& io = g.IO;
 | 
					    const ImGuiIO& io = g.IO;
 | 
				
			||||||
    const ImGuiStyle& style = g.Style;
 | 
					    const ImGuiStyle& style = g.Style;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user