Subject: Re: bug#51658: [PATCH] Haiku port (again)

From: Eli Zaretskii <[email-masked]>
Date: Sat, 20 Nov 2021 10:33:01 +0200

> From: Po Lu <[email-masked]>
> Cc: [email-masked]
> Date: Sat, 20 Nov 2021 15:03:11 +0800
> 
> +The value of each variable can one of the symbols @code{command},
                              ^^^^^^^^^^^^^^^^^^^^^^
"can be one of the symbols"

> +  On Haiku, Emacs defaults to using the system tooltip mechanism.
> +This usually leads to more responsive tooltips, but the tooltips will
> +not be able to use advanced display features.  If that is what you
> +need, you can disable the use of system tooltips by setting the
> +variable @code{haiku-use-system-tooltips} to nil.

 "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."

(And which advanced display features are those?  Perhaps they are
important enough to have this variable be nil by default?

> +                                                  (@pxref{Tooltips,,,
> +elisp, The Emacs Lisp Reference Manual}).

This should be @xref and without the parens.  Also, make sure you
leave 2 spaces between sentences.

> +@table @code
> +@vindex haiku-use-system-tooltips
> +@item haiku-use-system-tooltips
> +This variable controls whether or not system tooltips will be used.
> +
> +When non-nil, tooltips are displayed by the Application Kit and not
> +Emacs, and accordingly do not have a tooltip frame.  As such, they are
> +also unable to utilize any display properties.
> +@end table

Since you already explained what this does and mentioned the variable
name, this @table seems redundant.  Just move the @vindex entry to the
above text.

> +  Two of these backends, @code{ftcr} and @code{ftcrfont} are identical
                                  ^^^^
"ftcr" or "ftfont"?  Or maybe you meant ftcrfont and ftcrhb?

> @@ -3143,6 +3155,9 @@ Raising and Lowering
>  below all other frames belonging to the same or a higher z-group as
>  @var{frame}.  If @var{frame} is a child frame (@pxref{Child Frames}),
>  this lowers @var{frame} below all other child frames of its parent.
> +
> +@footnote{Lowering frames is not supported on Haiku, due to limitations
> +imposed by the system.}

@footnote generates a superscript number, so it should follow some
text, presumably the last sentence before it.  Please see how
@footnote is used elsewhere in the manual.

>  Some window managers may refuse to restack windows.
> +
> +@footnote{Restacking frames is not supported on Haiku, due to limitations
> +imposed by the system.}

Likewise.

> @@ -3272,6 +3290,12 @@ Child Frames
>  allowing them to be positioned so they do not obscure the parent frame
>  while still being visible themselves.
>  
> +@footnote{On Haiku, child frames are only visible when a parent frame is
> +active, owing to a limitation of the Haiku windowing system.  Owing to
> +the same limitation, child frames are only guaranteed to appear above
> +their top-level parent; that is to say, the top-most frame in the
> +hierarchy, which does not have a parent frame.}

Likewise.

> +** Emacs has been ported to the Haiku operating system.
> +The configuration process should automatically detect and build for Haiku.
> +There is also an optional window-system port to Haiku, which can be enabled
> +by configuring Emacs with the option '--with-be-app', which will require
> +the Haiku Application Kit development headers and a C++ compiler to be present
> +on your system.  If Emacs is not built with the option '--with-be-app', the
> +resulting Emacs will only run in text-mode terminals.
> +
> ++++
> +*** Cairo drawing support has been enabled for Haiku builds.
> +To enable Cairo support, ensure that the Cairo and FreeType development files
> +are present on your system, and configure Emacs with '--with-be-cairo'.
> +
> +---
> +*** Double buffering is now enabled on the Haiku operating system.
> +Unlike X, there is no compile-time option to enable or disable double-buffering.
> +If you wish to disable double-buffering, change the frame parameter
> +`inhibit-double-buffering' instead.
> +

The lines in these NEWS entries are too long, please use the default
value of fill-column when you file them.

>  ** Emacs now installs the ".pdmp" file using a unique fingerprint in the name.
>  The file is typically installed using a file name akin to
>  "...dir/libexec/emacs/29.1/x86_64-pc-linux-gnu/emacs-<fingerprint>.pdmp".
> diff --git a/etc/PROBLEMS b/etc/PROBLEMS
> index f506881a4b..c548ee9b36 100644
> --- a/etc/PROBLEMS
> +++ b/etc/PROBLEMS
> @@ -1022,6 +1022,15 @@ modern fonts are used, such as Noto Emoji or Ebrima.
>  The solution is to switch to a configuration that uses HarfBuzz as its
>  shaping engine, where these problems don't exist.
>  
> +** On Haiku, some proportionally-spaced fonts display with artifacting.
> +
> +This is a Haiku bug: https://dev.haiku-os.org/ticket/17229, which can
> +be remedied by using a different font that does not exhibit this
> +problem, or by compiling Emacs with the FreeType font driver.
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This would benefit from telling what configure option or run-time
command-line arguments to use to do that.

>  (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 (display-graphic-p)
> +  (if (and (display-graphic-p)
> +           (or (not (eq window-system 'haiku)) ;; On Haiku, there isn't a reliable way to show tooltips
> +                                               ;; above menus.
> +               (not (menu-or-popup-active-p))))

This seems to contradict what you wrote in the user manual about
tooltip options?

> +  while (get_next_team_info (&cookie, &info) == B_OK)
> +    {
> +      lval = Fcons (make_fixnum (info.team), lval);
> +    }

These braces are redundant.

> diff --git a/src/sysdep.c b/src/sysdep.c
> index 8eaee22498..67b6b2aa3d 100644
> --- a/src/sysdep.c
> +++ b/src/sysdep.c
> @@ -71,6 +71,10 @@
>  # include <math.h>
>  #endif
>  
> +#ifdef HAIKU
> +#include <kernel/OS.h>
> +#endif

Is this include still needed in sysdep.c?