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.

There is no GTK 1 version anymore.  The code now uses:

        {"gui_gtk",
#ifdef FEAT_GUI_GTK
                1
#else
                0
#endif
                },
        {"gui_gtk2",
#if defined(FEAT_GUI_GTK) && !defined(USE_GTK3)
                1
#else
                0
#endif
                },
        {"gui_gtk3",
#if defined(FEAT_GUI_GTK) && defined(USE_GTK3)
                1
#else
                0
#endif
                },

That means "gui_gtk2" is true for any GTK version except GTK 3.

I haven't heard from anyone that this is not sufficient.  As you
mention, the first GTK version only existed long ago (and was not very
usable).

> 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?

We don't support GTK 1 anymore, suggesting code in the help for not
implemented functionality doesn't make much sense.

-- 
Eye have a spelling checker, it came with my PC;
It plainly marks four my revue mistakes I cannot sea.
I've run this poem threw it, I'm sure your please to no,
It's letter perfect in it's weigh, my checker tolled me sew!

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230429211005.71B981C03D0%40moolenaar.net.

Raspunde prin e-mail lui