I have detected some weird behavior of some Java software on OS X with a Magic Trackpad. I could detect that the magic lies in that when a horizontal "two-finger" scroll is performed, the modifiers constant of the MouseWheelEvent
is set to 1, which is the equivalent to the InputEvent.SHIFT_MASK
and thus causes the application to behave as if the user had SHIFT pressed.
How can I distinguish a horizontal scroll on the Magic Trackpad from a common SHIFT+Mouse Wheel? Using the InputEvent.SHIFT_DOWN_MASK
apparently deactivates the detection of SHIFT down altogether.
Here is a code snippet that behaves as described above:
@Override
public void mouseWheelMoved(@NotNull MouseWheelEvent e) {
int unitsToScroll = e.getUnitsToScroll();
int modifiers = e.getModifiers();
boolean shiftDown = ((modifiers & InputEvent.SHIFT_MASK) != 0);
boolean ctrlDown = ((modifiers & InputEvent.CTRL_MASK) != 0);
[...]
}
This is causing me a lot of headache to resolve.. Thank you for any help - it will be much appreciated