widget: Propagate PRELIGHT state when unsetting it

Without this, disabling a widget that's being hovered and is a child
widget of the widget we're disabling (e.g. the GtkImage child of a
GtkButton) will retain its :hover state even though it should be
insensitive to any sort of input now.
This commit is contained in:
Timm Bäder 2019-01-29 07:17:46 +01:00
parent 611964d915
commit 61ec2ab5c9

View File

@ -432,7 +432,11 @@
* ]|
*/
#define GTK_STATE_FLAGS_DO_PROPAGATE (GTK_STATE_FLAG_INSENSITIVE|GTK_STATE_FLAG_BACKDROP)
#define GTK_STATE_FLAGS_DO_SET_PROPAGATE (GTK_STATE_FLAG_INSENSITIVE | \
GTK_STATE_FLAG_BACKDROP)
#define GTK_STATE_FLAGS_DO_UNSET_PROPAGATE (GTK_STATE_FLAG_INSENSITIVE | \
GTK_STATE_FLAG_BACKDROP | \
GTK_STATE_FLAG_PRELIGHT)
typedef struct {
gchar *name; /* Name of the template automatic child */
@ -6551,7 +6555,7 @@ gtk_widget_reposition_after (GtkWidget *widget,
/* Merge both old state and current parent state,
* making sure to only propagate the right states */
data.flags_to_set = parent_flags & GTK_STATE_FLAGS_DO_PROPAGATE;
data.flags_to_set = parent_flags & GTK_STATE_FLAGS_DO_SET_PROPAGATE;
data.flags_to_unset = 0;
gtk_widget_propagate_state (widget, &data);
@ -8985,8 +8989,8 @@ gtk_widget_propagate_state (GtkWidget *widget,
/* Make sure to only propagate the right states further */
child_data.old_scale_factor = new_scale_factor;
child_data.flags_to_set = data->flags_to_set & GTK_STATE_FLAGS_DO_PROPAGATE;
child_data.flags_to_unset = data->flags_to_unset & GTK_STATE_FLAGS_DO_PROPAGATE;
child_data.flags_to_set = data->flags_to_set & GTK_STATE_FLAGS_DO_SET_PROPAGATE;
child_data.flags_to_unset = data->flags_to_unset & GTK_STATE_FLAGS_DO_UNSET_PROPAGATE;
if (child_data.flags_to_set != 0 ||
child_data.flags_to_unset != 0)