From aa2b908b5907bb94e6186fe6a8f1099d16e61f03 Mon Sep 17 00:00:00 2001 From: "aman.kapoor" Date: Tue, 11 Jan 2022 00:21:57 +0530 Subject: [PATCH] Fix issue #33 QUIT_HANDLER check --- gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/kotlin/app/MainWindow.kt | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 69a9715..2e6e589 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/app/MainWindow.kt b/src/main/kotlin/app/MainWindow.kt index 36df3c7..28749ab 100644 --- a/src/main/kotlin/app/MainWindow.kt +++ b/src/main/kotlin/app/MainWindow.kt @@ -17,9 +17,12 @@ import java.awt.Desktop @Composable fun ApplicationScope.appWindow() { - Desktop.getDesktop().setQuitHandler { e, response -> - closeApp(e.source.toString()) - response.performQuit() + val desktop = Desktop.getDesktop() + if (desktop.isSupported(Desktop.Action.APP_QUIT_HANDLER)) { + desktop.setQuitHandler { e, response -> + closeApp(e.source.toString()) + response.performQuit() + } } val onCloseRequest = { closeApp("User Close")