summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1998-03-26 21:57:45 +0000
committerTim Janik <timj@src.gnome.org>1998-03-26 21:57:45 +0000
commitc2906f2beaf51a3528550e3146fc046ad9b7c65f (patch)
treea36a48cd35aed86584fbab7c39eaf87fa43928c0
parenta74e338517b9b7cab0b422b4a0361cb0ef50593d (diff)
downloadgdk-pixbuf-c2906f2beaf51a3528550e3146fc046ad9b7c65f.tar.gz
always display the correct active state.
Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org> * gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always display the correct active state. * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): always display the correct active state. * gtk/gtkwidget.c (gtk_widget_set_arg): CAN_FOCUS and CAN_DEFAULT flag changes need to queue a resize. * gtk/gtkbutton.c (gtk_button_paint): take border_width into consideration for restrict area. * gtk/gtktogglebutton.c (gtk_toggle_button_class_init): enable the draw_default member of GtkButton, otherwise the diplay is messed up for CAN_DEFAULT toggles. (gtk_toggle_button_draw_focus): always display whether the toggle button is active or not. * gtk/gtkwidget.c (gtk_widget_set_state): (gtk_widget_set_sensitive): (gtk_widget_set_parent): (gtk_widget_propagate_state): take into consideration, whether we really want to change childrens states, or just restauration of old states.
-rw-r--r--ChangeLog26
-rw-r--r--ChangeLog.pre-2-026
-rw-r--r--ChangeLog.pre-2-1026
-rw-r--r--ChangeLog.pre-2-226
-rw-r--r--ChangeLog.pre-2-426
-rw-r--r--ChangeLog.pre-2-626
-rw-r--r--ChangeLog.pre-2-826
-rw-r--r--TODO7
-rw-r--r--gtk/gtkbutton.c12
-rw-r--r--gtk/gtkcheckbutton.c4
-rw-r--r--gtk/gtkradiobutton.c4
-rw-r--r--gtk/gtktogglebutton.c13
-rw-r--r--gtk/gtkwidget.c72
13 files changed, 248 insertions, 46 deletions
diff --git a/ChangeLog b/ChangeLog
index 4bbff7ee6..b9dd909ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkwidget.c (gtk_widget_set_arg): CAN_FOCUS and CAN_DEFAULT flag
+ changes need to queue a resize.
+
+ * gtk/gtkbutton.c (gtk_button_paint): take border_width into
+ consideration for restrict area.
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_class_init): enable the
+ draw_default member of GtkButton, otherwise the diplay is messed up
+ for CAN_DEFAULT toggles.
+ (gtk_toggle_button_draw_focus): always display whether the toggle button
+ is active or not.
+
+ * gtk/gtkwidget.c (gtk_widget_set_state):
+ (gtk_widget_set_sensitive):
+ (gtk_widget_set_parent):
+ (gtk_widget_propagate_state): take into consideration, whether we really
+ want to change childrens states, or just restauration of old states.
+
Thu Mar 26 15:33:50 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: When gtk_widget_draw() is called on a
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 4bbff7ee6..b9dd909ce 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,29 @@
+Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkwidget.c (gtk_widget_set_arg): CAN_FOCUS and CAN_DEFAULT flag
+ changes need to queue a resize.
+
+ * gtk/gtkbutton.c (gtk_button_paint): take border_width into
+ consideration for restrict area.
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_class_init): enable the
+ draw_default member of GtkButton, otherwise the diplay is messed up
+ for CAN_DEFAULT toggles.
+ (gtk_toggle_button_draw_focus): always display whether the toggle button
+ is active or not.
+
+ * gtk/gtkwidget.c (gtk_widget_set_state):
+ (gtk_widget_set_sensitive):
+ (gtk_widget_set_parent):
+ (gtk_widget_propagate_state): take into consideration, whether we really
+ want to change childrens states, or just restauration of old states.
+
Thu Mar 26 15:33:50 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: When gtk_widget_draw() is called on a
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 4bbff7ee6..b9dd909ce 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,29 @@
+Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkwidget.c (gtk_widget_set_arg): CAN_FOCUS and CAN_DEFAULT flag
+ changes need to queue a resize.
+
+ * gtk/gtkbutton.c (gtk_button_paint): take border_width into
+ consideration for restrict area.
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_class_init): enable the
+ draw_default member of GtkButton, otherwise the diplay is messed up
+ for CAN_DEFAULT toggles.
+ (gtk_toggle_button_draw_focus): always display whether the toggle button
+ is active or not.
+
+ * gtk/gtkwidget.c (gtk_widget_set_state):
+ (gtk_widget_set_sensitive):
+ (gtk_widget_set_parent):
+ (gtk_widget_propagate_state): take into consideration, whether we really
+ want to change childrens states, or just restauration of old states.
+
Thu Mar 26 15:33:50 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: When gtk_widget_draw() is called on a
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 4bbff7ee6..b9dd909ce 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,29 @@
+Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkwidget.c (gtk_widget_set_arg): CAN_FOCUS and CAN_DEFAULT flag
+ changes need to queue a resize.
+
+ * gtk/gtkbutton.c (gtk_button_paint): take border_width into
+ consideration for restrict area.
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_class_init): enable the
+ draw_default member of GtkButton, otherwise the diplay is messed up
+ for CAN_DEFAULT toggles.
+ (gtk_toggle_button_draw_focus): always display whether the toggle button
+ is active or not.
+
+ * gtk/gtkwidget.c (gtk_widget_set_state):
+ (gtk_widget_set_sensitive):
+ (gtk_widget_set_parent):
+ (gtk_widget_propagate_state): take into consideration, whether we really
+ want to change childrens states, or just restauration of old states.
+
Thu Mar 26 15:33:50 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: When gtk_widget_draw() is called on a
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 4bbff7ee6..b9dd909ce 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,29 @@
+Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkwidget.c (gtk_widget_set_arg): CAN_FOCUS and CAN_DEFAULT flag
+ changes need to queue a resize.
+
+ * gtk/gtkbutton.c (gtk_button_paint): take border_width into
+ consideration for restrict area.
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_class_init): enable the
+ draw_default member of GtkButton, otherwise the diplay is messed up
+ for CAN_DEFAULT toggles.
+ (gtk_toggle_button_draw_focus): always display whether the toggle button
+ is active or not.
+
+ * gtk/gtkwidget.c (gtk_widget_set_state):
+ (gtk_widget_set_sensitive):
+ (gtk_widget_set_parent):
+ (gtk_widget_propagate_state): take into consideration, whether we really
+ want to change childrens states, or just restauration of old states.
+
Thu Mar 26 15:33:50 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: When gtk_widget_draw() is called on a
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 4bbff7ee6..b9dd909ce 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,29 @@
+Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkwidget.c (gtk_widget_set_arg): CAN_FOCUS and CAN_DEFAULT flag
+ changes need to queue a resize.
+
+ * gtk/gtkbutton.c (gtk_button_paint): take border_width into
+ consideration for restrict area.
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_class_init): enable the
+ draw_default member of GtkButton, otherwise the diplay is messed up
+ for CAN_DEFAULT toggles.
+ (gtk_toggle_button_draw_focus): always display whether the toggle button
+ is active or not.
+
+ * gtk/gtkwidget.c (gtk_widget_set_state):
+ (gtk_widget_set_sensitive):
+ (gtk_widget_set_parent):
+ (gtk_widget_propagate_state): take into consideration, whether we really
+ want to change childrens states, or just restauration of old states.
+
Thu Mar 26 15:33:50 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: When gtk_widget_draw() is called on a
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 4bbff7ee6..b9dd909ce 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,29 @@
+Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): always
+ display the correct active state.
+
+ * gtk/gtkwidget.c (gtk_widget_set_arg): CAN_FOCUS and CAN_DEFAULT flag
+ changes need to queue a resize.
+
+ * gtk/gtkbutton.c (gtk_button_paint): take border_width into
+ consideration for restrict area.
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_class_init): enable the
+ draw_default member of GtkButton, otherwise the diplay is messed up
+ for CAN_DEFAULT toggles.
+ (gtk_toggle_button_draw_focus): always display whether the toggle button
+ is active or not.
+
+ * gtk/gtkwidget.c (gtk_widget_set_state):
+ (gtk_widget_set_sensitive):
+ (gtk_widget_set_parent):
+ (gtk_widget_propagate_state): take into consideration, whether we really
+ want to change childrens states, or just restauration of old states.
+
Thu Mar 26 15:33:50 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: When gtk_widget_draw() is called on a
diff --git a/TODO b/TODO
index 1f564a621..11c016210 100644
--- a/TODO
+++ b/TODO
@@ -73,6 +73,13 @@ TODO AFTER GTK 1.0
------------------
* Make all widget attributes configurable after the widget is created (timj).
+
+ * Widgets dervied from GtkButton need to be able to override
+ GtkButtonClass.paint. e.g. redrawing of GtkToggleButton with CAN_DEFAULT
+ is messed up otheriwse. This does in fact not only apply to (toggle)buttons,
+ we should introduce a common paint member for the GtkWidgetClass.
+
+ * Radio buttons need to display CAN/HAS_DEFAULT correctly.
* GtkCList improvements. (Jay Painter)
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 5de521d73..baf65e399 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -454,12 +454,12 @@ gtk_button_paint (GtkWidget *widget,
if (GTK_WIDGET_DRAWABLE (widget))
{
- restrict_area.x = GTK_WIDGET (widget)->style->klass->xthickness;
- restrict_area.y = GTK_WIDGET (widget)->style->klass->ythickness;
- restrict_area.width = (GTK_WIDGET (widget)->allocation.width - restrict_area.x * 2 -
- GTK_CONTAINER (widget)->border_width * 2);
- restrict_area.height = (GTK_WIDGET (widget)->allocation.height - restrict_area.y * 2 -
- GTK_CONTAINER (widget)->border_width * 2);
+ restrict_area.x = (GTK_WIDGET (widget)->style->klass->xthickness +
+ GTK_CONTAINER (widget)->border_width);
+ restrict_area.y = (GTK_WIDGET (widget)->style->klass->ythickness +
+ GTK_CONTAINER (widget)->border_width);
+ restrict_area.width = GTK_WIDGET (widget)->allocation.width - restrict_area.x * 2;
+ restrict_area.height = GTK_WIDGET (widget)->allocation.height - restrict_area.y * 2;
if (GTK_WIDGET_CAN_DEFAULT (widget))
{
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index c7244f3c4..30a181aab 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -362,9 +362,7 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
width = CHECK_BUTTON_CLASS (widget)->indicator_size;
height = CHECK_BUTTON_CLASS (widget)->indicator_size;
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
- shadow_type = GTK_SHADOW_IN;
- else if ((GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT) && toggle_button->active)
+ if (GTK_TOGGLE_BUTTON (widget)->active)
shadow_type = GTK_SHADOW_IN;
else
shadow_type = GTK_SHADOW_OUT;
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index 774d916d8..3941db65a 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -329,9 +329,7 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
width = CHECK_BUTTON_CLASS (widget)->indicator_size;
height = CHECK_BUTTON_CLASS (widget)->indicator_size;
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
- shadow_type = GTK_SHADOW_IN;
- else if ((GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT) && toggle_button->active)
+ if (GTK_TOGGLE_BUTTON (widget)->active)
shadow_type = GTK_SHADOW_IN;
else
shadow_type = GTK_SHADOW_OUT;
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index ef57d8726..8dbcba210 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -92,7 +92,6 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class)
gtk_object_class_add_signals (object_class, toggle_button_signals, LAST_SIGNAL);
widget_class->draw_focus = gtk_toggle_button_draw_focus;
- widget_class->draw_default = NULL;
button_class->pressed = gtk_toggle_button_pressed;
button_class->released = gtk_toggle_button_released;
@@ -181,15 +180,15 @@ gtk_toggle_button_draw_focus (GtkWidget *widget)
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
- if (GTK_WIDGET_DRAWABLE (widget))
+ if (GTK_WIDGET_DRAWABLE (widget))
{
button = GTK_BUTTON (widget);
toggle_button = GTK_TOGGLE_BUTTON (widget);
x = 0;
y = 0;
- width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
- height = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2;
+ width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
+ height = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2;
if (GTK_WIDGET_CAN_DEFAULT (widget))
{
@@ -210,7 +209,7 @@ gtk_toggle_button_draw_focus (GtkWidget *widget)
}
else
{
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
+ if (GTK_WIDGET_STATE (toggle_button) == GTK_STATE_ACTIVE)
gdk_draw_rectangle (widget->window,
widget->style->bg_gc[GTK_WIDGET_STATE (widget)], FALSE,
x + 1, y + 1, width - 4, height - 4);
@@ -220,9 +219,7 @@ gtk_toggle_button_draw_focus (GtkWidget *widget)
x + 2, y + 2, width - 5, height - 5);
}
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
- shadow_type = GTK_SHADOW_IN;
- else if ((GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT) && toggle_button->active)
+ if (toggle_button->active)
shadow_type = GTK_SHADOW_IN;
else
shadow_type = GTK_SHADOW_OUT;
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 428a63c04..43739dd71 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -133,7 +133,8 @@ typedef struct _GtkStateData GtkStateData;
struct _GtkStateData
{
GtkStateType state;
- gint parent_sensitive;
+ guint state_restauration : 1;
+ guint parent_sensitive : 1;
};
@@ -760,6 +761,8 @@ gtk_widget_set_arg (GtkWidget *widget,
GtkArg *arg,
guint arg_id)
{
+ guint32 saved_flags;
+
switch (arg_id)
{
case ARG_NAME:
@@ -790,20 +793,26 @@ gtk_widget_set_arg (GtkWidget *widget,
gtk_widget_set_sensitive (widget, GTK_VALUE_BOOL (*arg));
break;
case ARG_CAN_FOCUS:
+ saved_flags = GTK_WIDGET_FLAGS (widget);
if (GTK_VALUE_BOOL (*arg))
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
else
GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
+ if (saved_flags != GTK_WIDGET_FLAGS (widget))
+ gtk_widget_queue_resize (widget);
break;
case ARG_HAS_FOCUS:
if (GTK_VALUE_BOOL (*arg))
gtk_widget_grab_focus (widget);
break;
case ARG_CAN_DEFAULT:
+ saved_flags = GTK_WIDGET_FLAGS (widget);
if (GTK_VALUE_BOOL (*arg))
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_DEFAULT);
else
GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_DEFAULT);
+ if (saved_flags != GTK_WIDGET_FLAGS (widget))
+ gtk_widget_queue_resize (widget);
break;
case ARG_HAS_DEFAULT:
if (GTK_VALUE_BOOL (*arg))
@@ -2255,6 +2264,7 @@ gtk_widget_set_state (GtkWidget *widget,
GtkStateType state)
{
g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
if (state == GTK_WIDGET_STATE (widget))
return;
@@ -2264,19 +2274,16 @@ gtk_widget_set_state (GtkWidget *widget,
else
{
GtkStateData data;
- GtkStateType old_state;
data.state = state;
+ data.state_restauration = FALSE;
if (widget->parent)
- data.parent_sensitive = GTK_WIDGET_IS_SENSITIVE (widget->parent);
+ data.parent_sensitive = (GTK_WIDGET_IS_SENSITIVE (widget->parent) != FALSE);
else
- data.parent_sensitive = GTK_PARENT_SENSITIVE;
-
- old_state = GTK_WIDGET_STATE (widget);
+ data.parent_sensitive = TRUE;
gtk_widget_propagate_state (widget, &data);
- if (old_state != GTK_WIDGET_STATE (widget))
- gtk_widget_queue_draw (widget);
+ gtk_widget_queue_draw (widget);
}
}
@@ -2295,33 +2302,34 @@ gtk_widget_set_sensitive (GtkWidget *widget,
gint sensitive)
{
GtkStateData data;
- GtkStateType old_state;
g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ sensitive = (sensitive != FALSE);
+
+ if (sensitive == (GTK_WIDGET_SENSITIVE (widget) != FALSE))
+ return;
if (sensitive)
{
GTK_WIDGET_SET_FLAGS (widget, GTK_SENSITIVE);
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
- data.state = GTK_WIDGET_SAVED_STATE (widget);
- else
- data.state = GTK_WIDGET_STATE (widget);
+ data.state = GTK_WIDGET_SAVED_STATE (widget);
}
else
{
GTK_WIDGET_UNSET_FLAGS (widget, GTK_SENSITIVE);
data.state = GTK_WIDGET_STATE (widget);
}
+ data.state_restauration = TRUE;
if (widget->parent)
- data.parent_sensitive = GTK_WIDGET_IS_SENSITIVE (widget->parent);
+ data.parent_sensitive = (GTK_WIDGET_IS_SENSITIVE (widget->parent) != FALSE);
else
- data.parent_sensitive = GTK_PARENT_SENSITIVE;
+ data.parent_sensitive = TRUE;
- old_state = GTK_WIDGET_STATE (widget);
gtk_widget_propagate_state (widget, &data);
- if (old_state != GTK_WIDGET_STATE (widget))
- gtk_widget_queue_draw (widget);
+ gtk_widget_queue_draw (widget);
}
/*****************************************
@@ -2354,7 +2362,8 @@ gtk_widget_set_parent (GtkWidget *widget,
data.state = GTK_WIDGET_STATE (parent);
else
data.state = GTK_WIDGET_STATE (widget);
- data.parent_sensitive = GTK_WIDGET_IS_SENSITIVE (parent);
+ data.state_restauration = FALSE;
+ data.parent_sensitive = (GTK_WIDGET_IS_SENSITIVE (parent) != FALSE);
gtk_widget_propagate_state (widget, &data);
@@ -3752,8 +3761,8 @@ gtk_widget_propagate_state (GtkWidget *widget,
{
guint8 old_state;
- /* don't call this function with state=GTK_STATE_INSENSITIVE,
- * parent_sensitive=TRUE and a sensitive widget
+ /* don't call this function with state==GTK_STATE_INSENSITIVE,
+ * parent_sensitive==TRUE on a sensitive widget
*/
old_state = GTK_WIDGET_STATE (widget);
@@ -3763,20 +3772,31 @@ gtk_widget_propagate_state (GtkWidget *widget,
GTK_WIDGET_SET_FLAGS (widget, GTK_PARENT_SENSITIVE);
if (GTK_WIDGET_IS_SENSITIVE (widget))
- GTK_WIDGET_STATE (widget) = data->state;
+ {
+ if (data->state_restauration)
+ GTK_WIDGET_STATE (widget) = GTK_WIDGET_SAVED_STATE (widget);
+ else
+ GTK_WIDGET_STATE (widget) = data->state;
+ }
else
{
GTK_WIDGET_STATE (widget) = GTK_STATE_INSENSITIVE;
- if (data->state != GTK_STATE_INSENSITIVE)
+ if (!data->state_restauration &&
+ data->state != GTK_STATE_INSENSITIVE)
GTK_WIDGET_SAVED_STATE (widget) = data->state;
}
}
else
{
GTK_WIDGET_UNSET_FLAGS (widget, GTK_PARENT_SENSITIVE);
+ if (!data->state_restauration)
+ {
+ if (data->state != GTK_STATE_INSENSITIVE)
+ GTK_WIDGET_SAVED_STATE (widget) = data->state;
+ }
+ else if (GTK_WIDGET_STATE (widget) != GTK_STATE_INSENSITIVE)
+ GTK_WIDGET_SAVED_STATE (widget) = GTK_WIDGET_STATE (widget);
GTK_WIDGET_STATE (widget) = GTK_STATE_INSENSITIVE;
- if (data->state != GTK_STATE_INSENSITIVE)
- GTK_WIDGET_SAVED_STATE (widget) = data->state;
}
if (GTK_WIDGET_HAS_FOCUS (widget) && !GTK_WIDGET_IS_SENSITIVE (widget))
@@ -3795,7 +3815,7 @@ gtk_widget_propagate_state (GtkWidget *widget,
if (GTK_IS_CONTAINER (widget))
{
- data->parent_sensitive = GTK_WIDGET_IS_SENSITIVE (widget);
+ data->parent_sensitive = (GTK_WIDGET_IS_SENSITIVE (widget) != FALSE);
data->state = GTK_WIDGET_STATE (widget);
gtk_container_foreach (GTK_CONTAINER (widget),
(GtkCallback) gtk_widget_propagate_state,