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

SDL: Use scancodes for keyboard bindings (#905) #2605

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

depp
Copy link

@depp depp commented Jul 30, 2022

Core key bindings for SDL >= 2.0 are now independent of the keyboard
layout. QWERTY users get ZXAS, German users get YXAS, French layouts get
WXQS, etc. Existing customizations will be ignored, users with
customized bindings for SDL will get the new defaults and have to create
a new configuration.

Existing functionality is preserved for SDL 1.x.

Core key bindings for SDL >= 2.0 are now independent of the keyboard
layout. QWERTY users get ZXAS, German users get YXAS, French layouts get
WXQS, etc. Existing customizations will be ignored, users with
customized bindings for SDL will get the new defaults and have to create
a new configuration.

Existing functionality is preserved for SDL 1.x.
Copy link
Member

@endrift endrift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some reservations about this change:

The first and foremost one is that it won't load custom SDLK bindings if there are any present, instead falling back to the new SDLS bindings.

Secondly, which OSes have you tested this on? I seem to recall trying something like this years ago, but running into issues with it on some OSes. It'll need broader testing.

Third, it might (might) be desirable to be able to select at runtime whether or not scancodes or keysyms are used. But I'm not sure.

I have one implementation nitpick, specifically that I use #define DEF and #ifdef DEF instead of #define DEF 1 and #if DEF but that's a simple enough change once more prominent concerns are allayed or addressed.

Targeting this for 0.11 though since 0.10 is frozen for this kind of change.

@endrift endrift added this to the mGBA 0.11.0 milestone Jul 31, 2022
@endrift endrift linked an issue Jul 31, 2022 that may be closed by this pull request
@depp
Copy link
Author

depp commented Jul 31, 2022

The first and foremost one is that it won't load custom SDLK bindings if there are any present, instead falling back to the new SDLS bindings.

You could do this with SDL_GetScancodeFromKey(), but it might take me some time to understand the configuration system well enough to make this change.

Secondly, which OSes have you tested this on? I seem to recall trying something like this years ago, but running into issues with it on some OSes. It'll need broader testing.

I've only personally tested this code on Linux, but I've written similar code and tested it on Windows and macOS before. I can test on additional systems.

Third, it might (might) be desirable to be able to select at runtime whether or not scancodes or keysyms are used. But I'm not sure.

I have a hard time seeing the benefit. SDL scancodes are portable. Keysyms are not portable, they are fragile and break on some systems. Some people even change keyboard layout while programs are running--and this would break any keysym layout.

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

Successfully merging this pull request may close these issues.

Custom keyboard defaults for languages
2 participants