From 2ba957364d12984b7810f63431eef1cd05caa4a9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 2 Nov 2015 21:49:10 -0500 Subject: [PATCH] menu: Fix up CSS node ordering Keep the bottom arrow node at the end, where it belongs. --- gtk/gtkmenu.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index ac516f0f45..3bbc9aac2c 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -1444,6 +1444,7 @@ gtk_menu_real_insert (GtkMenuShell *menu_shell, GtkMenu *menu = GTK_MENU (menu_shell); GtkMenuPrivate *priv = menu->priv; AttachInfo *ai = get_attach_info (child); + GtkCssNode *widget_node, *child_node; ai->left_attach = -1; ai->right_attach = -1; @@ -1453,6 +1454,10 @@ gtk_menu_real_insert (GtkMenuShell *menu_shell, if (gtk_widget_get_realized (GTK_WIDGET (menu_shell))) gtk_widget_set_parent_window (child, priv->bin_window); + widget_node = gtk_widget_get_css_node (GTK_WIDGET (menu)); + child_node = gtk_widget_get_css_node (child); + gtk_css_node_insert_before (widget_node, child_node, priv->bottom_arrow); + GTK_MENU_SHELL_CLASS (gtk_menu_parent_class)->insert (menu_shell, child, position); menu_queue_resize (menu); @@ -5186,6 +5191,7 @@ gtk_menu_attach (GtkMenu *menu, { GtkMenuShell *menu_shell; GtkWidget *parent; + GtkCssNode *widget_node, *child_node; g_return_if_fail (GTK_IS_MENU (menu)); g_return_if_fail (GTK_IS_MENU_ITEM (child)); @@ -5207,6 +5213,10 @@ gtk_menu_attach (GtkMenu *menu, menu_shell->priv->children = g_list_append (menu_shell->priv->children, child); + widget_node = gtk_widget_get_css_node (GTK_WIDGET (menu)); + child_node = gtk_widget_get_css_node (child); + gtk_css_node_insert_before (widget_node, child_node, menu->priv->bottom_arrow); + gtk_widget_set_parent (child, GTK_WIDGET (menu)); menu_queue_resize (menu);