summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Third <alan@idiocy.org>2020-12-29 20:29:00 +0000
committerAlan Third <alan@idiocy.org>2020-12-29 21:13:29 +0000
commit90bd3b3d69d40339127b4744c459cedb7eb962b0 (patch)
tree32b6d6f1949648c24c3f856dcb34f4ccb99262bd
parenta88f63500e475f842e5fbdd9abba4ce122cdb082 (diff)
downloademacs-90bd3b3d69d40339127b4744c459cedb7eb962b0.tar.gz
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.
-rw-r--r--src/nsmenu.m18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/nsmenu.m b/src/nsmenu.m
index d5321dcdc6d..ac36150915a 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];