Web lists-archives.com

Re: They broke the CSS custom color settings in 3.20


On 12 November 2016 at 09:40, Stefan Salewski <mail@xxxxxxxxxxxx> wrote:

> Getting tooltips with white background for a dark gtksourceview color
> scheme was already one of the harder task for GTK 3.18 -- but somehow I
> managed it. Recently I got GTK 3.20 and had to notice that setting
> background for tooltip does not work any more. Setting the colors was
> done this way for GTK 3.18:
> const
>   str0 = ".tooltip {background-color: rgba($1, $2, $3, 0.9); color: rgba($4, $5, $6, 1.0); \n}"

If you change ".tooltip" to "tooltip", it should go back to working.

As you may or may not have heard, starting from GTK+ 3.20 all theming
state is now public and stable — instead of being undocumented and


Each widget class inside GTK+ has its own CSS element name and child
boxes documented in the API reference, e.g.:


But I just noticed that the GtkTooltip documentation does not specify
the CSS element name — mostly because users can replace the tooltip
window with their own, and we cannot set the element name after the
widget class construction, and thus we cannot guarantee that a tooltip
will always match to the "tooltip" element name.

> I have the feeling that fixing this basically simple problem will take
> much time again.

It shouldn't; it's mostly a case of:

 * copying the GTK+ pre-3.20 theme
 * removing all cases of matching on a GType name and use style classes instead
 * using the CSS name from the API reference

If you want to maintain backward compatibility, then you can check the
version of GTK+ you're running against by using gtk_check_version();
if it's 3.20 or later, you can load the 3.20 theme; otherwise, you can
load the pre-3.20 theme.

In any case, now the theming information is part of the public API,
and 3.22 is feature frozen, which also means that there won't be any
further changes to the CSS style system.


[@] ebassi [@gmail.com]
gtk-list mailing list