On Sat, Apr 29, 2023 at 7:02 PM Bram Moolenaar <
Br...@moolenaar.net> wrote:
>
>
> Tony wrote:
>
> > Under *setting-guifont*, in file runtime/doc/gui.txt (or
> > $VIMRUNTIME/doc/gui.txt) line 1229
> > there is
> > if has("gui_gtk2")
> > there should be
> > if has("gui_gtk2") || has("gui_gtk3")
> > otherwise the 'guifont' option will be given a wrong font name
> > (selected by has("x11")) in gvim with GTK3 GUI.
>
> It should then be possible to just check for "gui_gtk", that is an "or"
> of "gui_gtk2" and "gui_gtk3".
>
> There is a comment just below this:
>
> " Also for GTK 1
>
> I don't think this exists anymore, and we don't need to cover everything
> in this example. It's also misleading, since the check for "gui_gtk2"
> actually would also catch GTK 1.
Oh? It used not to.
In the past (quite some years ago), when I used GTK1 on Linux,
• has("gui_gtk") would catch any GTK version
* has("gui_gtk2") would catch only GTK2. The Vim help mentioned it as
experimental but it was less and less so as time passed, and IIRC at
some point that mention was removed.
• GTK3 didn't exist yet.
That's when I wrote a VimTip (the precursor to the *setting-guifont*
help entry) and posted it to
vim.org. I didn't use has("gui_gtk")
because GTK1 needed to be treated differently than GTK2 so I tested
for GTK2 first (GTK3 didn't exist yet), then for a few others, then
for has("x11") meaning "other X11 including GTK1" and assumed Windows
in the bottom-most "else" branch. MacVim, when it was later developed,
needed an other …elseif… but I wasn't competent to write it.
Since then has("gui_gtk3") has been added. Its use is very similar to
that of GTK2 but there are differences (e.g. Gnome3 is included in
GTK3 but Gnome2 had to be specified to configure in addition to GTK2;
but the font settings are identical).
AFAIK 'guifont' for Motif still has to be an XLFD so if we can have
the obsolete GTK1 fall into that branch of the if … elseif … elseif …
else … endif, then why not?
Best regards,
Tony.