mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-30 04:31:06 +01:00 
			
		
		
		
	Fixed WantTextInput from being true when an activated Drag or Slider was previously turned into an InputText(). (#1317)
This commit is contained in:
		| @@ -2291,9 +2291,9 @@ void ImGui::NewFrame() | ||||
|     else | ||||
|         g.IO.WantCaptureMouse = (mouse_avail_to_imgui && (g.HoveredWindow != NULL || mouse_any_down)) || (g.ActiveId != 0) || (!g.OpenPopupStack.empty()); | ||||
|     g.IO.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != -1) ? (g.WantCaptureKeyboardNextFrame != 0) : (g.ActiveId != 0); | ||||
|     g.IO.WantTextInput = (g.ActiveId != 0 && g.InputTextState.Id == g.ActiveId); | ||||
|     g.IO.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : 0; | ||||
|     g.MouseCursor = ImGuiMouseCursor_Arrow; | ||||
|     g.WantCaptureMouseNextFrame = g.WantCaptureKeyboardNextFrame = -1; | ||||
|     g.WantCaptureMouseNextFrame = g.WantCaptureKeyboardNextFrame = g.WantTextInputNextFrame = -1; | ||||
|     g.OsImePosRequest = ImVec2(1.0f, 1.0f); // OS Input Method Editor showing on top-left of our window by default | ||||
|  | ||||
|     // If mouse was first clicked outside of ImGui bounds we also cancel out hovering. | ||||
| @@ -7906,6 +7906,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 | ||||
|         // Although we are active we don't prevent mouse from hovering other elements unless we are interacting right now with the widget. | ||||
|         // Down the line we should have a cleaner library-wide concept of Selected vs Active. | ||||
|         g.ActiveIdAllowOverlap = !io.MouseDown[0]; | ||||
|         g.WantTextInputNextFrame = 1; | ||||
|  | ||||
|         // Edit in progress | ||||
|         const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + edit_state.ScrollX; | ||||
|   | ||||
| @@ -488,6 +488,7 @@ struct ImGuiContext | ||||
|     float                   FramerateSecPerFrameAccum; | ||||
|     int                     WantCaptureMouseNextFrame;          // explicit capture via CaptureInputs() sets those flags | ||||
|     int                     WantCaptureKeyboardNextFrame; | ||||
|     int                     WantTextInputNextFrame; | ||||
|     char                    TempBuffer[1024*3+1];               // temporary text buffer | ||||
|  | ||||
|     ImGuiContext() | ||||
| @@ -558,7 +559,7 @@ struct ImGuiContext | ||||
|         memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame)); | ||||
|         FramerateSecPerFrameIdx = 0; | ||||
|         FramerateSecPerFrameAccum = 0.0f; | ||||
|         WantCaptureMouseNextFrame = WantCaptureKeyboardNextFrame = -1; | ||||
|         WantCaptureMouseNextFrame = WantCaptureKeyboardNextFrame = WantTextInputNextFrame = -1; | ||||
|         memset(TempBuffer, 0, sizeof(TempBuffer)); | ||||
|     } | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user