diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsfns.m | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/src/nsfns.m b/src/nsfns.m index a815ce656cb..00310c051ff 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -175,6 +175,7 @@ ns_directory_from_panel (NSSavePanel *panel) | |||
| 175 | #endif | 175 | #endif |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | #ifndef NS_IMPL_COCOA | ||
| 178 | static Lisp_Object | 179 | static Lisp_Object |
| 179 | interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old) | 180 | interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old) |
| 180 | /* -------------------------------------------------------------------------- | 181 | /* -------------------------------------------------------------------------- |
| @@ -223,7 +224,7 @@ interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old) | |||
| 223 | } | 224 | } |
| 224 | return old; | 225 | return old; |
| 225 | } | 226 | } |
| 226 | 227 | #endif | |
| 227 | 228 | ||
| 228 | 229 | ||
| 229 | /* ========================================================================== | 230 | /* ========================================================================== |
| @@ -2107,9 +2108,6 @@ DEFUN ("ns-list-services", Fns_list_services, Sns_list_services, 0, 0, 0, | |||
| 2107 | #else | 2108 | #else |
| 2108 | Lisp_Object ret = Qnil; | 2109 | Lisp_Object ret = Qnil; |
| 2109 | NSMenu *svcs; | 2110 | NSMenu *svcs; |
| 2110 | #ifdef NS_IMPL_COCOA | ||
| 2111 | id delegate; | ||
| 2112 | #endif | ||
| 2113 | 2111 | ||
| 2114 | check_window_system (NULL); | 2112 | check_window_system (NULL); |
| 2115 | svcs = [[NSMenu alloc] initWithTitle: @"Services"]; | 2113 | svcs = [[NSMenu alloc] initWithTitle: @"Services"]; |
| @@ -2117,33 +2115,7 @@ DEFUN ("ns-list-services", Fns_list_services, Sns_list_services, 0, 0, 0, | |||
| 2117 | [NSApp registerServicesMenuSendTypes: ns_send_types | 2115 | [NSApp registerServicesMenuSendTypes: ns_send_types |
| 2118 | returnTypes: ns_return_types]; | 2116 | returnTypes: ns_return_types]; |
| 2119 | 2117 | ||
| 2120 | /* On Tiger, services menu updating was made lazier (waits for user to | ||
| 2121 | actually click on the menu), so we have to force things along: */ | ||
| 2122 | #ifdef NS_IMPL_COCOA | ||
| 2123 | delegate = [svcs delegate]; | ||
| 2124 | if (delegate != nil) | ||
| 2125 | { | ||
| 2126 | if ([delegate respondsToSelector: @selector (menuNeedsUpdate:)]) | ||
| 2127 | [delegate menuNeedsUpdate: svcs]; | ||
| 2128 | if ([delegate respondsToSelector: | ||
| 2129 | @selector (menu:updateItem:atIndex:shouldCancel:)]) | ||
| 2130 | { | ||
| 2131 | int i, len = [delegate numberOfItemsInMenu: svcs]; | ||
| 2132 | for (i =0; i<len; i++) | ||
| 2133 | [svcs addItemWithTitle: @"" action: NULL keyEquivalent: @""]; | ||
| 2134 | for (i =0; i<len; i++) | ||
| 2135 | if (![delegate menu: svcs | ||
| 2136 | updateItem: (NSMenuItem *)[svcs itemAtIndex: i] | ||
| 2137 | atIndex: i shouldCancel: NO]) | ||
| 2138 | break; | ||
| 2139 | } | ||
| 2140 | } | ||
| 2141 | #endif | ||
| 2142 | |||
| 2143 | [svcs setAutoenablesItems: NO]; | 2118 | [svcs setAutoenablesItems: NO]; |
| 2144 | #ifdef NS_IMPL_COCOA | ||
| 2145 | [svcs update]; /* on macOS, converts from '/' structure */ | ||
| 2146 | #endif | ||
| 2147 | 2119 | ||
| 2148 | ret = interpret_services_menu (svcs, Qnil, ret); | 2120 | ret = interpret_services_menu (svcs, Qnil, ret); |
| 2149 | return ret; | 2121 | return ret; |