emacs-diffs
[Top][All Lists]
Advanced

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

master 7e596463be: Add some menu bar help code on GNUstep


From: Po Lu
Subject: master 7e596463be: Add some menu bar help code on GNUstep
Date: Sat, 22 Jan 2022 08:53:10 -0500 (EST)

branch: master
commit 7e596463bedafbb33461aa83075bc6a8a97f8faa
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Add some menu bar help code on GNUstep
    
    * src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Implement
    help event generation for GNUstep.
---
 src/nsmenu.m | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/src/nsmenu.m b/src/nsmenu.m
index cad0ff6fe1..5df391bcbe 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -758,6 +758,32 @@ prettify_key (const char *key)
       : Qnil;
 }
 
+#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
 {
@@ -809,10 +835,6 @@ prettify_key (const char *key)
 {
   return NSZeroRect;
 }
-
-- (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item
-{
-}
 #endif
 
 @end  /* EmacsMenu */



reply via email to

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