-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One frame lag when clicking outside of the ImGui window/widgets? #1152
Comments
Just to add a bit more to this. As for example when clicking outside of widget may happen: imagine having focus in some text box and then starting to drag selection in main editor window. Editor must register start of the click to position start of selection rectangle. It seems like using IsHoveringAnyWindow instead of WantsCaptureMouse may help in this case, though I'm not sure that it's a perfect solution. (It's unlikely that this function will have such lag, even if it does, a lot of time will pass when user moves the mouse to the editor window, so IsHoveringAnyWindow will probably return false). |
For now I think the pragmatic direction is that you can use I realize this issue was opened a century ago but I believe it would apply to many people.
|
Looking at ImGui's source it seems like widgets' focus is checked when calling their creation functions, e.g.
ImGui::InputText
. This, unfortunately, seems to lead to the following problem.I have a code like this:
But when the focus is inside some text box and I click outside gui, the code with comment "This code" is not called. Text box releases focus (and WantCaptureMouse will be false) only after I call
ImGui::InputText
again. But in my code I first check input and then theupdate
method is called in which ImGui widgets are created. So WantCaptureMouse becomes false after I callImGui::InputText
and the click gets missed.Is there any way to fix this problem? Or should I call ImGui's widget creation functions before handling input to be able to handle mouse clicks correctly?
The text was updated successfully, but these errors were encountered: