From bd63d3e1ec50eda33f6c300b90a69e791b9d969c Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 28 Aug 2019 13:27:13 +0300 Subject: [PATCH] Fix modifier keys causing key-code mismatch on Linux/X11. --- platform/x11/os_x11.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index ca72393e43c..dfa0a45538a 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1757,7 +1757,10 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { // XLookupString returns keysyms usable as nice scancodes/ char str[256 + 1]; - XLookupString(xkeyevent, str, 256, &keysym_keycode, NULL); + XKeyEvent xkeyevent_no_mod = *xkeyevent; + xkeyevent_no_mod.state &= ~ShiftMask; + xkeyevent_no_mod.state &= ~ControlMask; + XLookupString(&xkeyevent_no_mod, str, 256, &keysym_keycode, NULL); // Meanwhile, XLookupString returns keysyms useful for unicode.