Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GreenLightning opened this issue Dec 19, 2019 · 3 comments
Closed

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

GreenLightning opened this issue Dec 19, 2019 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Milestone

Comments

@GreenLightning
Copy link

GreenLightning commented Dec 19, 2019

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

@gopherbot gopherbot added this to the Unreleased milestone Dec 19, 2019
@dmitshur dmitshur added OS-Windows NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 19, 2019
@alexbrainman
Copy link
Member

@GreenLightning your explanation sounds reasonable.

Do you want to send change you described? This https://golang.org/doc/contribute.html is how to contribute.

Thank you.

Alex

@GreenLightning
Copy link
Author

I have created a pull request at golang/exp#8.

@gopherbot
Copy link

Change https://golang.org/cl/212403 mentions this issue: shiny/driver/internal/win32: handle syskey messages

@golang golang locked and limited conversation to collaborators Dec 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants