diff options
Diffstat (limited to 'backends/platform/sdl/macosx')
-rw-r--r-- | backends/platform/sdl/macosx/appmenu_osx.mm | 25 | ||||
-rw-r--r-- | backends/platform/sdl/macosx/macosx.cpp | 7 | ||||
-rw-r--r-- | backends/platform/sdl/macosx/macosx.h | 5 |
3 files changed, 29 insertions, 8 deletions
diff --git a/backends/platform/sdl/macosx/appmenu_osx.mm b/backends/platform/sdl/macosx/appmenu_osx.mm index d083fb8483..feea40bc06 100644 --- a/backends/platform/sdl/macosx/appmenu_osx.mm +++ b/backends/platform/sdl/macosx/appmenu_osx.mm @@ -28,12 +28,22 @@ #include <Cocoa/Cocoa.h> -// Apple removed setAppleMenu from the header files in 10.4, -// but as the method still exists we declare it ourselves here. +// Apple added setAppleMenu in 10.5 and removed it in 10.6. +// But as the method still exists we declare it ourselves here. // Yes, this works :) @interface NSApplication(MissingFunction) - (void)setAppleMenu:(NSMenu *)menu; @end +// However maybe we should conditionally use it depending on the system on which we run ScummVM (and not +// the one on which we compile) to only do it on OS X 10.5. +// Here is the relevant bit from the release notes for 10.6: +// In Leopard and earlier, apps that tried to construct a menu bar without a nib would get an undesirable +// stubby application menu that could not be removed. To work around this problem on Leopard, you can call +// the undocumented setAppleMenu: method and pass it the application menu, like so: +// [NSApp setAppleMenu:[[[NSApp mainMenu] itemAtIndex:0] submenu]]; +// In SnowLeopard, this workaround is unnecessary and should not be used. Under SnowLeopard, the first menu +// is always identified as the application menu. + NSString *constructNSStringFromCString(const char *rawCString, CFStringEncoding stringEncoding) { return (NSString *)CFStringCreateWithCString(NULL, rawCString, stringEncoding); @@ -46,13 +56,14 @@ void replaceApplicationMenuItems() { NSMenu *windowMenu; NSMenuItem *menuItem; - // For some reason [[NSApp mainMenu] removeAllItems] doesn't work and crashes, so we need - // to remove the SDL generated menus one by one - [[NSApp mainMenu] removeItemAtIndex:0]; // Remove application menu - [[NSApp mainMenu] removeItemAtIndex:0]; // Remove "Windows" menu + // We cannot use [[NSApp mainMenu] removeAllItems] as removeAllItems was added in OS X 10.6 + // So remove the SDL generated menus one by one instead. + while ([[NSApp mainMenu] numberOfItems] > 0) { + [[NSApp mainMenu] removeItemAtIndex:0]; + } // Create new application menu - appleMenu = [[NSMenu alloc] initWithTitle:@""]; + appleMenu = [[NSMenu alloc] initWithTitle:@"ScummVM"]; NSString *nsString = NULL; diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp index 38a2d7441c..7652c0d833 100644 --- a/backends/platform/sdl/macosx/macosx.cpp +++ b/backends/platform/sdl/macosx/macosx.cpp @@ -27,9 +27,10 @@ #ifdef MACOSX -#include "backends/platform/sdl/macosx/macosx.h" +#include "backends/audiocd/macosx/macosx-audiocd.h" #include "backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h" #include "backends/platform/sdl/macosx/appmenu_osx.h" +#include "backends/platform/sdl/macosx/macosx.h" #include "backends/updates/macosx/macosx-updates.h" #include "backends/taskbar/macosx/macosx-taskbar.h" @@ -170,4 +171,8 @@ Common::String OSystem_MacOSX::getSystemLanguage() const { #endif // USE_DETECTLANG } +AudioCDManager *OSystem_MacOSX::createAudioCDManager() { + return createMacOSXAudioCDManager(); +} + #endif diff --git a/backends/platform/sdl/macosx/macosx.h b/backends/platform/sdl/macosx/macosx.h index c8b4beaeec..6905284a5f 100644 --- a/backends/platform/sdl/macosx/macosx.h +++ b/backends/platform/sdl/macosx/macosx.h @@ -38,6 +38,11 @@ public: virtual void init(); virtual void initBackend(); virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); + +protected: + // Override createAudioCDManager() to get our Mac-specific + // version. + virtual AudioCDManager *createAudioCDManager(); }; #endif |