From 4fb6f92ad4dbca11948cd744c021d0bd5ca032bf Mon Sep 17 00:00:00 2001 From: John Maguire Date: Fri, 4 Feb 2011 15:25:05 +0000 Subject: [PATCH] Fix compile warning on mac. --- src/core/mac_delegate.h | 22 ++++++++++++++++++++++ src/core/mac_startup.mm | 17 +---------------- src/ui/macsystemtrayicon.mm | 3 ++- 3 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 src/core/mac_delegate.h diff --git a/src/core/mac_delegate.h b/src/core/mac_delegate.h new file mode 100644 index 000000000..c98a9c6d4 --- /dev/null +++ b/src/core/mac_delegate.h @@ -0,0 +1,22 @@ +#import + +#include "config.h" + +class PlatformInterface; + +#ifdef SNOW_LEOPARD +@interface AppDelegate :NSObject { +#else +@interface AppDelegate :NSObject { +#endif + PlatformInterface* application_handler_; + NSMenu* dock_menu_; +} + +- (id) initWithHandler: (PlatformInterface*)handler; +// NSApplicationDelegate +- (BOOL) applicationShouldHandleReopen: (NSApplication*)app hasVisibleWindows:(BOOL)flag; +- (NSMenu*) applicationDockMenu: (NSApplication*)sender; +- (void) setDockMenu: (NSMenu*)menu; +@end + diff --git a/src/core/mac_startup.mm b/src/core/mac_startup.mm index 1dd2f6368..933b7397b 100644 --- a/src/core/mac_startup.mm +++ b/src/core/mac_startup.mm @@ -34,6 +34,7 @@ #include "config.h" #include "globalshortcuts.h" +#include "mac_delegate.h" #include "mac_startup.h" #include "macglobalshortcutbackend.h" #include "utilities.h" @@ -66,22 +67,6 @@ - (void) mediaKeyEvent: (int)key state: (BOOL)state repeat: (BOOL)repeat; @end -#ifdef SNOW_LEOPARD -@interface AppDelegate :NSObject { -#else -@interface AppDelegate :NSObject { -#endif - PlatformInterface* application_handler_; - NSMenu* dock_menu_; -} - -- (id) initWithHandler: (PlatformInterface*)handler; -// NSApplicationDelegate -- (BOOL) applicationShouldHandleReopen: (NSApplication*)app hasVisibleWindows:(BOOL)flag; -- (NSMenu*) applicationDockMenu: (NSApplication*)sender; -- (void) setDockMenu: (NSMenu*)menu; -@end - @implementation AppDelegate - (id) init { diff --git a/src/ui/macsystemtrayicon.mm b/src/ui/macsystemtrayicon.mm index dfc840080..3142c14ea 100644 --- a/src/ui/macsystemtrayicon.mm +++ b/src/ui/macsystemtrayicon.mm @@ -17,6 +17,7 @@ #include "macsystemtrayicon.h" +#include "core/mac_delegate.h" #include "core/song.h" #include @@ -83,7 +84,7 @@ class MacSystemTrayIconPrivate : boost::noncopyable { // Don't look now. // This must be called after our custom NSApplicationDelegate has been set. - [[NSApp delegate] setDockMenu:dock_menu_]; + [(AppDelegate*)([NSApp delegate]) setDockMenu:dock_menu_]; ClearNowPlaying(); }