1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-01 08:17:38 +00:00

Allow non-system tooltips to display above menus on Haiku

* doc/emacs/haiku.texi (Haiku Basics): Document that tooltips
can now be displayed above the menu bar.

* lisp/tooltip.el (tooltip-show-help): Only display help text in
the echo area if Haiku system tooltips are enabled.

* src/haiku_support.cc (FlipBuffers): Stop flushing view.
* src/haikufns.c (Fx_show_tip): Fix a sizing bug leading to
tooltips needing two redisplays to display correctly.
* src/haikuterm.c (haiku_read_socket): Ignore resize events on
tooltips.
This commit is contained in:
Po Lu 2022-01-18 02:06:00 +00:00
parent 2dad332a14
commit 0c0b77b3cc
5 changed files with 18 additions and 17 deletions

View File

@ -92,9 +92,9 @@ not be able to display text properties or faces. If you need those
features, customize the variable @code{haiku-use-system-tooltips} to
the nil value, and Emacs will use its own implementation of tooltips.
Both system tooltips and Emacs's own tooltips cannot display above
the menu bar, so help text in the menu bar will display in the echo
area instead.
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

View File

@ -374,8 +374,10 @@ It is also called if Tooltip mode is on, for text-only displays."
"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)
(or (not (eq window-system 'haiku)) ;; On Haiku, there isn't a reliable way to show tooltips
;; above menus.
;; On Haiku, system tooltips can't be displayed above
;; menus.
(or (not (and haiku-use-system-tooltips
(eq window-system 'haiku)))
(not (menu-or-popup-active-p))))
(let ((previous-help tooltip-help-message))
(setq tooltip-help-message msg)

View File

@ -1320,7 +1320,6 @@ class EmacsView : public BView
if (!offscreen_draw_view)
gui_abort ("Failed to lock offscreen view during buffer flip");
offscreen_draw_view->Flush ();
offscreen_draw_view->Sync ();
EmacsWindow *w = (EmacsWindow *) Window ();

View File

@ -1903,10 +1903,6 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
tip_last_string = string;
tip_last_parms = parms;
/* Block input until the tip has been fully drawn, to avoid crashes
when drawing tips in menus. */
block_input ();
if (NILP (tip_frame) || !FRAME_LIVE_P (XFRAME (tip_frame)))
{
/* Add default values to frame parameters. */
@ -1998,20 +1994,24 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
/* Calculate position of tooltip frame. */
compute_tip_xy (tip_f, parms, dx, dy, width, height, &root_x, &root_y);
block_input ();
BWindow_set_offset (FRAME_HAIKU_WINDOW (tip_f),
root_x, root_y);
BWindow_resize (FRAME_HAIKU_WINDOW (tip_f), width, height);
haiku_set_offset (tip_f, root_x, root_y, 1);
BView_resize_to (FRAME_HAIKU_VIEW (tip_f), width, height);
change_frame_size (tip_f, width, height, false, true, false);
BWindow_set_tooltip_decoration (FRAME_HAIKU_WINDOW (tip_f));
BView_set_view_cursor (FRAME_HAIKU_VIEW (tip_f),
FRAME_OUTPUT_DATA (XFRAME (frame))->current_cursor);
SET_FRAME_VISIBLE (tip_f, 1);
BWindow_set_visible (FRAME_HAIKU_WINDOW (tip_f), 1);
BWindow_sync (FRAME_HAIKU_WINDOW (tip_f));
SET_FRAME_VISIBLE (tip_f, 1);
unblock_input ();
w->must_be_updated_p = true;
flush_frame (tip_f);
update_single_window (w);
set_buffer_internal_1 (old_buffer);
unbind_to (count_1, Qnil);
unblock_input ();
windows_or_buffers_changed = old_windows_or_buffers_changed;
start_timer:

View File

@ -2639,7 +2639,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
struct haiku_resize_event *b = buf;
struct frame *f = haiku_window_to_frame (b->window);
if (!f)
if (!f || FRAME_TOOLTIP_P (f))
continue;
int width = lrint (b->px_widthf);