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 shortcuts incorrect on non-QWERTY layouts #118

Open
DarkKirb opened this issue Feb 6, 2024 · 2 comments
Open

Keyboard shortcuts incorrect on non-QWERTY layouts #118

DarkKirb opened this issue Feb 6, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@DarkKirb
Copy link

DarkKirb commented Feb 6, 2024

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
Copy link

Ennea commented Feb 6, 2024

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
Copy link
Author

DarkKirb commented Feb 7, 2024

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)

private static void SetKeyMappings()
{
ImGuiIOPtr io = ImGui.GetIO();
io.KeyMap[(int)ImGuiKey.Tab] = (int)Key.Tab;
io.KeyMap[(int)ImGuiKey.LeftArrow] = (int)Key.Left;
io.KeyMap[(int)ImGuiKey.RightArrow] = (int)Key.Right;
io.KeyMap[(int)ImGuiKey.UpArrow] = (int)Key.Up;
io.KeyMap[(int)ImGuiKey.DownArrow] = (int)Key.Down;
io.KeyMap[(int)ImGuiKey.PageUp] = (int)Key.PageUp;
io.KeyMap[(int)ImGuiKey.PageDown] = (int)Key.PageDown;
io.KeyMap[(int)ImGuiKey.Home] = (int)Key.Home;
io.KeyMap[(int)ImGuiKey.End] = (int)Key.End;
io.KeyMap[(int)ImGuiKey.Delete] = (int)Key.Delete;
io.KeyMap[(int)ImGuiKey.Backspace] = (int)Key.BackSpace;
io.KeyMap[(int)ImGuiKey.Enter] = (int)Key.Enter;
io.KeyMap[(int)ImGuiKey.Escape] = (int)Key.Escape;
io.KeyMap[(int)ImGuiKey.Space] = (int)Key.Space;
io.KeyMap[(int)ImGuiKey.KeypadEnter] = (int)Key.KeypadEnter;
io.KeyMap[(int)ImGuiKey.A] = (int)Key.A;
io.KeyMap[(int)ImGuiKey.C] = (int)Key.C;
io.KeyMap[(int)ImGuiKey.V] = (int)Key.V;
io.KeyMap[(int)ImGuiKey.X] = (int)Key.X;
io.KeyMap[(int)ImGuiKey.Y] = (int)Key.Y;
io.KeyMap[(int)ImGuiKey.Z] = (int)Key.Z;
}

https://github.com/ocornut/imgui/blob/f50ddc431e3b8840036e88abc4c3cf74500aa12b/imgui.h#L1307-L1312

@Blooym Blooym added the bug Something isn't working label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants