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

Enable test_keys on WinForms #2198

Merged
merged 5 commits into from
Nov 7, 2023
Merged

Conversation

mhsmith
Copy link
Member

@mhsmith mhsmith commented Nov 6, 2023

Having run into some problems in this area last week, I now understand what this test is for.

Comment on lines +95 to +97
F1 = "<f1>"
F2 = "<f2>"
F3 = "<f3>"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistently using lower case makes the conversion code simpler.

@@ -14,7 +14,6 @@
(Key.MOD_1 + "a", {"key": Key.A, "modifiers": {Key.MOD_1}}),
(Key.MOD_2 + "a", {"key": Key.A, "modifiers": {Key.MOD_2}}),
(Key.MOD_3 + "a", {"key": Key.A, "modifiers": {Key.MOD_3}}),
(Key.CAPSLOCK + "a", {"key": Key.A, "modifiers": {Key.CAPSLOCK}}),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although GTK and Cocoa treat caps lock as a modifier, WinForms does not. And it wouldn't make sense anyway in the context of command shortcuts -- nobody will ask for a shortcut of "Caps Lock + X".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a subset of Emacs stalwarts who map CapsLock to CTRL to match old IBM Model F keyboards who might take umbrage with this claim :-) However, I agree that in modern practice, CAPSLOCK is highly unlikely to be used as a modifier

However, we're technically removing functionality, so we should add a release note about this.

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - it's a little surprising that there's no modifier enum for the Windows key, but I can't seen any reference to it in the Keys enum (there's representations of LWin and RWin, but no generic "Windows" key).

I've added the removal changenote that I flagged, and also added docs. If you're happy with those docs, feel free to merge.

@@ -14,7 +14,6 @@
(Key.MOD_1 + "a", {"key": Key.A, "modifiers": {Key.MOD_1}}),
(Key.MOD_2 + "a", {"key": Key.A, "modifiers": {Key.MOD_2}}),
(Key.MOD_3 + "a", {"key": Key.A, "modifiers": {Key.MOD_3}}),
(Key.CAPSLOCK + "a", {"key": Key.A, "modifiers": {Key.CAPSLOCK}}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a subset of Emacs stalwarts who map CapsLock to CTRL to match old IBM Model F keyboards who might take umbrage with this claim :-) However, I agree that in modern practice, CAPSLOCK is highly unlikely to be used as a modifier

However, we're technically removing functionality, so we should add a release note about this.

@mhsmith
Copy link
Member Author

mhsmith commented Nov 7, 2023

it's a little surprising that there's no modifier enum for the Windows key, but I can't seen any reference to it in the Keys enum (there's representations of LWin and RWin, but no generic "Windows" key).

I think that's because Windows key combinations are supposed to be handled by the system, rather than individual apps.

@mhsmith mhsmith merged commit 69fc00c into beeware:main Nov 7, 2023
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

toga.Key is not documented
2 participants