catch GLFW_MOD_CAPS_LOCK?

hi dudes,

trying to intercept GLFW_MOD_CAPS_LOCK on some widgets:

(e.mods & RACK_MOD_MASK) == GLFW_MOD_CAPS_LOCK

but can’t catch it. what’s the correct way keeping it cross-platform?

thanks, as usual

I don’t really understand the relationship between your requirement and the code fragment you pasted.

You’re asking about caps lock, but you posted code testing for ALT

sorry, was a typo! edited the question :wink:

I think you have to determine ModKey like this:

YOUR_MOD_KEY_CODE == (::rack::appGet()->window->getMods() & YOUR_MOD_KEY_CODE)

You must at least obtain the rack app window pointer first, but I’m not sure if I got your problem right.

https://vcvrack.com/docs/structrack_1_1Window

I see two different things above. The original code sample looks like it is processing a key event and looking for a mod key. the fragment from @qno is trying to determine if they mod key is down “right now”, not modifying a key event. It’s impossible to tell from the original question which they are trying to do.

RACK_MOD_MASK specifically masks out caps/num/scroll lock. Use

e.mods & GLFW_MOD_CAPS_LOCK

if you want to check if caps lock is enabled when a key is pressed.

works perfectly!

thanks, as usual!