[gtk+/wip/baedert/progressbar: 4/5] window: Reorder decoration node to the beginning after adding child



commit 093866248b4aa1e3b52c0a72add24c30978b21cb
Author: Timm Bäder <mail baedert org>
Date:   Fri Apr 7 20:13:42 2017 +0200

    window: Reorder decoration node to the beginning after adding child
    
    Otherwise, the child node gets ordered to the beginning, but we want the
    decoration node to be first.

 gtk/gtkwindow.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 2664506..af0c822 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -726,6 +726,18 @@ gtk_window_measure (GtkWidget      *widget,
     }
 }
 
+static void
+gtk_window_add (GtkContainer *container,
+                GtkWidget    *child)
+{
+  GtkWindowPrivate *priv = gtk_window_get_instance_private (GTK_WINDOW (container));
+  GTK_CONTAINER_CLASS (gtk_window_parent_class)->add (container, child);
+
+  /* Take the decoration node and reorder it to the beginning */
+  gtk_css_node_insert_after (gtk_widget_get_css_node (GTK_WIDGET (container)),
+                             priv->decoration_node,
+                             NULL);
+}
 
 static void
 gtk_window_class_init (GtkWindowClass *klass)
@@ -773,6 +785,7 @@ gtk_window_class_init (GtkWindowClass *klass)
   widget_class->snapshot = gtk_window_snapshot;
   widget_class->queue_draw_region = gtk_window_queue_draw_region;
 
+  container_class->add = gtk_window_add;
   container_class->remove = gtk_window_remove;
   container_class->check_resize = gtk_window_check_resize;
   container_class->forall = gtk_window_forall;


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