mojira.dev
MC-15142

Key-Locking Behaviour (keysym/keycode-error on keyrelease)

Minecraft uses KeySym under linux to determine which key was pressed. KeySym by definition only has its value set correctly at keyPRESS - not keyRELEASE.
To get the real values use the KeyCode.

e.g. having de_de set as default layout yields (in xev):

KeyPress event, serial 40, synthetic NO, window 0x4600001,
root 0xa9, subw 0x0, time 1668220, (670,378), root:(672,401),
state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x4600001,
root 0xa9, subw 0x0, time 1668345, (616,314), root:(618,337),
state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

but with de_neo you get:

KeyPress event, serial 40, synthetic NO, window 0x4600001,
root 0xa9, subw 0x0, time 1722888, (608,465), root:(610,488),
state 0x2000, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x4600001,
root 0xa9, subw 0x0, time 1723003, (608,465), root:(610,488),
state 0x2001, keycode 50 (keysym 0xffe5, Caps_Lock), same_screen YES,
XKeysymToKeycode returns keycode: 66
XLookupString gives 0 bytes:
XFilterEvent returns: False

(This Effect is a side-effect on having both shift-keys (pressed at the same time) act as Caps-Lock - but thats just a guess).

A similar bug was reported to another application ( https://bugzilla.gnome.org/show_bug.cgi?id=683534#c7 ).

Workaround:
If you make de_de the default keyboard-layout and just switch to de_neo, minecraft uses the de_de-Keysym (in every menu - so you have wasd "set" for walking), but you still have neo in text-chat (thus having vuia as the keys you actually press for walking).
Doing so, however, disables the Mod4-Switch making 2 of the 6 levels of the neo-layout (see http://www.neo-layout.org for reference) unusable.
This will affect other layouts where similar behaviour is enforced, too.

Edit: To make the Mod4-Switch (at least AltGr) workable again i could add an override ("Key to choose 5th level" set to "Right Alt chooses 5th level, locks when pressed together with another 5th-level-chooser") in the keyboard settings under KDE. YMMV.

Comments 1

Let me correct that:

Minecraft uses LWJGL which uses KeySym under linux to determine which key was pressed. KeySym by definition only has its value set correctly at keyPRESS - not keyRELEASE.

Please report this on: https://github.com/LWJGL/lwjgl/issues

Nils

(Unassigned)

Unconfirmed

input, neo-layout, shift

Minecraft 1.5.1, Minecraft 1.5.2

Retrieved