emacs-devel
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]