diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2009-07-23 20:03:29 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2009-07-24 09:42:00 -0700 |
commit | 0d73893a5795d5c1d28fd0287f2f1965f2ff1bda (patch) | |
tree | b63d43e5a23a5e7721742c4689b231465fcfe6f4 | |
parent | 171409cecbd848e5fec6334fc61a20e882e80fa9 (diff) |
XQuartz: Change handling of Windows menu to workaround a bug triggered by mixing Sparkle and X11 windows
<rdar://problem/7088335> NSApplication releases the separator in the Windows menu even though it's an IBOutlet
(cherry picked from commit 27ac5135267be9cb221329ae68461117dd43a4bf)
-rw-r--r-- | hw/xquartz/X11Controller.h | 10 | ||||
-rw-r--r-- | hw/xquartz/X11Controller.m | 37 | ||||
-rw-r--r-- | hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib | 35 | ||||
-rw-r--r-- | hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib | bin | 41697 -> 41440 bytes |
4 files changed, 35 insertions, 47 deletions
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: + // <rdar://problem/7088335> 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 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9J61</string> + <string key="IBDocument.SystemVersion">9L29</string> <string key="IBDocument.InterfaceBuilderVersion">677</string> - <string key="IBDocument.AppKitVersion">949.46</string> + <string key="IBDocument.AppKitVersion">949.54</string> <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -341,17 +341,6 @@ <reference key="NSOnImage" ref="531645050"/> <reference key="NSMixedImage" ref="351811234"/> </object> - <object class="NSMenuItem" id="444952046"> - <reference key="NSMenu" ref="96874957"/> - <bool key="NSIsDisabled">YES</bool> - <bool key="NSIsSeparator">YES</bool> - <string key="NSTitle"/> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="531645050"/> - <reference key="NSMixedImage" ref="351811234"/> - </object> </object> <string key="NSName">_NSWindowsMenu</string> </object> @@ -1955,14 +1944,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">window_separator</string> - <reference key="source" ref="485884620"/> - <reference key="destination" ref="444952046"/> - </object> - <int key="connectionID">300331</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> <string key="label">menu</string> <reference key="source" ref="815810918"/> <reference key="destination" ref="524015605"/> @@ -2209,7 +2190,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference ref="1036389925"/> <reference ref="369641893"/> <reference ref="155085383"/> - <reference ref="444952046"/> <reference ref="984461797"/> <reference ref="280172320"/> </object> @@ -3014,11 +2994,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference key="parent" ref="492358940"/> </object> <object class="IBObjectRecord"> - <int key="objectID">300330</int> - <reference key="object" ref="444952046"/> - <reference key="parent" ref="96874957"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">300337</int> <reference key="object" ref="10973343"/> <object class="NSMutableArray" key="children"> @@ -3401,8 +3376,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>298.ImportedFromIB2</string> <string>300295.IBPluginDependency</string> <string>300295.IBShouldRemoveOnLegacySave</string> - <string>300330.IBPluginDependency</string> - <string>300330.ImportedFromIB2</string> <string>300337.IBPluginDependency</string> <string>300337.ImportedFromIB2</string> <string>300338.IBPluginDependency</string> @@ -3638,7 +3611,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{349, 858}, {315, 153}}</string> + <string>{{349, 868}, {315, 143}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>{{271, 666}, {301, 153}}</string> @@ -3699,8 +3672,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> diff --git a/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib Binary files differindex 516508961..fee8f1ce9 100644 --- a/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib |