-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Fix Ascii char conversion for different keyboard layouts. #6785
Conversation
Thanks for the PR. Would passing |
I tried before using |
Are you certain you were launching the right compiled executable? (Sorry for the silly question, but i know it does happen when switching tools like that) |
There isn't any other executable to launch since I've got only one build that is used for testing rendering stuff. |
I agree that requesting users to change Windows settings is not desirable. I think your PR is probably good but it's really hard to find good documentation on this and I have an intuition there should be simpler solution out there so I am fishing for it. I've also seen forums implying LOWORD of GetKeyboardLayout() should be used rather than HIWORD which makes it more confusing. |
GetKeyboardLayout for me returns as HIWORD is Slovak Language while LOWORD is like child language which is English Language. As displayed in windows 10 language selection: There is documentation on the indentifiers on: Value of GetKeyboardLayout for me returns as |
I finished setting myself up with the same settings to confirm your findings (confirmed) and trying to find alternatives (not found yet). What strikes me as odd is that I find so few references to similar code, whereas it would seem like NECESSARY code that many applications would use. Surely if that code is necessary it should be ultra common? I can't imagine it would be only because "everyone" is using UNICODE builds? |
I have pushed your commit as c9d3c29 (with cosmetic modifications). I think there's something we might be missing. I can confirm same result as you but can't find other people doing the same thing as us. I wonder if it's because everyone switched to Unicode windows, where none of this matters. Of I wonder if also few people are using your setup (you are setup for English with Slovak keyboard, not Slovak with Slovak Keyboard). There's no easy way to compare as e.g. SDL/GLFW have creating Unicode windows for a while. I suppose pushing the change is the best way to find out,! Thanks for your work. |
I think there isn't anything we would be missing. If people mainly use unicode windows then it shouldn't even matter much. It rather gives better codepage handling for ascii windows. I sent the codepage code with GetKeyboardLayout & GetLocaleInfoA to few friends and it worked fine for Spanish & Chinese keyboard layout, even if it failed it would still fallback to the original |
Perhaps, seems like this dual language vs layout setup may be new and in this era I would understand everyone's on Unicode Windows. But this would mean many old apps would break inputs on Windows 10 ? |
They do indeed break inputs. If you search google for dummy things like |
This is upon implementation of the code that I posted and I had issue at #6782.
The generic
CP_ACP
does seem to be prefering the English Layout despite there is different keyboard layout selected.I implemented member inside
ImGui_ImplWin32_Data
that holdsKeyboardCodePage
and functionImGui_ImplWin32_UpdateKeyboardCodePage
that updates the keyboard codepage when needed, the update function is called only at initilization and WndProc msgWM_INPUTLANGCHANGE
.