sdl12-compat: macos: Don't override -[NSApplication terminate], use the delegate instead. (f3ddb)

From f3ddb3d477b6c3c401999db9f35f3e9064a257d3 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sat, 11 Dec 2021 13:12:22 -0500
Subject: [PATCH] macos: Don't override -[NSApplication terminate], use the
 delegate instead.

Reference issue #106.
---
 src/SDLmain/macosx/SDLMain.m | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/SDLmain/macosx/SDLMain.m b/src/SDLmain/macosx/SDLMain.m
index 07d392e..2b46632 100644
--- a/src/SDLmain/macosx/SDLMain.m
+++ b/src/SDLmain/macosx/SDLMain.m
@@ -64,22 +64,17 @@ - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
 @end
 #endif
 
-@interface NSApplication (SDLApplication)
-@end
+/* The main class of the application, the application's delegate */
+@implementation SDLMain
 
-@implementation NSApplication (SDLApplication)
-/* Invoked from the Quit menu item */
-- (void)terminate:(id)sender
+- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender
 {
     /* Post a SDL_QUIT event */
     SDL_Event event;
     event.type = SDL_QUIT;
     SDL_PushEvent(&event);
+    return NSTerminateCancel;
 }
-@end
-
-/* The main class of the application, the application's delegate */
-@implementation SDLMain
 
 /* Set the working directory to the .app's parent directory */
 - (void) setupWorkingDirectory:(BOOL)shouldChdir