The javadoc for MouseEvent.isPopupTrigger hints that only mouse event of type MOUSE_PRESSED or MOUSE_RELEASED can be considered a popup trigger across platforms:
https://docs.oracle.com/javase/8/docs/api/java/awt/event/MouseEvent.html#isPopupTrigger--
<<isPopupTrigger should be checked in both mousePressed and mouseReleased for proper cross-platform functionality>>
This seems quite true. So, one would be right to expect that as long as the event is a popup trigger, it's either of "pressed" or "released" type.
However, that is not the case on Mac, where a mouse event of other type can return true from its isPopupTrigger method. That's the way it is implemented. Unlike Windows or X11, where a mouse event, which is not "pressed" or "released", is always supplied "false" popupTrigger parameter on its construction. On Mac, this parameter is computed from the modifiers for any type of a mouse event which ends up with, say, MOUSE_EXITED having the popupTrigger set to true.
This problem appears in JFX WebView component which just relies on the fact that only pressed/released mouse event can be a popup trigger. Please, find the testcase here: https://javafx-jira.kenai.com/browse/RT-39336. (Sorry for not providing a simple test case, I hope the issue is pretty clear w/o it).
https://docs.oracle.com/javase/8/docs/api/java/awt/event/MouseEvent.html#isPopupTrigger--
<<isPopupTrigger should be checked in both mousePressed and mouseReleased for proper cross-platform functionality>>
This seems quite true. So, one would be right to expect that as long as the event is a popup trigger, it's either of "pressed" or "released" type.
However, that is not the case on Mac, where a mouse event of other type can return true from its isPopupTrigger method. That's the way it is implemented. Unlike Windows or X11, where a mouse event, which is not "pressed" or "released", is always supplied "false" popupTrigger parameter on its construction. On Mac, this parameter is computed from the modifiers for any type of a mouse event which ends up with, say, MOUSE_EXITED having the popupTrigger set to true.
This problem appears in JFX WebView component which just relies on the fact that only pressed/released mouse event can be a popup trigger. Please, find the testcase here: https://javafx-jira.kenai.com/browse/RT-39336. (Sorry for not providing a simple test case, I hope the issue is pretty clear w/o it).