emacs-diffs
[Top][All Lists]
Advanced

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

master 5adc84a27b: Make menu bar help text work on macOS as well


From: Po Lu
Subject: master 5adc84a27b: Make menu bar help text work on macOS as well
Date: Tue, 3 May 2022 04:12:47 -0400 (EDT)

branch: master
commit 5adc84a27b86cdbd048ee3ebc023549c928f7425
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 lisp/tooltip.el |  6 +++++-
 src/nsmenu.m    | 13 +++----------
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 0ee3c38e26..d6b6b1bc9b 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 0f7d1fb98f..b0ab12bb87 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



reply via email to

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