Hi Alexander Z., Kevin,
while working on JDK-8143596 (FXCanvas does not forward touch gestures to
embedded scene) I came across some „smell“ that I would like to discuss. That
is, the information about events that is exchanged between JFXPanel/FXCanvas
and the EmbeddedScene/EmbeddedStage is currently encoded via constants of
com.sun.javafx.embed.AbstractEvents. That is, FXCanvas and JFXPanel map SWT and
AWT event information to constants in AbstractEvents, which are finally mapped
to a JavaFX representations within EmbeddedScene.
Without knowing the motivation behind this indirection, and without having
tried it in detail yet, for me it seems as if AbstractEvents was superfluous
and JavaFX representations could directly be used to transfer this information
instead. In case of EmbeddedSceneInterface#inputMethodEvent() for instance,
AbstractEvents was already bypassed, as here EventType is used as a parameter
(instead of an AbstractEvents constant). Also, the modifier constants defined
within AbstractEvents are only used in case of key events, while for mouse (and
now gesture events) boolean parameters are used to transport this information
(which could also be done in case of key events).
What do you think? In case you share my assessment I would propose to file a
separate issue for this, and I could offer to investigate it after JDK-8143596
has been resolved (I would not want to mingle it).