[gtk+] Fix problems with state propagation
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Fix problems with state propagation
- Date: Mon, 7 Feb 2011 16:27:55 +0000 (UTC)
commit 23f9bdd586e0b0aac11d9fbcaeaf81c056d2a036
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Feb 7 11:23:43 2011 -0500
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 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 410f493..b2f14db 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),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]