We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5158 - [PATCH] Caps Lock key behaves like a locking key on macOS
Summary: [PATCH] Caps Lock key behaves like a locking key on macOS
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.12
Hardware: x86 macOS 10.15
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-26 03:57 UTC by Cameron Gutman
Modified: 2020-05-29 23:08 UTC (History)
0 users

See Also:


Attachments
Change Caps Lock to toggle behavior (1.45 KB, patch)
2020-05-26 03:58 UTC, Cameron Gutman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron Gutman 2020-05-26 03:57:28 UTC
I understand macOS provides some unique challenges for recognizing caps lock key presses (see #2157), but https://hg.libsdl.org/SDL/rev/6a3b2cc9d66c introduced a new issue where SDLK_CAPSLOCK behaves like a locking key.

We receive SDL_PRESSED when Caps Lock is toggled on, then an SDL_RELEASED when it is toggled off. This behavior differs from Win32 and X11 where we get a SDL_PRESSED/SDL_RELEASED pair each time the key itself is pressed and released.

There's not a perfect solution for observing the physical state of the Caps Lock key on macOS, but I think toggle behavior more accurately represents how most users use the Caps Lock key than the locking behavior we have today.

If I'm using Caps Lock down to trigger an action in game, the current behavior means that the SDL_PRESSED codepath will only be executed every other time that Caps Lock is pressed.
Comment 1 Cameron Gutman 2020-05-26 03:58:20 UTC
Created attachment 4356 [details]
Change Caps Lock to toggle behavior
Comment 2 Sam Lantinga 2020-05-29 23:08:20 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/bb3d7dcb4ae8