In one project, we have to handle the quit-logic for MacOS ourselves,
when the <quit app> menu entry is used.
As background information - this menu entry is set in the class com.sun.glass.ui.mac.MacApplication.
It's basically hard coded. Currently, in this project, the menu entry doesn't work in some cases.
My Solution would be:
Provide a method "Platform.setQuiteHandler(Supplier<Boolean>)"
This handler is called when quit <appname> from the menu is called.
If the handler returns true, all windows are closed. Otherwise, nothing happens.
It would look like the following:
```
/**
* Sets the handler to be called when the application is about to quit.
* Currently, this can only happen on MacOS.
*
* This handler is called, when the user selects
* the "Quit <appname>" from the application menu.
* When the provided handler returns true,
* the application will close all windows.
* If the handler returns false, the application will not quit.
*
* @param The new quit handler.
*/
public static void setQuitHandler(Supplier x) {
...
}
```
I've got a working version for this change.
Is this something, which is wanted for JavaFX?
Should I create a pullrequest for this?
Florian Kirmaier
when the <quit app> menu entry is used.
As background information - this menu entry is set in the class com.sun.glass.ui.mac.MacApplication.
It's basically hard coded. Currently, in this project, the menu entry doesn't work in some cases.
My Solution would be:
Provide a method "Platform.setQuiteHandler(Supplier<Boolean>)"
This handler is called when quit <appname> from the menu is called.
If the handler returns true, all windows are closed. Otherwise, nothing happens.
It would look like the following:
```
/**
* Sets the handler to be called when the application is about to quit.
* Currently, this can only happen on MacOS.
*
* This handler is called, when the user selects
* the "Quit <appname>" from the application menu.
* When the provided handler returns true,
* the application will close all windows.
* If the handler returns false, the application will not quit.
*
* @param The new quit handler.
*/
public static void setQuitHandler(Supplier x) {
...
}
```
I've got a working version for this change.
Is this something, which is wanted for JavaFX?
Should I create a pullrequest for this?
Florian Kirmaier