diff options
| author | Po Lu | 2022-01-22 21:51:46 +0800 |
|---|---|---|
| committer | Po Lu | 2022-01-22 21:51:46 +0800 |
| commit | 7e596463bedafbb33461aa83075bc6a8a97f8faa (patch) | |
| tree | e3c59296b8c39cba100010ea386dc8cdaddee82d /src/nsmenu.m | |
| parent | 15090d7c6fa54cc6598fa02b43404181be826e0b (diff) | |
| download | emacs-7e596463bedafbb33461aa83075bc6a8a97f8faa.tar.gz emacs-7e596463bedafbb33461aa83075bc6a8a97f8faa.zip | |
Add some menu bar help code on GNUstep
* src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Implement
help event generation for GNUstep.
Diffstat (limited to 'src/nsmenu.m')
| -rw-r--r-- | src/nsmenu.m | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/nsmenu.m b/src/nsmenu.m index cad0ff6fe17..5df391bcbe1 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -759,6 +759,32 @@ prettify_key (const char *key) | |||
| 759 | } | 759 | } |
| 760 | 760 | ||
| 761 | #ifdef NS_IMPL_GNUSTEP | 761 | #ifdef NS_IMPL_GNUSTEP |
| 762 | /* The code below doesn't work on Mac OS X, because it runs a nested | ||
| 763 | Carbon-related event loop to track menu bar movement. | ||
| 764 | |||
| 765 | But it works fine aside from that, so it will work on GNUstep if | ||
| 766 | they start to call `willHighlightItem'. */ | ||
| 767 | - (void) menu: (NSMenu *) menu willHighlightItem: (NSMenuItem *) item | ||
| 768 | { | ||
| 769 | NSInteger idx = [item tag]; | ||
| 770 | struct frame *f = SELECTED_FRAME (); | ||
| 771 | Lisp_Object vec = f->menu_bar_vector; | ||
| 772 | Lisp_Object help, frame; | ||
| 773 | |||
| 774 | if (idx >= ASIZE (vec)) | ||
| 775 | return; | ||
| 776 | |||
| 777 | XSETFRAME (frame, f); | ||
| 778 | help = AREF (vec, idx + MENU_ITEMS_ITEM_HELP); | ||
| 779 | |||
| 780 | if (STRINGP (help) || NILP (help)) | ||
| 781 | kbd_buffer_store_help_event (frame, help); | ||
| 782 | |||
| 783 | raise (SIGIO); | ||
| 784 | } | ||
| 785 | #endif | ||
| 786 | |||
| 787 | #ifdef NS_IMPL_GNUSTEP | ||
| 762 | - (void) close | 788 | - (void) close |
| 763 | { | 789 | { |
| 764 | /* Close all the submenus. This has the unfortunate side-effect of | 790 | /* Close all the submenus. This has the unfortunate side-effect of |
| @@ -809,10 +835,6 @@ prettify_key (const char *key) | |||
| 809 | { | 835 | { |
| 810 | return NSZeroRect; | 836 | return NSZeroRect; |
| 811 | } | 837 | } |
| 812 | |||
| 813 | - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item | ||
| 814 | { | ||
| 815 | } | ||
| 816 | #endif | 838 | #endif |
| 817 | 839 | ||
| 818 | @end /* EmacsMenu */ | 840 | @end /* EmacsMenu */ |