range: Stack widgets properly
authorBenjamin Otte <otte@redhat.com>
Sun, 5 Nov 2017 03:00:33 +0000 (04:00 +0100)
committerBenjamin Otte <otte@redhat.com>
Sun, 5 Nov 2017 04:13:17 +0000 (05:13 +0100)
The trough widgets have the slider on top of the fill level and the
hilight widget. Make sure the widget stacking respects that.

This is particularly relevant because picking event targets should pick
the slider and not the hilight widget.

gtk/gtkrange.c
gtk/gtkscale.c

index b9ddad53d461af26c6ebabcf343c15ce2bf1fb00..0b8f6f7a9612a1592997117bc68ad78d5658b472 100644 (file)
@@ -1125,7 +1125,7 @@ gtk_range_set_show_fill_level (GtkRange *range,
   if (show_fill_level)
     {
       priv->fill_widget = gtk_gizmo_new ("fill", NULL, NULL, NULL);
-      gtk_widget_set_parent (priv->fill_widget, priv->trough_widget);
+      gtk_widget_insert_after (priv->fill_widget, priv->trough_widget, NULL);
       update_fill_position (range);
     }
   else
@@ -3010,7 +3010,7 @@ _gtk_range_set_has_origin (GtkRange *range,
   if (has_origin)
     {
       priv->highlight_widget = gtk_gizmo_new ("highlight", NULL, NULL, NULL);
-      gtk_widget_set_parent (priv->highlight_widget, priv->trough_widget);
+      gtk_widget_insert_before (priv->highlight_widget, priv->trough_widget, priv->slider_widget);
 
       update_highlight_position (range);
     }
index 5e9259ec930c485f4271f1b5c15579a1bc9101dc..fa09f95d4be404b1f12049cd2095104df628b86a 100644 (file)
@@ -87,9 +87,9 @@
  * │   ╰── mark
  * ├── [value]
  * ├── trough
- * │   ├── slider
+ * │   ├── [fill]
  * │   ├── [highlight]
- * │   ╰── [fill]
+ * │   ╰── slider
  * ╰── marks.bottom
  *     ├── mark
  *     ┊    ├── indicator