Fix modifier keys causing key-code mismatch on Linux/X11.

This commit is contained in:
bruvzg 2019-08-28 13:27:13 +03:00
parent 007a46ef6b
commit bd63d3e1ec
No known key found for this signature in database
GPG key ID: 89DD917D9CE4218D

View file

@ -1757,7 +1757,10 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
// XLookupString returns keysyms usable as nice scancodes/ // XLookupString returns keysyms usable as nice scancodes/
char str[256 + 1]; 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. // Meanwhile, XLookupString returns keysyms useful for unicode.