[gtk] widget: Propagate PRELIGHT state when unsetting it



commit 61ec2ab5c97f70b4adb0ff2b586bf8936133d60e
Author: Timm Bäder <mail baedert org>
Date:   Tue Jan 29 07:17:46 2019 +0100

    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.

 gtk/gtkwidget.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 67c1d6db50..d6d0189c87 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]