Handle close request event for main window

When receiving close request event, main window should quit program
if there is no system tray available, and just like the close button
was clicked. The window close request event happens when user close
window by pressing alt-f4 (Gnome) or when receiving WM_DELETE_WINDOW
xwindow event. Current behavior is just close the window and let the
program keep running, and there is no way to quit program without
system tray.
This commit is contained in:
En-Jan Chou
2020-01-14 16:39:00 -05:00
parent eb047e29a0
commit b6a4f70ec9

View File

@@ -57,6 +57,9 @@ public class MainWindowTitleController implements FxController {
window.setX(event.getScreenX() - xOffset);
window.setY(event.getScreenY() - yOffset);
});
window.setOnCloseRequest(event -> {
close();
});
}
@FXML