Skip to content

x/mobile: Key codes don't include non-keypad Plus Sign #69778

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

Closed
justledbetter opened this issue Oct 4, 2024 · 3 comments
Closed

x/mobile: Key codes don't include non-keypad Plus Sign #69778

justledbetter opened this issue Oct 4, 2024 · 3 comments
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@justledbetter
Copy link

CodeKeypadPlusSign is returned by the library via this line, similar to CodeKeypadHyphenMinus above it:

https://github.com/golang/mobile/blob/c6794c95c70b02ddb1a79d92fec29f8b8ddd8836/event/key/key.go#L179

but there is no corresponding CodePlusSign with CodeHyphenMinus:

https://github.com/golang/mobile/blob/c6794c95c70b02ddb1a79d92fec29f8b8ddd8836/event/key/key.go#L136

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Oct 4, 2024
@gopherbot gopherbot added this to the Unreleased milestone Oct 4, 2024
@mknyszek
Copy link
Contributor

mknyszek commented Oct 4, 2024

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 4, 2024
@justledbetter
Copy link
Author

justledbetter commented Oct 7, 2024

For reference, Key.Code seems to be set to decimal 46 when the non-keypad + is hit, and this works appropriately when combined with Key.Modifiers (Alt-+, Ctrl-+, etc) - As tested on a Cros linux container on ChromeOS 128.

@justledbetter
Copy link
Author

Looking further at the code, it seems that the correct way to call this is to look for

(event.Modifiers&key.ModShift != 0) && (event.KeyCode == key.CodeEqualSign)

Tested this on the CrOS system I originally hit the problem on and this seems to be the right fix. No code change needed to x/mobile after all! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants