GtkWidget: Change which states propagate

Historically the following states propagated to children:
  GTK_STATE_FLAG_ACTIVE
  GTK_STATE_FLAG_PRELIGHT
  GTK_STATE_FLAG_SELECTED
  GTK_STATE_FLAG_INSENSITIVE
  GTK_STATE_FLAG_INCONSISTENT
  GTK_STATE_FLAG_BACKDROP

However, several of these are problematic on containers like GtkListBox.
For instance, if a row is ACTIVE or SELECTED then all children (like e.g
a button) inside the row will *also* look active/selected. This is almost
never right. The right way to theme this is to catch e.g. SELECTED on the
container itself and set e.g. the color and let the children inherit
the color instead of the flag.

We now propagate only these flags:
  GTK_STATE_FLAG_INSENSITIVE
  GTK_STATE_FLAG_BACKDROP

Which make sense to be recursive as they really affect every widget
inside the container.

However, this is a CSS theme break, and while most things continue working
as-is some themes may need minor tweaks.
This commit is contained in:
Alexander Larsson 2013-06-10 17:02:34 +02:00
parent ecff28bb68
commit 6a77754c77

View File

@ -385,12 +385,7 @@
* </refsect2>
*/
/* Add flags here that should not be propagated to children. By default,
* all flags will be set on children (think prelight or active), but we
* might want to not do this for some.
*/
#define GTK_STATE_FLAGS_DONT_PROPAGATE (GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_DIR_LTR | GTK_STATE_FLAG_DIR_RTL)
#define GTK_STATE_FLAGS_DO_PROPAGATE (~GTK_STATE_FLAGS_DONT_PROPAGATE)
#define GTK_STATE_FLAGS_DO_PROPAGATE (GTK_STATE_FLAG_INSENSITIVE|GTK_STATE_FLAG_BACKDROP)
#define WIDGET_CLASS(w) GTK_WIDGET_GET_CLASS (w)