kristian / system-hook

Global Keyboard / Mouse Hook for Java applications.
MIT License
270 stars 48 forks source link

No way to tell which shift/control/alt is being pressed? #39

Closed JaCoB123456798 closed 5 years ago

JaCoB123456798 commented 5 years ago

I'd love to be able to tell whether it was the left or right shift/control/alt being pressed instead of just knowing if at least one of them was being pressed.

kristian commented 5 years ago

Hello @JaCoB123456798, sorry for the late reply!

Please have a look at the extendedKey property of the MouseEvent! In case extendedKey = true, it's the RIGHT button for all of the individual duplicate buttons:

VK_LWIN -> winPressed = true VK_RWIN -> winPressed = true and extendedKey = true

The same applies for: LWIN/RWIN, LMENU/RMENU, LSHIFT/RSHIFT and LCONTROL/RCONTROL.

Hope that helps! Best regards.