Getting keyboard modifiers in fileDrop()

Hi there, any suggestions on how to find out which modifier keys (shift/ctrl/alt) are held down when dragging a file into a Cinder app (in the overloaded fileDrop() method). I had hoped the FileDropEvent might provide this, but it doesn’t. I thought about saving which modifiers are down in the keyDown() callback, but it turns out this isn’t not really helpful, because you normally don’t have focus on your app (but rather on the file explorer) when shift-dragging a file, so it doesn’t receive these events.

Maybe someone has run into this before?


I remember running into this a while ago and just ended up writing a GetKeyboardModifierState free function per platform which just called into [NSEvent modifierFlags] / GetAsyncKeyState() for mac and windows respectively, if i remember correctly.

app::MouseEvent does track some key modifier state though, so you may be able to grab it once your drag re-enters the window. This is the kind of thing that’s likely to behave subtly differently on different platforms though which is why i think I ended up going the route I did.

Thanks, yes, I’d also started to make a “custom” solution like that… It works (on Windows at least); I’ve not tested Mac yet. Would be nice to have in Cinder…

Added GitHub issue #2296, so as not to forget it.