Skip to content
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

Windows IME can cause duplicate text input #8930

Closed
nielsmh opened this issue Apr 2, 2021 · 5 comments
Closed

Windows IME can cause duplicate text input #8930

nielsmh opened this issue Apr 2, 2021 · 5 comments

Comments

@nielsmh
Copy link
Contributor

nielsmh commented Apr 2, 2021

Version of OpenTTD

799eb31 and probably many earlier. Possibly only on Win32 video driver, possibly depends on standard library/compiler used.

Expected result

One press of a letter key results in one letter input.

Actual result

Some input is duplicated, and the duplicate keypresses appear as capital letters despite not touching Shift or Caps Lock keys.

image
image

Steps to reproduce

Appears to be related to slow framerates. Recommend opening console and filling it with many lines, and opening a text file viewer window, and running an unoptimised build with checks/asserts enabled.
Then type quickly. Mashing keys on home row works well.

Windows 10 (version 2004)
Video driver: win32-opengl (NVIDIA Corporation - GeForce RTX 2060/PCIe/SSE2 (3.2.0 NVIDIA 456.71))
Blitter: 40bpp-anim
Windowed mode: 2560x1600 at 60 Hz
Interface and Font size both at 2x scale

@James103
Copy link
Contributor

James103 commented Apr 2, 2021

Can you reproduce this inside the text input windows that correspond to renaming vehicles/stations/depots/companies/etc?

@nielsmh
Copy link
Contributor Author

nielsmh commented Apr 2, 2021

Yes I can reproduce this also in other text inputs, and it appears I can even under high framerates, if I mash keys fast enough.

@LordAro
Copy link
Member

LordAro commented Apr 2, 2021

I think if you could bisect this to work out where the problem first occurs (there have been a lot of changes to video drivers recently, after all), that would be super helpful in working out what is actually causing it

@nielsmh
Copy link
Contributor Author

nielsmh commented Apr 8, 2021

Okay I've reproduced this even in the release build of 1.11.0.

@nielsmh
Copy link
Contributor Author

nielsmh commented Apr 8, 2021

Turns out it has to do with the Japanese IME being the active input/keyboard layout. Even if the text conversion isn't active and it's in direct ASCII input mode, it causes this behaviour. Switching to a different keyboard layout makes the input behave normally.
I don't have this kind of misinput in any other programs, so it seems to have something to do with how OpenTTD handles input from IMEs.

@nielsmh nielsmh changed the title Duplicate text input under slow framerates Windows IME can cause duplicate text input Apr 8, 2021
michicc added a commit to michicc/OpenTTD that referenced this issue Apr 8, 2021
…n edit box is in focus.

Handle printable input only when the matching WM_CHAR message is incoming.
Without an edit box, do the handling in keydown as usual to support hotkeys.
@michicc michicc closed this as completed in 96d33ab Apr 9, 2021
LordAro pushed a commit to LordAro/OpenTTD that referenced this issue Apr 17, 2021
…n edit box is in focus.

Handle printable input only when the matching WM_CHAR message is incoming.
Without an edit box, do the handling in keydown as usual to support hotkeys.
LordAro pushed a commit that referenced this issue Apr 18, 2021
…box is in focus.

Handle printable input only when the matching WM_CHAR message is incoming.
Without an edit box, do the handling in keydown as usual to support hotkeys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants