Make system tooltips display in the menu bar on Haiku

* 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'.
This commit is contained in:
Po Lu 2022-01-20 10:53:49 +00:00
parent b929bdaeb6
commit e26071e990
3 changed files with 12 additions and 9 deletions

View 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

View 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);
}

View 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);