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

Caps lock can't be suppressed on Mac OS Monterey #156

Open
saml-dev opened this issue Sep 24, 2022 · 1 comment
Open

Caps lock can't be suppressed on Mac OS Monterey #156

saml-dev opened this issue Sep 24, 2022 · 1 comment
Labels

Comments

@saml-dev
Copy link

saml-dev commented Sep 24, 2022

I'm on Mac OS 12.6 and suppressing caps lock doesn't work.

Setup

To test this, I'm building and running the demo_hook example in this repo. I added these lines to try to suppress the event:

        case EVENT_KEY_PRESSED:
           if(event->data.keyboard.keycode == VC_CAPS_LOCK){
                printf("caps lock press: %d\n",event->mask);
                event->reserved = 0x1;
            }
            break;
        case EVENT_KEY_RELEASED:
            if(event->data.keyboard.keycode == VC_CAPS_LOCK){
                printf("caps lock release: %d\n",event->mask);
                event->reserved = 0x1;  //and this part
            }
            break;

Expected Behavior

Setting event->reserved should prevent the caps lock key default behavior from happening.

Actual Behavior

The caps lock press is still registered and toggles the caps lock mode.

Note – I am able to suppress other keys successfully, such as VC_D. Let me know if there's any other testing I can do. I've never written C and was just compiling/tweaking this to test, but happy to help how I can.

@kwhat kwhat added the apple label May 5, 2023
@kwhat
Copy link
Owner

kwhat commented May 5, 2023

It sounds a lot like Apple is intentionally preventing this behavior. The caps-lock key on OSX works a lot differently than most other keys. I am not sure there is any way to "fix" this. Windows does something similar with ctrl+alt+delete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants