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

Alt+q not working in game anymore #1583

Open
ottml opened this issue Apr 19, 2023 · 3 comments
Open

Alt+q not working in game anymore #1583

ottml opened this issue Apr 19, 2023 · 3 comments

Comments

@ottml
Copy link
Contributor

ottml commented Apr 19, 2023

Press alt+q in the game. Nothing happens. The following window should be shown.
grafik

@Flamefire
Copy link
Member

I can confirm this. This seems be caused by SDL2 being able to handle ALT-codes. E.g. pressing ALT+1 gives not a 1

So we don't get a SDL_TEXTINPUT event when ALT is pressed. We could manually make it handle letters when ALT is pressed but I fear this may lead to duplicate input events on systems where pressing ALT doesn't disable the textinput mode/waits for combined characters.

@Flow86
Copy link
Member

Flow86 commented Apr 25, 2023

So is this a bug of SDL 2.26.4 then? Can someone try 2.26.5 (which is now available) if its fixed there? If so, I will update the toolchain again.

@Flamefire
Copy link
Member

No this is not a bug, it's a feature. We react on text-input events and SDL doesn't give us text until there is text. We could react on key-down events but that would not give us text in some cases. We can only have either Unicode text input or (raw) key press events and we want the former, except for rare cases where we use ALT+key as a combo. So far I've seen that for ALT+q (open quit-window) and ALT+w (close active window) in our usage.

I don't really see a solution here that will always work. We could test if ALT+letter-key produces a text input event on any system and if it does not we can react on keydown events when ALT and a letter-key is pressed as-if it was a text-input event.

This is actually a limitation of our extra abstraction over SDL: If we'd used SDL directly we are supposed to switch between text mode and "raw" mode depending on the context. I.e. if the cursor is in a text-control we'd enable text-mode and only react on textinput events and otherwise only react on keydown events. But our abstraction only has keydown in the interface so we can't "switch" between those modes and have to choose one.

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