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

Respect keyboard layout changes in X11 #7507

Open
nandoflorestan opened this issue Apr 30, 2021 · 7 comments
Open

Respect keyboard layout changes in X11 #7507

nandoflorestan opened this issue Apr 30, 2021 · 7 comments
Labels
Component: core-widget properties, eventdispatcher, widget.py, animation Platform: Linux Type: Bug A bug or something not working as intended

Comments

@nandoflorestan
Copy link

(On Linux) if I change the keyboard layout, the Kivy app doesn't realize it. But it should. Almost all (non-Kivy) apps respond to keyboard layout changes immediately.

@matham
Copy link
Member

matham commented May 1, 2021

It's not clear what you mean by "change the keyboard layout". Please provide an example.

@matham matham added the awaiting-reply Waiting for reply from issue opener, will be closed if no reply label May 1, 2021
@nandoflorestan
Copy link
Author

nandoflorestan commented May 1, 2021

Example:

  1. I have 2 keyboard layouts installed on the Gnome desktop -- or on Windows (doesn't matter).
  2. I start with the Dvorak keyboard layout active.
  3. I start the game I am developing with Kivy.
  4. I realize I would prefer the game to run with the QWERTY keyboard layout. So I change it in the OS.
  5. Although pretty much every other application in the system immediately responds to the keyboard layout change, the Kivy app continues to detect keystrokes with the initial keyboard layout, therefore every key I press has the wrong effect.
  6. I need to restart the Kivy app for it to see the keyboard as QWERTY.

If this is still not clear, please ask a more specific question.

@no-response no-response bot removed the awaiting-reply Waiting for reply from issue opener, will be closed if no reply label May 1, 2021
@matham
Copy link
Member

matham commented May 1, 2021

Oh, I see what you mean. I thought you were referencing the layout of a widget.

I imagine this is either and SDL2 issue, where it doesn't process the keyboard layout change, or kivy is ignoring some keyboard event. You may want to look at the sdl loop and see if we're not handling an event and submit a PR to fix if you can.

@nandoflorestan
Copy link
Author

I should clarify that I am incompetent in Cython, C++ and SDL2.

I did find this ticket in the SDL2 bug tracker. Apparently, Kivy needs to handle the SDL_KEYMAPCHANGED event, and as far as I can see, it does not.

Personally I do not know enough to submit a PR.

@matham
Copy link
Member

matham commented May 2, 2021

Using the demo app from the other issue I just tried this on Windows and could not replicate.

I started with qwerty and hit the s key. Then with app open I changed layout to dvorak, hit the same key again and the output was different:

Window: keycode=115, scancode=22, modifiers=['numlock']
Keyboard: keycode=(115, 's'), text=s, modifiers=['numlock']
Window: keycode=111, scancode=22, modifiers=['numlock']
Keyboard: keycode=(111, 'o'), text=o, modifiers=['numlock']

@nandoflorestan
Copy link
Author

Interesting.

I am on Manjaro Linux, which uses X11 (not Wayland).

https://github.com/libsdl-org/SDL/issues?q=keyboard+layout+change+X11

@nandoflorestan nandoflorestan changed the title Respect keyboard layout changes Respect keyboard layout changes in X11 May 2, 2021
@matham
Copy link
Member

matham commented May 2, 2021

Sounds like our x11 implementation is missing handling of some events. Specifically here we need to handle these events, but we don't.

@Julian-O Julian-O added Platform: Linux Component: core-widget properties, eventdispatcher, widget.py, animation Type: Bug A bug or something not working as intended labels Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: core-widget properties, eventdispatcher, widget.py, animation Platform: Linux Type: Bug A bug or something not working as intended
Projects
None yet
Development

No branches or pull requests

3 participants