diff options
author | Po Lu <luangruo@yahoo.com> | 2022-05-03 16:12:24 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-05-03 16:12:24 +0800 |
commit | 5adc84a27b86cdbd048ee3ebc023549c928f7425 (patch) | |
tree | 015ccc6867481bf3f82ac00d48f193c1a2ad2d85 | |
parent | f9dea5b4c5ba8e8a24cba3dc3d66a1f8a2a2b21f (diff) | |
download | emacs-5adc84a27b86cdbd048ee3ebc023549c928f7425.tar.gz |
Make menu bar help text work on macOS as well
* lisp/tooltip.el (tooltip-show-help): Resort to displaying
messages in the echo area on NS.
* src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Call
`show_help_echo' instead of storing an event into the keyboard
buffer.
-rw-r--r-- | lisp/tooltip.el | 6 | ||||
-rw-r--r-- | src/nsmenu.m | 13 |
2 files changed, 8 insertions, 11 deletions
diff --git a/lisp/tooltip.el b/lisp/tooltip.el index 0ee3c38e26d..d6b6b1bc9b0 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el @@ -377,7 +377,11 @@ It is also called if Tooltip mode is on, for text-only displays." (defun tooltip-show-help (msg) "Function installed as `show-help-function'. MSG is either a help string to display, or nil to cancel the display." - (if (and (display-graphic-p)) + (if (and (display-graphic-p) + ;; Tooltips can't be displayed on top of the global menu + ;; bar on NS. + (or (not (eq window-system 'ns)) + (menu-or-popup-active-p))) (let ((previous-help tooltip-help-message)) (setq tooltip-help-message msg) (cond ((null msg) diff --git a/src/nsmenu.m b/src/nsmenu.m index 0f7d1fb98f6..b0ab12bb87d 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -760,12 +760,6 @@ 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]; @@ -779,12 +773,11 @@ prettify_key (const char *key) XSETFRAME (frame, f); help = AREF (vec, idx + MENU_ITEMS_ITEM_HELP); + popup_activated_flag++; if (STRINGP (help) || NILP (help)) - kbd_buffer_store_help_event (frame, help); - - raise (SIGIO); + show_help_echo (help, Qnil, Qnil, Qnil); + popup_activated_flag--; } -#endif #ifdef NS_IMPL_GNUSTEP - (void) close |