Access to private EventHandlers
jose.pereda at gluonhq.com
Thu Dec 17 18:57:26 UTC 2020
While chasing down an issue on Mac with application events, we have noticed
that there is some code under a private package that apparently it is
supposed to be used by developers, which of course it is discouraged:
com.sun.glass.ui.Application:EventHandler  is a public static inner
class under a private package, that is added to the Application class for
So far, only QuantumToolkit does subclass it  (just for Quit action and
Theme changed events). However the EventHandler class has more methods for
listening to MacOS/iOS application events.
While most of those events happen before the app starts (and it wouldn't
make sense to try to listen to them app-wise), in particular, the
OpenFilesAction event is forwarded  when a second EventHandler is set.
Other events like resign/become active actions can be listened to as well.
A developer could provide a subclass of such EventHandler if it were public
API, but so far, that has to be done accessing private API.
At this point, and following on this other thread  that discussed a
similar issue with EventHandlerManager, we should start considering the
design of new public API that could provide developers with access to such
events, with considerations to possible platform specifics.
More information about the openjfx-dev