mojira.dev

SebHL

Assigned

No issues.

Reported

MC-210642 'previous' and 'next' media buttons are bind to 'Drop Selected item' and 'Social Interactions screen' respectively Community Consensus

Comments

Scancode.256 is one of many untranslated keys:
https://minecraft.wiki/w/Java_Edition_untranslated_keys

In the table, even the media-keys seem to be lumped under untranslated "scancode.256", which might be true for a keyboard with dedicated media-buttons, as opposed to remappked keys and keys activated with modifyers.

Just 'p' or 'q' or whatever codes are applicable from the relation described: play-pause: "g", stop-track: "j", previous: "q", next: "p".
There are probabily loads more, form other special keys, that can have fun relations.

I also get "scancode.256" on volume-keys (up, down and mute), as in the other issue. Here both volume keys for me produces "scancode.256", so pressing any of them fires said key bound to "scancode.256".

Yes the issue still persists, at least for me, mine runs on windows 10, but it would be weird if they decided to change how keyboards worked.
I've looked in to it a bit with waht i know from LWJGL, (if that is what used), as an interface between MC and the system when dealing with UI-events such as keystrokes, the individual keycodes are send and handled.

Problem might lie in the fact that normal keys and media-keys share the same codes, in a sense. For some (idk about everyone) when pressing a mediakey, both the mediakey-code and the unintented normal key-code are registered.

[media]

As seen here, in a keyboard event viewer (just one found online), when pressing a button normally, the code "KeyQ" and "KeyP" are fired with their respective event types. When pressing a mediakey, such as forward/next-track, the mediabutton code is "MediaTrackPrivous/-Next" on downstrokes, and "KeyQ/P" on upstrokes.
I would not know if that is fully how it works in the games code as per say, but it is an educated guess. and it is a bit weird that it would get counted as a full press.

The MediaPlayPause (ie. play/pause playing music) key has a "KeyG" code on its upstroke. If you then were to change to you drop key (or any key for that matter) to G and press the play/pause media-key, it would drop, as if you pressed G.
The same would happen for some keyboard where they have page up and down on the numpad, though function keys, where as an example, a PageDown would be associated with Numpad3 or something. Then Numpad3 is the key registered in game instead for PageDown, even with the key identifier, since it just uses the code keycode instead.

All in all it seems to be related what "special" keys, that might be in usual places or have funky associations with other keys on peoples keyboards, where there seems to be some weird standards. But the issue also lies in the interpretation of what 'data' is read as a key or keypress, Inconsistent keycodes vs. the actual key/other identifiers.

I found that for some reason some apps interpret media-keys as 'g' 'j' 'q' and 'p', for some reason.
This is also apparent in MC if you go into the key-bind settings and assign to a media-key.
That would explain why MC also does that, but it is weird that it does, when other applications don't. Maybe it is just a default in some library or java, idk.

To answer violine1101's Q's:
I use my laptop keyboard, where some keys are accessed with (or if unlocked, without) a modifier key (Fn). But this has also been happening on other computers (which have had media-keys) that i have had.