Skip to content

x/exp/shiny: Not all keyboard events are delivered on Windows #36213

@GreenLightning

Description

@GreenLightning

What version of Go are you using (go version)?

go version go1.13.4 windows/amd64

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:

got key.Event{(CodeF10), key.Modifiers(), Press}
got key.Event{(CodeF10), key.Modifiers(), Release}

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windows

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions