mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 07:01:04 +01:00 
			
		
		
		
	Added flag showing whether the GUI wants text input
Conflicts: imgui.cpp
This commit is contained in:
		
				
					committed by
					
						
						ocornut
					
				
			
			
				
	
			
			
			
						parent
						
							7eca754094
						
					
				
				
					commit
					73917115a8
				
			
							
								
								
									
										14
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -128,8 +128,10 @@
 | 
			
		||||
            // swap video buffer, etc.
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
   - after calling ImGui::NewFrame() you can read back 'io.WantCaptureMouse' and 'io.WantCaptureKeyboard' to tell if ImGui 
 | 
			
		||||
     wants to use your inputs. if it does you can discard/hide the inputs from the rest of your application.
 | 
			
		||||
   - after calling ImGui::NewFrame() you can read back flags from the IO structure  to tell how ImGui intends to use your inputs.
 | 
			
		||||
     When 'io.WantCaptureMouse' or 'io.WantCaptureKeyboard' flags are set you may want to discard/hide the inputs from the rest of your application.
 | 
			
		||||
     When 'io.WantInputsCharacters' is set to may want to notify your OS to popup an onscreen keyboard, if available.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 API BREAKING CHANGES
 | 
			
		||||
 ====================
 | 
			
		||||
@@ -1901,8 +1903,9 @@ void ImGui::NewFrame()
 | 
			
		||||
    bool mouse_owned_by_application = mouse_earliest_button_down != -1 && !g.IO.MouseDownOwned[mouse_earliest_button_down];
 | 
			
		||||
    g.IO.WantCaptureMouse = (!mouse_owned_by_application && g.HoveredWindow != NULL) || (!mouse_owned_by_application && mouse_any_down) || (g.ActiveId != 0) || (!g.OpenedPopupStack.empty()) || (g.CaptureMouseNextFrame);
 | 
			
		||||
    g.IO.WantCaptureKeyboard = (g.ActiveId != 0) || (g.CaptureKeyboardNextFrame);
 | 
			
		||||
    g.IO.WantInputCharacters = ((g.InputTextState.Id != 0) && (g.InputTextState.Id == g.ActiveId)) || g.WantInputCharactersNextFrame;
 | 
			
		||||
    g.MouseCursor = ImGuiMouseCursor_Arrow;
 | 
			
		||||
    g.CaptureMouseNextFrame = g.CaptureKeyboardNextFrame = false;
 | 
			
		||||
    g.CaptureMouseNextFrame = g.CaptureKeyboardNextFrame = g.WantInputCharactersNextFrame = false;
 | 
			
		||||
 | 
			
		||||
    // If mouse was first clicked outside of ImGui bounds we also cancel out hovering.
 | 
			
		||||
    if (mouse_owned_by_application)
 | 
			
		||||
@@ -2874,6 +2877,11 @@ void ImGui::CaptureMouseFromApp()
 | 
			
		||||
    GImGui->CaptureMouseNextFrame = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ImGui::CaptureInputCharactersFromApp()
 | 
			
		||||
{
 | 
			
		||||
    GImGui->WantInputCharactersNextFrame = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ImGui::IsItemHovered()
 | 
			
		||||
{
 | 
			
		||||
    ImGuiWindow* window = GetCurrentWindow();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user