goatcorp / XIVLauncher.Core

Cross-platform version of XIVLauncher, optimized for Steam Deck
GNU General Public License v3.0
84 stars 35 forks source link

Keyboard shortcuts incorrect on non-QWERTY layouts #118

Open DarkKirb opened 3 months ago

DarkKirb commented 3 months ago

On non-QWERTY keyboard layouts, the keyboard shortcuts work incorrectly.

Expected Behavior

To undo text entry, I’d expect to press ctrl+z (z as in the key that produces the z letter), like in all other applications

Actual behavior

To undo text entry, I have to press ctrl+ü (which is the same combination as on QWERTY)

This also applies to copying (mapped to ctrl+c, here ctrl+ä), pasting (mapped to ctrl+v, here ctrl+p), cutting (mapped to ctrl+x, here ctrl+ö)

Steps to reproduce

  1. Change your keyboard layout to German (QWERTZ)
  2. open any text editor and press the key labeled Y
  3. Notice how it types a z
  4. press CTRL+Y (keyboard labels)
  5. Notice how the z disappears again
  6. Repeat 2-5 in xiv launcher and see how ctrl+y does not result in the input being undone.
Ennea commented 3 months ago

This ticket needs a little more info (though I'm not yet completely sure which). Are you using X11 or Wayland? What desktop environment, if any? How did you change your keyboard layout?

DarkKirb commented 3 months ago

I am using KDE Wayland but it’s also happening on X11. I changed the keyboard layout in the Input Device section of the KDE System Settings app.

Dug through the code (both of xivlauncher and imgui) a bit and i think the issue may be due to the use of KeyMap (which according to the code is marked as obsolete and also is about the “physical key” being pressed, presumably in US QWERTY)

https://github.com/goatcorp/XIVLauncher.Core/blob/92c44f7d7a33081327790816b0e47d0a3e1b3cf2/src/XIVLauncher.Core/ImGuiBindings.cs#L458-L482 https://github.com/ocornut/imgui/blob/f50ddc431e3b8840036e88abc4c3cf74500aa12b/imgui.h#L1307-L1312