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

Keyboard layout issues #4187

Closed
renom opened this issue Mar 15, 2021 · 4 comments · Fixed by #4315
Closed

Keyboard layout issues #4187

renom opened this issue Mar 15, 2021 · 4 comments · Fixed by #4315

Comments

@renom
Copy link
Contributor

renom commented Mar 15, 2021

  1. The SDL_KEYMAPCHANGED event never occurs (this event is supposed to occur when the layout is switched).

  2. Field key.keysym.sym (type SDL_Keycode) of SDL_Event (used when type=SDL_KeyboardEvent), sticks to a single layout (mostly the one that's enabled when the app is started, but not always), so that regardless whether the layout is changed or not afterwards, all the keycodes are obtained like the layout has never been changed (e.g. I start the app when the russian layout is enabled, then I switch to the english one, but when SDL_KeyboardEvent occurs, key.keysym.sym is filled with russian letter keycodes unless I restart the app).

  3. The same way, SDL_GetKeyFromScancode and SDL_GetScancodeFromKey are supposed to return values depending on the current layout, but always use the starting layout.

My OS is Arch Linux, the SDL version is 2.0.14. Tested both on Wayland and X11.

@flibitijibibo
Copy link
Collaborator

Might be a duplicate of #4142 and #3471, see #4142 (comment) for more info.

@flibitijibibo
Copy link
Collaborator

If possible, can you try again with #4303 applied?

@renom
Copy link
Contributor Author

renom commented Apr 14, 2021

If possible, can you try again with #4303 applied?

  1. Works fine on KDE (Wayland) with SDL_VIDEODRIVER=wayland.
  2. The issues still persist on KDE (Wayland) if SDL_VIDEODRIVER isn't set or with SDL_VIDEODRIVER=x11.
  3. The issues still persist on KDE (X11).

@renom
Copy link
Contributor Author

renom commented Apr 14, 2021

Obtaning the keysym with Xutf8LookupString works fine for me in this example:
https://gist.github.com/baines/5a49f1334281b2685af5dcae81a6fa8a#file-xkeyexample-c-L81

But XkbKeycodeToKeysym or XGetKeyboardMapping always return the same keysym regardless which layout is enabled.

I wonder if this info could help to solve the problem.

Also:

  • setxkbmap -layout "us,ru" (where us,ru is your layout list) should be executed for xwayland (not sure why it's necessary actually, but otherwise it sticks to the english layout).
  • KeymapNotify event occurs, but with a delay (not sure why).

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 a pull request may close this issue.

2 participants