Skip to content

Fix keyboard input when certain keys overlap with dead keys

Hanicef requested to merge Hanicef/SRB2:fix-us-intl-console-key into next

So, after getting an update from @spherallic on the current state of keyboard layouts, it turns out that there was an issue with US-Intl. keyboard layouts due to an unfortunate overlap with dead keys. In a nutshell, dead keys work by basically postpone a key input until a next key is pressed, and attempts to merge the two keys later if applicable. The problem with this is that the console key overlaps with a dead key on US-Intl, so pressing that key also triggered a dead key sequence, causing it to attempt to merge a dead key. This would succeed, but because SRB2 only supports ASCII, that key will unfortunately be ignored by SRB2 and thus nothing will appear on-screen.

The fatal mistake here is not using SDL_StartTextInput and SDL_StopTextInput for keyboard input, resulting in SDL always trying to adhere to dead keys, even in cases when it's not appropriate. By adding these function calls and calling these at appropriate locations, we can control when it should apply dead keys or not, prevent it from attempting a dead key sequence when opening the console, for example.

Fixes #1174 (closed)

Merge request reports