Detecting caps lock


#1

As far as I can tell there isn't a caps lock key modifier, and the shift modifier isn't set when caps lock is engaged. Is there something I'm missing?

Sean


#2

Not sure it's even possible to detect that on all platforms.. It's not a feature I've ever investigated, I'm afraid.


#3

A bit of Google-fuing shows the following keycodes for detecting the keypresses on these platforms:

Windows: VK_CAPITAL

Linux via XLIB: XK_Caps_Lock

Mac: NSAlphaShiftKeyMask


#4

It looks like the Windows (almost) and Linux code is aware of when their respective caps locks keys are hit, and Mac doesn't look for it.

I'd imagine that if this support were to be added, the key modifiers would automatically set shift to be its opposite if caps lock is down, as well as add caps lock as a modifier if an implementation needs to do something nonstandard when it's down. But, also looks like nobody has needed it, so at least I can add it easily to my own branch.

Thanks for the feedback.