-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Right-clicking in the void won't disable focus #1738
Comments
…Modal() and exposed in imgui_internal.h (#1738)
Hello Louis, Correct, right-click not stealing focus is indeed by design, as commented in Your patch would work, my suggestion is that you may just call that code yourself after EndFrame? So, something like this, in your own code, called after EndFrame() may work:
So there's no need for additional options on either side, and that small bit of code using PS: I have renamed GetFrontMostModalRootWindow() which was a static function of imgui.cpp to |
Btw, I would want to evaluate actually clearing focus on right-click on void, it's just a little more work to do that carefully (I think the FocusWindow(NULL) code in EndFrame should be moved outside the |
Doing it in my own code after the call to ImGui::EndFrame() is perfectly acceptable! In fact I prefer not to modify any of the ImGui files to facilitate future integrations. If you're going to clear focus on right-click on void, then please also do it for the middle mouse button! |
I am living the same problem aswell. I have different windows for different views; perspective, top, etc .. I want to activate those windows with right or middle mouse buttons. I managed to do activation. However if there is an InputText on these windows, inputfocus remeans there and i couldnt kill the focus of that item. So intecting with keyboard in the next window affects previous InputText field. It would be very nice to activate windows with the mouse clicks we wishes. like 0 1 2 Version 1.75 WIP Thanks. |
Hello @afraidofdark, I confirmed there was a bug where the code path for If anyone needs to clear window focus based on those condition they can use code such as:
Anywhere in their app. The reason I am not making this the default is that it would be inconsistent with how you can close popups with the right-mouse without altering focus, which seems like a semi-standard behavior. Because we have a 3-lines workaround above I consider this solved for now. (cc: #3200 for later reference) |
Fixed Docking regression caused by 7b3d379. Somehow I knowingly removed this line while moving the block
And I forgot to mention that in the commit message. I knew it would be a bit agressive/risky but somehow against all odd the way our anti-regression tests was setup didn't detect the bug in (#3243). We are now amending testing code to avoid that. |
In our editor, right-clicking in the 3D viewport opens a context menu handled by WPF (not ImGui). Also, dragging around the 3D viewport while right-clicking rotates the camera. While rotating the camera, we can also use the WASD keys to move the camera around the 3D world.
However, when an ImGui text field is active, right-clicking outside ImGui windows will not make the window lose its focus. WantTextInput is still active and keys are not sent to our viewport. WASD keys are sent to the ImGui text field instead of controlling the camera position.
According to the comments in imgui.cpp this behavior appears to be by design, but I wonder if it would be possible to add a flag to control this behavior.
I have locally modified our version of ImGui v1.60 like so:
In ImGui::EndFrame():
In ImGui::InputTextEx():
This seems to work fine, even with global popups created with ImGui::BeginPopupContextVoid().
The text was updated successfully, but these errors were encountered: