-
-
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
Not able to enter characters in InputText on german keyboard for which AltGr is needed as modifier #370
Comments
I submitted a super basic pull request #369 |
Thanks Richard. I also have added a comment about it. |
Hello there, I still have this issue on german keyboard. I think it worked with older versions but I updtated the imgui to the latest verstion and have this issue now. I'm using the docking branch. Everytime I press AltGR (precisely on key up) the context switches from the input field to the tab layer. |
What do you mean by “the tab layer” ? Could you provide a more precise repro or a GIF?
|
I tested it with my usual keyboard, the keyboard on my notebook and the keyboard of a workmate. Looks like the "AltGr" button on the german keyboard is intepreted as "Alt" for one frame on keyup. |
Which Platform backend are you using, and you could test this in examples with all 3 major backends: sdl, glfw, win32? |
I use glfw as platform binding and opengl3 as renderer. Unfortunately, I do only use glfw in my whole project and do not know how to test the other backends. |
I installed a German keyboard, confirmed that AltGR presses CTRL+ALT and confirmed that this combination does not trigger the menu layer here. Are on you latest version?
|
Never mind, you said "I updtated the imgui to the latest verstion and have this issue now." I can confirm that GLFW has an issue there, while SDL and Win32 backends don't. Somehow, in GLFW AltGR does not send a CTRL+ALT but only a regular ALT, which is rather odd ihmo. |
By the way, the reason you are now getting the bug is not because of a recent change but presumably because you enabled keyboard navigation (bug wouldn't manifest without). Logged events from all three backends under Windows 10, here's what I found: GLFW added in ImGui_ImplGlfw_KeyCallback handler: SDL added in SDL_KEYDOWN/SDL_KEYUP handler: Win32 added in WM_KEYDOWN handler:
So interestingly no one seems to agree on a standard way to behave.... |
Problem is GLFW key handler explicitely says: And uses keys insteads of the
So we need to track why we made that change in the first place, and if it was a mistake. Made the change in 2015 Following Following
In particular I think the behavior described in #183 perhaps was already fixed in GLFW and we ought to get back to using |
Data for Linux and OSX courtesy of @rokups
And unfortunately GLFW under Linux still does that weird thing of not reporting keyboard modifiers on press:
SDL gets it ok under Linux so I would assume it's a GLFW bug under Linux... I can confirm that under Windows, with German keyboard enabled, AltGR doesn't open menus, whereas with French or English keyboard it does open menus. So if we were to add a naive:
This would break the flow for non-german users who use AltGR to open menus. One half-solution we could do to solve it for German users under Windows is:
But for Linux and OSX users I would need more information on how Alt/AltGR behave in their OS. |
First of all, thank you very much for your work. ImGUI is really an insanley good tool for building GUIs in C++.
I'm not 100% sure but I don't think I ever disabled the keyboard navigation, neither before nor after I updated. Partial fix for people with the same problem: I just commented
in the imgui.cpp. (quick and dirty) |
Here's a recap of using ALT in non-dear imgui applications (courtesy of @rokups)
MacOS: Option/Control/Command do not interact with menu. |
@str0yd could you clarify your OS, window manager etc? |
I'm on Windows 10. Configuration of GLFW in my application: Configuration for ImGui: |
For future us: neither MacOS and Linux (X11) report CTRL when typing text with AltGr (re-tested today on SDL/GLFW). Basically this is a confirmation that this table is valid and we did not miss anything when testing these behaviors. |
On german keyboards the user can't enter chars which use AltGr as a modifier (e.g '{' '[' ']' '}' '' ) because of:
“Alt Gr” on german (and other) keyboards – “Alt Gr” is not the same as right-hand “Alt” on US keyboards, it essentially is a short-cut for “Control” and right-hand “Alt”. (from http://blog.molecular-matters.com/2011/09/05/properly-handling-keyboard-input/)
With the existing code all chars are suppressed when CTRL-press is detected.
The text was updated successfully, but these errors were encountered: