| Summary: | No SDL_TEXTEDITING after pressing Alt key on Raspberry Pi Linux | ||
|---|---|---|---|
| Product: | SDL | Reporter: | q3dev <ioq3> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | markomizdrak, sezeroz |
| Version: | 2.0.7 | ||
| Hardware: | ARM | ||
| OS: | Linux | ||
| Attachments: | Patch for SDL_evdev_kbd.c | ||
|
Description
q3dev
2018-02-25 02:36:42 UTC
Ryan, can you look at this for SDL 2.0.8 today? I've been doing more testing to try and figure out what's causing this. Pressing either Ctrl key also stops text input in the game console. The Alt and Ctrl keys are both modifiers, and appear to have normal output when logged by the games built-in keyboard diagnostics: + Scancode: 0xe6(Right Alt) Sym: 0x400000e6(Right Alt) KMOD_RALT Q:0x88(ALT) Scancode: 0xe6(Right Alt) Sym: 0x400000e6(Right Alt) Q:0x88(ALT) + Scancode: 0xe2(Left Alt) Sym: 0x400000e2(Left Alt) KMOD_LALT Q:0x88(ALT) Scancode: 0xe2(Left Alt) Sym: 0x400000e2(Left Alt) Q:0x88(ALT) + Scancode: 0xe4(Right Ctrl) Sym: 0x400000e4(Right Ctrl) KMOD_RCTRL Q:0x89(CTRL) Scancode: 0xe4(Right Ctrl) Sym: 0x400000e4(Right Ctrl) Q:0x89(CTRL) + Scancode: 0xe0(Left Ctrl) Sym: 0x400000e0(Left Ctrl) KMOD_LCTRL Q:0x89(CTRL) Scancode: 0xe0(Left Ctrl) Sym: 0x400000e0(Left Ctrl) Q:0x89(CTRL) The shift key is also a modifier but it doesn't affect the text input in the console. Maybe there's different handling of these keys when SDL2 is configured with --disable-video-x11? Thank you for your help with this. There's a difference in keydown events being returned by 2.0.4 and 2.0.8. Here's the left Alt keydown/keyup events returned by 2.0.4: + Scancode: 0xe2(Left Alt) Sym: 0x400000e2(Left Alt) MOD: 0x0000 Q:0x88(ALT) Scancode: 0xe2(Left Alt) Sym: 0x400000e2(Left Alt) MOD: 0x0000 Q:0x88(ALT) Here's the left Alt keydown/keyup events returned by 2.0.8: + Scancode: 0xe2(Left Alt) Sym: 0x400000e2(Left Alt) MOD: 0x0100 KMOD_LALT Q:0x88(ALT) Scancode: 0xe2(Left Alt) Sym: 0x400000e2(Left Alt) MOD: 0x0000 Q:0x88(ALT) The keydown modifier value is different. The changeset where things stopped working had some code that changed the modifier value. https://hg.libsdl.org/SDL/rev/0f79dd727ed6#l1.795 After pressing either Alt or Ctrl key on 2.0.8, the SDL_TEXTINPUT stops. Any help that you can offer would be appreciated. Thank you. Created attachment 3195 [details]
Patch for SDL_evdev_kbd.c
I believe I found the issue in /src/core/linux/SDL_evdev_kbd.c. I placed a number of printf statements in function SDL_EVDEV_kbd_keycode and found that pressing either Alt or Ctrl key changes the value of the shift_final variable. There's nothing to reset the kbd->shift_state so the shift_final variable stays set for all subsequent key presses. Resetting the kbd->shift_state = 0 at the end of the function appears to fix the problem. Please see the attached patch file. Thank you. (In reply to q3dev from comment #5) > I believe I found the issue in /src/core/linux/SDL_evdev_kbd.c. I placed a > number of printf statements in function SDL_EVDEV_kbd_keycode and found that > pressing either Alt or Ctrl key changes the value of the shift_final > variable. There's nothing to reset the kbd->shift_state so the shift_final > variable stays set for all subsequent key presses. Resetting the > kbd->shift_state = 0 at the end of the function appears to fix the problem. > Please see the attached patch file. Thank you. shift_state should be reset in k_shift(), which is called indirectly by this line in that same function: (*k_handler[type])(kbd, keysym & 0xff, !down); Resetting it unconditionally is probably not correct; it's possible k_shift isn't handling keyup events correctly. I'll trace in there and see what's up. --ryan. I just wanted to check back and see if you’ve had time to look at this. I have a user with the same issue on a different Linux platform. Any help that you could offer would be greatly appreciated. Thank you for your help with this. I'm having the same issue. I have noticed the problem is not present when launching without a windowing environment. (Stretch Lite or Stretch rebooted into non-windowed environment). I don't know if that helps find the cause. Fixed, thanks! https://hg.libsdl.org/SDL/rev/7f3c9bffada4 |