Gtk(Toggle)Button: preserve untouched state flags when updating state.

Partly fixes bug #640282, noticed by Christian Persch. buttons were
clobbering the insensitive flag when updating their state.
This commit is contained in:
Carlos Garnacho 2011-01-23 18:04:41 +01:00
parent 74f7e08811
commit a0e1fa9e77
2 changed files with 9 additions and 1 deletions

View File

@ -2298,7 +2298,7 @@ static void
gtk_button_update_state (GtkButton *button)
{
GtkButtonPrivate *priv = button->priv;
GtkStateFlags new_state = 0;
GtkStateFlags new_state;
gboolean depressed;
if (priv->activate_timeout)
@ -2306,6 +2306,9 @@ gtk_button_update_state (GtkButton *button)
else
depressed = priv->in_button && priv->button_down;
new_state = gtk_widget_get_state_flags (GTK_WIDGET (button)) &
~(GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_ACTIVE);
if (priv->in_button)
new_state |= GTK_STATE_FLAG_PRELIGHT;

View File

@ -563,6 +563,11 @@ gtk_toggle_button_update_state (GtkButton *button)
"gtk-touchscreen-mode", &touchscreen,
NULL);
new_state = gtk_widget_get_state_flags (GTK_WIDGET (button)) &
~(GTK_STATE_FLAG_INCONSISTENT |
GTK_STATE_FLAG_PRELIGHT |
GTK_STATE_FLAG_ACTIVE);
if (priv->inconsistent)
new_state |= GTK_STATE_FLAG_INCONSISTENT;