From 6a77754c77eed2b128aeff0a09a428c0b5f5512e Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 10 Jun 2013 17:02:34 +0200 Subject: [PATCH] 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. --- gtk/gtkwidget.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 3ddd36ac3e..c78522f762 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -385,12 +385,7 @@ * */ -/* 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)