From 23f9bdd586e0b0aac11d9fbcaeaf81c056d2a036 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 7 Feb 2011 11:23:43 -0500 Subject: [PATCH] Fix problems with state propagation Sensitivity changes were not properly propagated down the hierarchy. There were two issues here: a) correctly identifying when a state change request affects sensitivity b) not filtering out sensitivity in gtk_widget_propagate_state(), since gtk_widget_set_sensitivity() uses that to do its work https://bugzilla.gnome.org/show_bug.cgi?id=641431 --- gtk/gtkwidget.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 410f493fca..b2f14db7a6 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -6959,10 +6959,12 @@ _gtk_widget_update_state_flags (GtkWidget *widget, /* Handle insensitive first, since it is propagated * differently throughout the widget hierarchy. */ - if ((flags & GTK_STATE_FLAG_INSENSITIVE) != - (priv->state_flags & GTK_STATE_FLAG_INSENSITIVE)) - gtk_widget_set_sensitive (widget, - operation != STATE_CHANGE_UNSET); + if ((priv->state_flags & GTK_STATE_FLAG_INSENSITIVE) && (flags & GTK_STATE_FLAG_INSENSITIVE) && (operation == STATE_CHANGE_UNSET)) + gtk_widget_set_sensitive (widget, TRUE); + else if (!(priv->state_flags & GTK_STATE_FLAG_INSENSITIVE) && (flags & GTK_STATE_FLAG_INSENSITIVE) && (operation != STATE_CHANGE_UNSET)) + gtk_widget_set_sensitive (widget, FALSE); + else if ((priv->state_flags & GTK_STATE_FLAG_INSENSITIVE) && !(flags & GTK_STATE_FLAG_INSENSITIVE) && (operation == STATE_CHANGE_REPLACE)) + gtk_widget_set_sensitive (widget, TRUE); if (operation != STATE_CHANGE_REPLACE) flags &= ~(GTK_STATE_FLAG_INSENSITIVE); @@ -11245,8 +11247,8 @@ gtk_widget_propagate_state (GtkWidget *widget, { data->parent_sensitive = gtk_widget_is_sensitive (widget); - /* Do not propagate insensitive state further */ - data->flags &= ~(GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_FOCUSED); + /* Do not propagate focused state further */ + data->flags &= ~GTK_STATE_FLAG_FOCUSED; if (data->use_forall) gtk_container_forall (GTK_CONTAINER (widget),