summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-01-22 21:51:46 +0800
committerPo Lu <luangruo@yahoo.com>2022-01-22 21:51:46 +0800
commit7e596463bedafbb33461aa83075bc6a8a97f8faa (patch)
treee3c59296b8c39cba100010ea386dc8cdaddee82d /src
parent15090d7c6fa54cc6598fa02b43404181be826e0b (diff)
Add some menu bar help code on GNUstep
* src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Implement help event generation for GNUstep.
Diffstat (limited to 'src')
-rw-r--r--src/nsmenu.m30
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)
}
#ifdef NS_IMPL_GNUSTEP
+/* The code below doesn't work on Mac OS X, because it runs a nested
+ Carbon-related event loop to track menu bar movement.
+
+ But it works fine aside from that, so it will work on GNUstep if
+ they start to call `willHighlightItem'. */
+- (void) menu: (NSMenu *) menu willHighlightItem: (NSMenuItem *) item
+{
+ NSInteger idx = [item tag];
+ struct frame *f = SELECTED_FRAME ();
+ Lisp_Object vec = f->menu_bar_vector;
+ Lisp_Object help, frame;
+
+ if (idx >= ASIZE (vec))
+ return;
+
+ XSETFRAME (frame, f);
+ help = AREF (vec, idx + MENU_ITEMS_ITEM_HELP);
+
+ if (STRINGP (help) || NILP (help))
+ kbd_buffer_store_help_event (frame, help);
+
+ raise (SIGIO);
+}
+#endif
+
+#ifdef NS_IMPL_GNUSTEP
- (void) close
{
/* Close all the submenus. This has the unfortunate side-effect of
@@ -809,10 +835,6 @@ prettify_key (const char *key)
{
return NSZeroRect;
}
-
-- (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item
-{
-}
#endif
@end /* EmacsMenu */