diff options
| author | Alan Third | 2020-12-29 20:29:00 +0000 |
|---|---|---|
| committer | Alan Third | 2020-12-29 21:13:29 +0000 |
| commit | 90bd3b3d69d40339127b4744c459cedb7eb962b0 (patch) | |
| tree | 32b6d6f1949648c24c3f856dcb34f4ccb99262bd /src | |
| parent | a88f63500e475f842e5fbdd9abba4ce122cdb082 (diff) | |
| download | emacs-90bd3b3d69d40339127b4744c459cedb7eb962b0.tar.gz emacs-90bd3b3d69d40339127b4744c459cedb7eb962b0.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsmenu.m | 18 |
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) | |||
| 539 | { | 539 | { |
| 540 | widget_value *first_wv = (widget_value *)wvptr; | 540 | widget_value *first_wv = (widget_value *)wvptr; |
| 541 | NSFont *menuFont = [NSFont menuFontOfSize:0]; | 541 | NSFont *menuFont = [NSFont menuFontOfSize:0]; |
| 542 | NSDictionary *attributes = nil; | ||
| 543 | |||
| 544 | #ifdef NS_IMPL_COCOA | ||
| 545 | /* Cocoa doesn't allow multi-key chording in its menu display, so | ||
| 546 | work around it by using tabs to split the title into two | ||
| 547 | columns. */ | ||
| 542 | NSDictionary *font_attribs = @{NSFontAttributeName: menuFont}; | 548 | NSDictionary *font_attribs = @{NSFontAttributeName: menuFont}; |
| 543 | CGFloat maxNameWidth = 0; | 549 | CGFloat maxNameWidth = 0; |
| 544 | CGFloat maxKeyWidth = 0; | 550 | CGFloat maxKeyWidth = 0; |
| @@ -564,12 +570,14 @@ skipspc (const char *s) | |||
| 564 | /* Set a right-aligned tab stop at the maximum width, so that the | 570 | /* Set a right-aligned tab stop at the maximum width, so that the |
| 565 | key will appear immediately to the left of it. */ | 571 | key will appear immediately to the left of it. */ |
| 566 | NSTextTab *tab = | 572 | NSTextTab *tab = |
| 567 | [[NSTextTab alloc] initWithTextAlignment: NSTextAlignmentRight | 573 | [[[NSTextTab alloc] initWithTextAlignment: NSTextAlignmentRight |
| 568 | location: maxWidth | 574 | location: maxWidth |
| 569 | options: @{}]; | 575 | options: @{}] autorelease]; |
| 570 | NSMutableParagraphStyle *pstyle = [[NSMutableParagraphStyle alloc] init]; | 576 | NSMutableParagraphStyle *pstyle = [[[NSMutableParagraphStyle alloc] init] |
| 577 | autorelease]; | ||
| 571 | [pstyle setTabStops: @[tab]]; | 578 | [pstyle setTabStops: @[tab]]; |
| 572 | NSDictionary *attributes = @{NSParagraphStyleAttributeName: pstyle}; | 579 | attributes = @{NSParagraphStyleAttributeName: pstyle}; |
| 580 | #endif | ||
| 573 | 581 | ||
| 574 | /* clear existing contents */ | 582 | /* clear existing contents */ |
| 575 | [self removeAllItems]; | 583 | [self removeAllItems]; |