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

after changing keyboard layouts SDL reports the wrong virtual key code when ctrl is pressed #1767

Open
SDLBugzilla opened this issue Feb 10, 2021 · 1 comment
Milestone

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: 2.0.2
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2015-02-11 22:40:01 +0000, Andrew Kelley wrote:

To reproduce:

  1. Start an SDL application in Dvorak keyboard layout.
  2. Press ctrl+x (in dvorak) and observe that you get a key down event with virtual key SDLK_x
  3. Switch the keyboard layout to QWERTY
  4. Press ctrl+x (in qwerty) and observe that you get a key down event with virtual key SDLK_q when you expected to get virtual key SDLK_x

On 2015-10-14 20:36:37 +0000, Philipp Wiesemann wrote:

Maybe this is related to bug 3050.

@earl-ducaine
Copy link

I think the the problem mentioned above is more general than described -- it's not just switching keyboard layouts while SDL is running, but that the x part of ctrl+x is only available via scancode or key symbol which don't go through translation for the current OS keyboard layout.

As an example, an emacs-like editor on simulated hardware. I'm using a DVORAK mapping in Ubuntu.
Type some text:

  1. physical keys k
  2. physical keys j
  3. physical keys d
  4. I see the characters t h e (via text input)

Using the alt key as a modifier

  1. Press physical key alt and hold
  2. Press the physical key n
  3. Grab the printable part of the chord from text input, n mapped to b
  4. Read the modifier to determine the alt is depressed
  5. I can figure out that the command alt+b was intended! (hack, but it works)

However: using the ctlr key as a modifier

  1. press physical key ctrl and hold
  2. press the physical key n
  3. No text input event generated, so I have to use key up and key down events and grab the sym/scancode, which isn't mapped.
  4. I still know ctrl is the modifier, but I have no way to know that the user is using the DVORAK keyboard and n is mapped to b

This is related to issue: #3586, which is closed. But I think it wasn't realized how problematic this is for certain applications.

Also, maybe I'm missing something? or there's a work-around! In any case thanks for all the great work!

@slouken slouken removed the bug label May 11, 2022
@slouken slouken added this to the 3.2.0 milestone Nov 4, 2023
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