]> git.eshelyaron.com Git - emacs.git/commitdiff
Make system tooltips display in the menu bar on Haiku
authorPo Lu <luangruo@yahoo.com>
Thu, 20 Jan 2022 10:53:49 +0000 (10:53 +0000)
committerPo Lu <luangruo@yahoo.com>
Thu, 20 Jan 2022 10:55:52 +0000 (10:55 +0000)
* doc/emacs/haiku.texi (Haiku Basics): Update documentation.
* src/haiku_support.cc (Highlight): Apply the hack used for
regular menus to the menu bar as well.
* src/haikumenu.c (digest_menu_items): Set help text on menu bar
if `tooltip-mode' is t and system tooltips are used.
(syms_of_haikumenu): New symbol `tooltip-mode'.

doc/emacs/haiku.texi
src/haiku_support.cc
src/haikumenu.c

index 0d3ed8339e70afd4e9d024f0b3a8108ec2cdb3ac..ac631a39a69015833716ec463b9b550276d1ff88 100644 (file)
@@ -92,10 +92,6 @@ features, customize the variable @code{use-system-tooltips} to the
 @code{nil} value, and Emacs will use its own implementation of
 tooltips.
 
-  System tooltips cannot display above the menu bar, so help text in
-the menu bar will display in the echo area instead when they are
-enabled.
-
 @cindex X resources on Haiku
   Unlike the X window system, Haiku does not have a system-wide
 resource database.  Since many important options are specified via
index cd4e6e46cd2cbbc20708cda68e0f483a5426190e..ae2736110ec43fcfe98e9a3e5496dd00a5b0577d 100644 (file)
@@ -1636,17 +1636,17 @@ public:
   {
     struct haiku_menu_bar_help_event rq;
 
-    if (menu_bar_id >= 0)
+    if (help)
+      {
+       Menu ()->SetToolTip (highlight_p ? help : NULL);
+      }
+    else if (menu_bar_id >= 0)
       {
        rq.window = wind_ptr;
        rq.mb_idx = highlight_p ? menu_bar_id : -1;
 
        haiku_write (MENU_BAR_HELP_EVENT, &rq);
       }
-    else if (help)
-      {
-       Menu ()->SetToolTip (highlight_p ? help : NULL);
-      }
 
     BMenuItem::Highlight (highlight_p);
   }
index f335bdacb4088def7016b1a0786a4d8622e92aa4..2ceb0ff365370e3d5e2f43106c181f7632bc1b45 100644 (file)
@@ -158,6 +158,12 @@ digest_menu_items (void *first_menu, int start, int menu_items_used,
                            !NILP (enable), !NILP (selected), 0, window,
                            !NILP (descrip) ? SSDATA (descrip) : NULL,
                            STRINGP (help) ? SSDATA (help) : NULL);
+         else if (!use_system_tooltips || NILP (Fsymbol_value (Qtooltip_mode)))
+           BMenu_add_item (menu, SSDATA (item_name),
+                           !NILP (def) ? (void *) (intptr_t) i : NULL,
+                           !NILP (enable), !NILP (selected), 1, window,
+                           !NILP (descrip) ? SSDATA (descrip) : NULL,
+                           NULL);
          else
            BMenu_add_item (menu, SSDATA (item_name),
                            !NILP (def) ? (void *) (intptr_t) i : NULL,
@@ -664,6 +670,7 @@ syms_of_haikumenu (void)
   DEFSYM (Qdebug_on_next_call, "debug-on-next-call");
   DEFSYM (Qpopup_menu, "popup-menu");
   DEFSYM (Qmouse_menu_bar_map, "mouse-menu-bar-map");
+  DEFSYM (Qtooltip_mode, "tooltip-mode");
 
   defsubr (&Smenu_or_popup_active_p);
   defsubr (&Shaiku_menu_bar_open);