emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 90bd3b3: Don't calculate macOS menu data for GNUstep (bug#45502)


From: Alan Third
Subject: master 90bd3b3: Don't calculate macOS menu data for GNUstep (bug#45502)
Date: Tue, 29 Dec 2020 16:15:46 -0500 (EST)

branch: master
commit 90bd3b3d69d40339127b4744c459cedb7eb962b0
Author: Alan Third <alan@idiocy.org>
Commit: Alan Third <alan@idiocy.org>

    Don't calculate macOS menu data for GNUstep (bug#45502)
    
    * src/nsmenu.m ([EmacsMenu fillWithWidgetValue:]): #ifdef out code
    that has no effect on GNUstep and autorelease alloc'd objects.
---
 src/nsmenu.m | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/nsmenu.m b/src/nsmenu.m
index d5321dc..ac36150 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -539,6 +539,12 @@ skipspc (const char *s)
 {
   widget_value *first_wv = (widget_value *)wvptr;
   NSFont *menuFont = [NSFont menuFontOfSize:0];
+  NSDictionary *attributes = nil;
+
+#ifdef NS_IMPL_COCOA
+  /* Cocoa doesn't allow multi-key chording in its menu display, so
+     work around it by using tabs to split the title into two
+     columns.  */
   NSDictionary *font_attribs = @{NSFontAttributeName: menuFont};
   CGFloat maxNameWidth = 0;
   CGFloat maxKeyWidth = 0;
@@ -564,12 +570,14 @@ skipspc (const char *s)
   /* Set a right-aligned tab stop at the maximum width, so that the
      key will appear immediately to the left of it. */
   NSTextTab *tab =
-    [[NSTextTab alloc] initWithTextAlignment: NSTextAlignmentRight
-                                    location: maxWidth
-                                     options: @{}];
-  NSMutableParagraphStyle *pstyle = [[NSMutableParagraphStyle alloc] init];
+    [[[NSTextTab alloc] initWithTextAlignment: NSTextAlignmentRight
+                                     location: maxWidth
+                                      options: @{}] autorelease];
+  NSMutableParagraphStyle *pstyle = [[[NSMutableParagraphStyle alloc] init]
+                                      autorelease];
   [pstyle setTabStops: @[tab]];
-  NSDictionary *attributes = @{NSParagraphStyleAttributeName: pstyle};
+  attributes = @{NSParagraphStyleAttributeName: pstyle};
+#endif
 
   /* clear existing contents */
   [self removeAllItems];



reply via email to

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