Modifier callbacks


#1

Hi, is there any mechanism to respond to changes in modifier keys being pressed (e.g. shift, ctrl), other than to poll?

thx


#2

Component::modifierKeysChanged !


#3

That doesn’t work on Windows and on OS X. On windows keyStateChanged is called but modifierKeysChanged isn’t. On OS X neither one is called.


#4

Nevermind — Forgot to call setWantsKeyboardFocus.

Here’s the results with setWantsKeyboardFocus(true) called, for a component which was added to the desktop:

Windows: never, use keyStateChanged instead.
OS X: never
Linux / X11: usually, but not always

So the answer is: use polling.


Roeland


#5

Not tried on Linux but OSX and Windows work fine for me…