From 62d2db341ce7b8b109d5f284adac8e19d0a6965e Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 13 May 2022 16:06:40 +0800 Subject: [PATCH] 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 34864f94087..9f4825ac140 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)) -- 2.39.2