[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/13] Clean up code around 'ns-list-services'
From: |
Philipp Stephani |
Subject: |
[PATCH 11/13] Clean up code around 'ns-list-services' |
Date: |
Sat, 20 May 2017 16:58:39 +0200 |
* src/nsfns.m (Fns_list_services): Remove unreachable code. In this
branch NS_IMPL_COCOA cannot be defined.
(interpret_services_menu): Define only if called to avoid compiler
warnings about unused static functions.
---
src/nsfns.m | 32 ++------------------------------
1 file changed, 2 insertions(+), 30 deletions(-)
diff --git a/src/nsfns.m b/src/nsfns.m
index cbe0ffb858..31b2f762e0 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -175,6 +175,7 @@ Updated by Christian Limpach (address@hidden)
#endif
}
+#ifndef NS_IMPL_COCOA
static Lisp_Object
interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old)
/* --------------------------------------------------------------------------
@@ -223,7 +224,7 @@ Turn the input menu (an NSMenu) into a lisp list for
tracking on lisp side
}
return old;
}
-
+#endif
/* ==========================================================================
@@ -2107,9 +2108,6 @@ and GNUstep implementations ("distributor-specific release
#else
Lisp_Object ret = Qnil;
NSMenu *svcs;
-#ifdef NS_IMPL_COCOA
- id delegate;
-#endif
check_window_system (NULL);
svcs = [[NSMenu alloc] initWithTitle: @"Services"];
@@ -2117,33 +2115,7 @@ and GNUstep implementations ("distributor-specific
release
[NSApp registerServicesMenuSendTypes: ns_send_types
returnTypes: ns_return_types];
-/* On Tiger, services menu updating was made lazier (waits for user to
- actually click on the menu), so we have to force things along: */
-#ifdef NS_IMPL_COCOA
- delegate = [svcs delegate];
- if (delegate != nil)
- {
- if ([delegate respondsToSelector: @selector (menuNeedsUpdate:)])
- [delegate menuNeedsUpdate: svcs];
- if ([delegate respondsToSelector:
- @selector (menu:updateItem:atIndex:shouldCancel:)])
- {
- int i, len = [delegate numberOfItemsInMenu: svcs];
- for (i =0; i<len; i++)
- [svcs addItemWithTitle: @"" action: NULL keyEquivalent: @""];
- for (i =0; i<len; i++)
- if (![delegate menu: svcs
- updateItem: (NSMenuItem *)[svcs itemAtIndex: i]
- atIndex: i shouldCancel: NO])
- break;
- }
- }
-#endif
-
[svcs setAutoenablesItems: NO];
-#ifdef NS_IMPL_COCOA
- [svcs update]; /* on macOS, converts from '/' structure */
-#endif
ret = interpret_services_menu (svcs, Qnil, ret);
return ret;
--
2.13.0
- [PATCH 01/13] Nextstep: Use instancetype explicit return type, Philipp Stephani, 2017/05/20
- [PATCH 02/13] Declare Nextstep unexec functions in lisp.h, Philipp Stephani, 2017/05/20
- [PATCH 05/13] Make a function static that isn't used outside this file, Philipp Stephani, 2017/05/20
- [PATCH 04/13] Use NSCharacterCollection instead of CTCharacterCollection, Philipp Stephani, 2017/05/20
- [PATCH 03/13] Remove unused function print_regions, Philipp Stephani, 2017/05/20
- [PATCH 07/13] Remove trailing semicolons in method definitions, Philipp Stephani, 2017/05/20
- [PATCH 09/13] Nextstep: Replace deprecated enumerators, Philipp Stephani, 2017/05/20
- [PATCH 08/13] Nextstep: remove some deprecated method calls, Philipp Stephani, 2017/05/20
- [PATCH 06/13] Remove calls to deprecated setUsesScreenFonts, Philipp Stephani, 2017/05/20
- [PATCH 10/13] Remove unused automatic variables, Philipp Stephani, 2017/05/20
- [PATCH 11/13] Clean up code around 'ns-list-services',
Philipp Stephani <=
- [PATCH 12/13] Fix call of registerServicesMenuSendTypes, Philipp Stephani, 2017/05/20
- [PATCH 13/13] Avoid uninitialized read, Philipp Stephani, 2017/05/20
- Re: [PATCH 01/13] Nextstep: Use instancetype explicit return type, Paul Eggert, 2017/05/20
- Re: [PATCH 01/13] Nextstep: Use instancetype explicit return type, Paul Eggert, 2017/05/21