mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-06 08:40:08 +00:00
widget: Propagate the right states to the widget when setting the parent
This commit is contained in:
parent
1e43965350
commit
0bfc95faa3
@ -299,6 +299,13 @@
|
|||||||
* </refsect2>
|
* </refsect2>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Add flags here that should not be propagated to children. By default,
|
||||||
|
* all flags will be set on children (think prelight or active), but we
|
||||||
|
* might want to not do this for some.
|
||||||
|
*/
|
||||||
|
#define GTK_STATE_FLAGS_DONT_PROPAGATE (GTK_STATE_FLAG_FOCUSED)
|
||||||
|
#define GTK_STATE_FLAGS_DO_PROPAGATE (~GTK_STATE_FLAGS_DONT_PROPAGATE)
|
||||||
|
|
||||||
#define WIDGET_CLASS(w) GTK_WIDGET_GET_CLASS (w)
|
#define WIDGET_CLASS(w) GTK_WIDGET_GET_CLASS (w)
|
||||||
#define INIT_PATH_SIZE (512)
|
#define INIT_PATH_SIZE (512)
|
||||||
|
|
||||||
@ -7698,9 +7705,8 @@ gtk_widget_set_parent (GtkWidget *widget,
|
|||||||
parent_flags = gtk_widget_get_state_flags (parent);
|
parent_flags = gtk_widget_get_state_flags (parent);
|
||||||
|
|
||||||
/* Merge both old state and current parent state,
|
/* Merge both old state and current parent state,
|
||||||
* We don't want the insensitive flag to propagate
|
* making sure to only propagate the right states */
|
||||||
* to the new child though */
|
data.flags = parent_flags & GTK_STATE_FLAGS_DO_PROPAGATE;
|
||||||
data.flags = parent_flags & ~GTK_STATE_FLAG_INSENSITIVE;
|
|
||||||
data.flags |= priv->state_flags;
|
data.flags |= priv->state_flags;
|
||||||
|
|
||||||
data.operation = STATE_CHANGE_REPLACE;
|
data.operation = STATE_CHANGE_REPLACE;
|
||||||
@ -11240,8 +11246,8 @@ gtk_widget_propagate_state (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkStateData child_data = *data;
|
GtkStateData child_data = *data;
|
||||||
|
|
||||||
/* Do not propagate focused state further */
|
/* Make sure to only propate the right states further */
|
||||||
child_data.flags &= ~GTK_STATE_FLAG_FOCUSED;
|
child_data.flags &= GTK_STATE_FLAGS_DO_PROPAGATE;
|
||||||
|
|
||||||
if (child_data.use_forall)
|
if (child_data.use_forall)
|
||||||
gtk_container_forall (GTK_CONTAINER (widget),
|
gtk_container_forall (GTK_CONTAINER (widget),
|
||||||
|
Loading…
Reference in New Issue
Block a user