x/exp/shiny: Not all keyboard events are delivered on Windows #36213
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
OS-Windows
Milestone
What version of Go are you using (
go version
)?What did you do?
Run the
basic
example on Windows and press F10.What did you expect to see?
Expected the following lines of output:
What did you see instead?
No output was produced.
This issue also applies to pressing any key while the ALT key is pressed.
The cause of this issue is that shiny only handles the
_WM_KEYDOWN
and_WM_KEYUP
messages, whereas under certain circumstances (namely if the key is F10 or the ALT key is pressed) Windows sends the_WM_SYSKEYDOWN
and_WM_SYSKEYUP
messages instead. This behavior is documented in the Windows documentation here.This can be fixed by handling
_WM_SYSKEYDOWN
and_WM_SYSKEYUP
exactly like_WM_KEYDOWN
and_WM_KEYUP
here and here.For consistency across platforms and since key events are used for keyboard shortcuts, I would expect all keyboard events to be delivered. I identified this as the root cause of keyboard shortcuts not working in gdlv. For reference, GLFW, which is a C library that also provides an abstraction layer over creating windows and receiving input, also handles both kinds of messages in the same way (see here).
The text was updated successfully, but these errors were encountered: