From 5ed984223918b427716c469d7c37d3e9513c7f1b Mon Sep 17 00:00:00 2001
From: barracuda156 <vital.had@gmail.com>
Date: Thu, 16 May 2024 18:21:00 +0800
Subject: [PATCH] Compatibility for < 10.6

macOS 10.5 does not have NSApplicationDelegate.
macOS 10.4 does not have NSUInteger.

---
 lib/unicorn/UnicornApplicationDelegate.mm | 6 +++++-
 lib/unicorn/UnicornApplication_mac.mm     | 4 ++++
 lib/unicorn/notify/Notify.mm              | 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git lib/unicorn/UnicornApplicationDelegate.mm lib/unicorn/UnicornApplicationDelegate.mm
index 76379d94..39729122 100644
--- lib/unicorn/UnicornApplicationDelegate.mm
+++ lib/unicorn/UnicornApplicationDelegate.mm
@@ -29,6 +29,10 @@
 #import <AppKit/NSView.h>
 #import <Carbon/Carbon.h>
 
+#ifndef NSUInteger
+typedef unsigned long NSUInteger;
+#endif
+
 // Declare this here ourselves so we can compile on OSX 10.6
 // and ProcessTransformToUIElementApplication just won't work
 enum {
@@ -37,7 +41,7 @@ enum {
   ProcessTransformToUIElementApplication = 4 /* functional in Mac OS X Barolo and later */
 };
 
-@interface LFMAppDelegate : NSObject <NSApplicationDelegate> {
+@interface LFMAppDelegate : NSObject {
     unicorn::UnicornApplicationDelegate* m_observer;
     BOOL m_show;
 }
diff --git lib/unicorn/UnicornApplication_mac.mm lib/unicorn/UnicornApplication_mac.mm
index e0a04672..f6573ec1 100644
--- lib/unicorn/UnicornApplication_mac.mm
+++ lib/unicorn/UnicornApplication_mac.mm
@@ -23,6 +23,10 @@
 #import <Foundation/NSAppleEventManager.h>
 #import <Foundation/NSObject.h>
 
+#ifndef NSUInteger
+typedef unsigned long NSUInteger;
+#endif
+
 void 
 unicorn::Application::setOpenApplicationEventHandler()
 {
diff --git lib/unicorn/notify/Notify.mm lib/unicorn/notify/Notify.mm
index 81f4f134..66731966 100644
--- lib/unicorn/notify/Notify.mm
+++ lib/unicorn/notify/Notify.mm
@@ -30,6 +30,9 @@
 
 #include "Notify.h"
 
+#ifndef NSUInteger
+typedef unsigned long NSUInteger;
+#endif
 
 #ifdef LASTFM_USER_NOTIFICATIONS
 @interface MacClickDelegate : NSObject <NSUserNotificationCenterDelegate> {
