emacs-diffs
[Top][All Lists]
Advanced

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

master 0c0b77b3cc 1/2: Allow non-system tooltips to display above menus


From: Po Lu
Subject: master 0c0b77b3cc 1/2: Allow non-system tooltips to display above menus on Haiku
Date: Mon, 17 Jan 2022 21:44:27 -0500 (EST)

branch: master
commit 0c0b77b3ccecc7ca508254f66b4212ea7106b4df
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 doc/emacs/haiku.texi |  6 +++---
 lisp/tooltip.el      |  6 ++++--
 src/haiku_support.cc |  1 -
 src/haikufns.c       | 20 ++++++++++----------
 src/haikuterm.c      |  2 +-
 5 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/doc/emacs/haiku.texi b/doc/emacs/haiku.texi
index eeae379e06..6e38660fdb 100644
--- a/doc/emacs/haiku.texi
+++ b/doc/emacs/haiku.texi
@@ -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
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index b859052959..af6f456d7b 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -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)
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 22a977a4a6..2d6fd0381f 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -1320,7 +1320,6 @@ public:
     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 ();
diff --git a/src/haikufns.c b/src/haikufns.c
index c294f4e862..4ab7fa83b5 100644
--- a/src/haikufns.c
+++ b/src/haikufns.c
@@ -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:
diff --git a/src/haikuterm.c b/src/haikuterm.c
index cc4c3961ec..60b59436b8 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -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);



reply via email to

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