diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h index 7e0d6b5ef..5b38a1174 100644 --- a/hw/xquartz/X11Controller.h +++ b/hw/xquartz/X11Controller.h @@ -67,8 +67,13 @@ IBOutlet NSTextField *sync_text2; IBOutlet NSPopUpButton *depth; - IBOutlet NSMenuItem *x11_about_item; IBOutlet NSMenuItem *window_separator; + // window_separator is DEPRECATED due to this radar: + // NSApplication releases the separator in the Windows menu even though it's an IBOutlet + // It is kept around for localization compatability and is subject to removal "eventually" + // If it is !NULL (meaning it is in the nib), it is removed from the menu and released + + IBOutlet NSMenuItem *x11_about_item; IBOutlet NSMenuItem *dock_window_separator; IBOutlet NSMenuItem *apps_separator; IBOutlet NSMenuItem *toggle_fullscreen_item; @@ -83,6 +88,9 @@ NSMutableArray *table_apps; IBOutlet NSMenu *dock_menu; + + // This is where in the Windows menu we'll start (this will be the index of the separator) + NSInteger windows_menu_start; int checked_window_item; x_list *pending_apps; diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index 4e08c1323..4d46911b5 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -103,7 +103,14 @@ BOOL xquartz_resetenv_display = NO; selector: @selector(apps_table_done:) name: NSWindowWillCloseNotification object: [apps_table window]]; + + // Setup data about our Windows menu + if(window_separator) { + [[window_separator menu] removeItem:window_separator]; + window_separator = nil; + } + windows_menu_start = [[X11App windowsMenu] numberOfItems]; } - (void) item_selected:sender @@ -117,17 +124,15 @@ BOOL xquartz_resetenv_display = NO; - (void) remove_window_menu { NSMenu *menu; - int first, count, i; - + int count, i; + /* Work backwards so we don't mess up the indices */ - menu = [window_separator menu]; - first = [menu indexOfItem:window_separator] + 1; + menu = [X11App windowsMenu]; count = [menu numberOfItems]; - for (i = count - 1; i >= first; i--) + for (i = count - 1; i >= windows_menu_start; i--) [menu removeItemAtIndex:i]; - menu = [dock_window_separator menu]; - count = [menu indexOfItem:dock_window_separator]; + count = [dock_menu indexOfItem:dock_window_separator]; for (i = 0; i < count; i++) [dock_menu removeItemAtIndex:0]; } @@ -138,9 +143,15 @@ BOOL xquartz_resetenv_display = NO; NSMenuItem *item; int first, count, i; - menu = [window_separator menu]; - first = [menu indexOfItem:window_separator] + 1; + menu = [X11App windowsMenu]; + first = windows_menu_start + 1; count = [list count]; + + // Push a Separator + if(count) { + [menu addItem:[NSMenuItem separatorItem]]; + } + for (i = 0; i < count; i++) { NSString *name, *shortcut; @@ -285,8 +296,8 @@ BOOL xquartz_resetenv_display = NO; int first, count; int n = [nn intValue]; - menu = [window_separator menu]; - first = [menu indexOfItem:window_separator] + 1; + menu = [X11App windowsMenu]; + first = windows_menu_start + 1; count = [menu numberOfItems] - first; if (checked_window_item >= 0 && checked_window_item < count) @@ -729,9 +740,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row if (item == toggle_fullscreen_item) return !quartzEnableRootless; - else if (item == copy_menu_item) // For some reason, this isn't working... - return NO; - else if (menu == [window_separator menu] || menu == dock_menu + else if (menu == [X11App windowsMenu] || menu == dock_menu || (menu == [x11_about_item menu] && [item tag] == 42)) return (AppleWMSelectedEvents () & AppleWMControllerNotifyMask) != 0; else diff --git a/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib index 38b00183c..94d01047c 100644 --- a/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib +++ b/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib @@ -2,9 +2,9 @@ 1050 - 9J61 + 9L29 677 - 949.46 + 949.54 353.00 YES @@ -341,17 +341,6 @@ - - - YES - YES - - - 1048576 - 2147483647 - - - _NSWindowsMenu @@ -1953,14 +1942,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 549 - - - window_separator - - - - 300331 - menu @@ -2209,7 +2190,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 - @@ -3013,11 +2993,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 - - 300330 - - - 300337 @@ -3401,8 +3376,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 298.ImportedFromIB2 300295.IBPluginDependency 300295.IBShouldRemoveOnLegacySave - 300330.IBPluginDependency - 300330.ImportedFromIB2 300337.IBPluginDependency 300337.ImportedFromIB2 300338.IBPluginDependency @@ -3638,7 +3611,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 com.apple.InterfaceBuilder.CocoaPlugin - {{349, 858}, {315, 153}} + {{349, 868}, {315, 143}} com.apple.InterfaceBuilder.CocoaPlugin {{271, 666}, {301, 153}} @@ -3699,8 +3672,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin diff --git a/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib index 516508961..fee8f1ce9 100644 Binary files a/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib and b/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib differ