From bf389e3914c1b1a8f1ad32a32e0679aa08d61649 Mon Sep 17 00:00:00 2001 From: ALMAS <9382335+almas1992@users.noreply.github.com> Date: Mon, 8 Jan 2024 05:08:04 +0800 Subject: [PATCH] [v2/Mac] Handle application terminate (#3157) * [v2/Mac] Handle application terminate * add change log --------- Co-authored-by: Lea Anthony --- v2/internal/frontend/desktop/darwin/AppDelegate.m | 6 ++++++ website/src/pages/changelog.mdx | 1 + 2 files changed, 7 insertions(+) diff --git a/v2/internal/frontend/desktop/darwin/AppDelegate.m b/v2/internal/frontend/desktop/darwin/AppDelegate.m index 18ecfbcff..318c333d8 100644 --- a/v2/internal/frontend/desktop/darwin/AppDelegate.m +++ b/v2/internal/frontend/desktop/darwin/AppDelegate.m @@ -9,6 +9,7 @@ #import #import "AppDelegate.h" +#import "message.h" @implementation AppDelegate -(BOOL)application:(NSApplication *)sender openFile:(NSString *)filename @@ -22,6 +23,11 @@ return NO; } +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { + processMessage("Q"); + return NSTerminateCancel; +} + - (void)applicationWillFinishLaunching:(NSNotification *)aNotification { [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; if (self.alwaysOnTop) { diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index 8f28a93c5..7f409ca27 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add Apple Silicon hardware detection to `wails doctor`. Changed by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/3129) - Remove quarantine attribute on macOS binaries. Changed by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/3118) - Added documentation for a common GStreamer error on Linux systems. Changed by [@mkwsnyder](https://github.com/mkwsnyder) in [PR](https://github.com/wailsapp/wails/pull/3134) +- Add dock icon right-click exit handling by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/3157) ### Fixed - Docs for IsZoomControlEnabled and ZoomFactor. Fixed by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/3137)