[gtk+/wip/baedert/progressbar: 11/21] window: Make sure the	decoration node stays at the beginning
- From: Timm Bäder <baedert src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gtk+/wip/baedert/progressbar: 11/21] window: Make sure the	decoration node stays at the beginning
 
- Date: Mon, 24 Apr 2017 13:13:01 +0000 (UTC)
 
commit b9b72b92f5b1856d1064641984e755cbf7ccce94
Author: Timm Bäder <mail baedert org>
Date:   Fri Apr 7 20:13:42 2017 +0200
    window: Make sure the decoration node stays at the beginning
    
    Otherwise, the gtk_widget_set_parent call might add the widget node of
    the child before the decoration node.
 gtk/gtkwindow.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 2664506..8becd18 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -726,6 +726,17 @@ gtk_window_measure (GtkWidget      *widget,
     }
 }
 
+static void
+gtk_window_add (GtkContainer *container,
+                GtkWidget    *child)
+{
+  /* Insert the child's css node now at the end so the order wrt. decoration_node is correct */
+  gtk_css_node_insert_before (gtk_widget_get_css_node (GTK_WIDGET (container)),
+                              gtk_widget_get_css_node (child),
+                              NULL);
+
+  GTK_CONTAINER_CLASS (gtk_window_parent_class)->add (container, child);
+}
 
 static void
 gtk_window_class_init (GtkWindowClass *klass)
@@ -773,6 +784,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;
@@ -4009,6 +4021,11 @@ gtk_window_set_titlebar (GtkWindow *window,
 
   gtk_window_enable_csd (window);
   priv->title_box = titlebar;
+  /* Same reason as in gtk_window_add */
+  gtk_css_node_insert_before (gtk_widget_get_css_node (GTK_WIDGET (window)),
+                              gtk_widget_get_css_node (titlebar),
+                              NULL);
+
   gtk_widget_set_parent (priv->title_box, widget);
   if (GTK_IS_HEADER_BAR (titlebar))
     {
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]