# HG changeset patch # User reimar # Date 1347481569 0 # Node ID c40203dd82b7893d27a706078f70b6cc8b80f82c # Parent 3fb18ad990038ee01a408441b18c8a8b2db75f56 Fix menu on newer OSX versions (at least 10.6) without breaking 10.5. diff -r 3fb18ad99003 -r c40203dd82b7 libvo/vo_corevideo.m --- a/libvo/vo_corevideo.m Tue Sep 11 21:31:21 2012 +0000 +++ b/libvo/vo_corevideo.m Wed Sep 12 20:26:09 2012 +0000 @@ -575,10 +575,20 @@ */ - (void)initMenu { + NSMenu *mainMenu = [[NSMenu alloc] init]; NSMenu *menu, *aspectMenu; NSMenuItem *menuItem; - [NSApp setMainMenu:[[NSMenu alloc] init]]; + menu = [[NSMenu alloc] init]; + menuItem = [[NSMenuItem alloc] init]; + [menuItem setSubmenu:menu]; + [mainMenu addItem:menuItem]; + // Note: setAppleMenu seems to be unnecessary from 10.6 on, + // but is needed for all earlier versions or the menu is + // messed up. + // Round-about way with performSelector used to avoid compiler + // warnings. + [NSApp performSelector:@selector(setAppleMenu:) withObject:menu]; //Create Movie Menu menu = [[NSMenu alloc] initWithTitle:@"Movie"]; @@ -614,7 +624,7 @@ //Add to menubar menuItem = [[NSMenuItem alloc] initWithTitle:@"Movie" action:nil keyEquivalent:@""]; [menuItem setSubmenu:menu]; - [[NSApp mainMenu] addItem:menuItem]; + [mainMenu addItem:menuItem]; //Create Window Menu menu = [[NSMenu alloc] initWithTitle:@"Window"]; @@ -625,8 +635,9 @@ //Add to menubar menuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; [menuItem setSubmenu:menu]; - [[NSApp mainMenu] addItem:menuItem]; + [mainMenu addItem:menuItem]; [NSApp setWindowsMenu:menu]; + [NSApp setMainMenu:mainMenu]; [menu release]; [menuItem release];