Attention: State propagation changed in master, themes may need changes



So, I just landed GtkListBox in Gtk+ master. Its essentially a slightly
evolved version of EggListBox. One of the main differences compared to
EggListBox is that it has a specific row widget GtkListBoxRow which is
the only thing that can be a child of a GtkListBox (well, if you add
anything else one will be inserted for you). 

One of the important reasons for this is that you then get a reference
to the row in the css system, so that you can e.g. set the
GTK_STATE_FLAG_SELECTED on it. This was a problem with EggListBox where
the selected state was just temporarily set during the drawing of the
row background, which meant child widgets could not match on this and
thus we could not change the color of the text in a selected row to
match the selection color.

However, setting the state flags on the row widget exposed a weakness in
the Gtk+ theming system. Gtk+ propagates most state flags (including
selected, active, prelight, all used on listbox rows) to all children.
This means that if a row with a button is selected, the label inside the
button will look selected (white text on blue). And if you click on the
row the button looks like its being activated (clicked).

This is a general problem in Gtk+ for all kind of container widgets that
are also interactive, and the fix (now in master) is to not propagate
these states. In fact, the only states that are now propagated to child
widgets are INSENSITIVE and BACKDROP.

This may seem weird, as the state of a parent needs to be able to affect
a child (e.g. the label color in a selected row), but it is not so
strange because we use CSS to theme things, and CSS uses other ways to
inherit from a parent. For instance, the color property is by itself
inherited by default, so if you just set the color on the row it will
automatically be applied to the label child. And if that is not enough
you can match on the parent state using CSS selectors.

In fact, most things just seems to work with current adwaita. However,
it is possible some things are broken, so please everyone be on the
lookout for things that look weird.




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