-
-
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
Deselect window from Keyboard #3200
Comments
Something would need to be added in
Something that would eventually call
With
The problem being to design that exact desirable behavior and various application may need different things. For instance, the "clearing g.NavId" behavior is ALREADY something that some application are considering to be undesirable and want removed. An app that doesn't run "over" a game has no reason to clear widget focus at all, let alone window focus. You can side-step that decision and handle the code in your own application:
Or we design a more generic solution, and I'm guessing that maybe a single flag would be enough: either enable clearing of NavWindow/NavId all-together on ESC, either now. I'll have to think about this a little more. Note for later: |
I've pasted the last code snipped just after |
Hello @u3shit, I know it's been a while and you may not have this problem anymore. However I've been interested in this topic among some others. I would be curious if you can from memory write a little bit of details on the context? How did it matter specifically that windows were unfocused, vs just relying on WantCaptureKeyboard=0 for routing inputs to your "background" application? What's the typical situation where you expected to be able to unfocus windows with the keyboard? I'm asking because I'll probably come up with a mix of options, one to manipulate how the Escape key affects navigation, and one potentially to add an option in the Ctrl+Tab menu to explicitly unfocus all windows. I also don't understand this comment:
Since the code I provided intentionally tested for |
… on Escape. (#3200) + pressing escape to hide nav highlight doesn't clear location from when ctrl+tabbing back into same window later.
With b001038 i have added a I've also fixed two other bug: pressing Escape doesn't lose/forget last location of a window + 626d358 pressing ctrl+tabbing from a state where no window is focused starts from the top most one. |
Version/Branch of Dear ImGui:
Version: 1.77 WIP
Branch: master
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp
Compiler: clang
Operating System: linux
My Issue/Question:
Sorry if this is a stupid question, but I can't seem to find a way to deselect a window with keyboard nav. When no window is selected, imgui will return
WantCaptureKeyboard=0
, but even in this case, ctrl-tab works and I can select a window. Doing this will capture the keyboard. The problem is that there doesn't seem to be a way to get back to the original all windows deselected state, because ctrl-tab only cycles between windows (and the main menu bar if there's one). With Escape I can close popup menus, but it does nothing when I have a window selected. (If there's only a main menu bar and no windows, pressing escape does actually deselect the menu bar and releases the keyboard, but as soon as there's an active window, it will just select it). Pressing tab, space, alt, arrow keys doesn't seem to help either, I can close the window by pressing alt then selecting the X button, if it's closable though. The only way I found to deselect all windows is to click with the mouse somewhere on the background.Am I overlooking something? If not, could you add some way to deselect all windows without having to use the mouse?
Standalone, minimal, complete and verifiable example:
Start the demo, enable
NavEnableKeyboard
under configuration then watchWantCaptureKeyboard
underInputs, Navigation & focus
The text was updated successfully, but these errors were encountered: