emacs-diffs
[Top][All Lists]
Advanced

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

master 62d2db341c 1/2: Display help-echo for popup menus on NS


From: Po Lu
Subject: master 62d2db341c 1/2: Display help-echo for popup menus on NS
Date: Fri, 13 May 2022 04:10:01 -0400 (EDT)

branch: master
commit 62d2db341ce7b8b109d5f284adac8e19d0a6965e
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Display help-echo for popup menus on NS
    
    * src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Display
    help echo for ordinary popup menus as well.
---
 src/nsmenu.m | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/src/nsmenu.m b/src/nsmenu.m
index 34864f9408..9f4825ac14 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -765,17 +765,33 @@ prettify_key (const char *key)
   NSInteger idx = [item tag];
   struct frame *f = SELECTED_FRAME ();
   Lisp_Object vec = f->menu_bar_vector;
-  Lisp_Object help, frame;
+  Lisp_Object help, frame, *client_data;
 
-  /* This isn't a menubar, ignore.  */
-  if (context_menu_value == -1)
-    return;
+  XSETFRAME (frame, f);
 
-  if (idx >= ASIZE (vec))
-    return;
+  /* This menu isn't a menubar, so use the pointer to the popup menu
+     data.  */
+  if (context_menu_value != 0)
+    {
+      client_data = (Lisp_Object *) idx;
 
-  XSETFRAME (frame, f);
-  help = AREF (vec, idx + MENU_ITEMS_ITEM_HELP);
+      if (client_data)
+       help = client_data[MENU_ITEMS_ITEM_HELP];
+      else
+       help = Qnil;
+    }
+  /* Just dismiss any help-echo that might already be in progress if
+     no menu item will be highlighted.  */
+  else if (item == nil)
+    help = Qnil;
+  else
+    {
+      if (idx >= ASIZE (vec))
+       return;
+
+      /* Otherwise, get the help data from the menu bar vector.  */
+      help = AREF (vec, idx + MENU_ITEMS_ITEM_HELP);
+    }
 
   popup_activated_flag++;
   if (STRINGP (help) || NILP (help))



reply via email to

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