[gtk+/wip/baedert/drawing: 56/63] entry: Fix node ordering



commit f2a204dfc6655c68c5870ec08d13a1861e8f985f
Author: Timm Bäder <mail baedert org>
Date:   Mon Jun 26 14:50:48 2017 +0200

    entry: Fix node ordering
    
    Fix the icon order

 gtk/gtkentry.c |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index e1bc2ba..4891b53 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -2853,8 +2853,8 @@ update_node_ordering (GtkEntry *entry)
 {
   GtkEntryPrivate *priv = entry->priv;
   EntryIconInfo *icon_info;
-  GtkEntryIconPosition icon_pos;
-  GtkCssNode *sibling, *parent;
+  GtkEntryIconPosition first_icon_pos, second_icon_pos;
+  GtkCssNode *parent;
 
   if (priv->progress_widget)
     {
@@ -2864,21 +2864,25 @@ update_node_ordering (GtkEntry *entry)
     }
 
   if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
-    icon_pos = GTK_ENTRY_ICON_SECONDARY;
+    {
+      first_icon_pos = GTK_ENTRY_ICON_SECONDARY;
+      second_icon_pos = GTK_ENTRY_ICON_PRIMARY;
+    }
   else
-    icon_pos = GTK_ENTRY_ICON_PRIMARY;
+    {
+      first_icon_pos = GTK_ENTRY_ICON_PRIMARY;
+      second_icon_pos = GTK_ENTRY_ICON_SECONDARY;
+    }
 
-  icon_info = priv->icons[icon_pos];
+  parent = gtk_widget_get_css_node (GTK_WIDGET (entry));
+
+  icon_info = priv->icons[first_icon_pos];
   if (icon_info)
-    {
-      GtkCssNode *node;
+    gtk_css_node_insert_after (parent, gtk_widget_get_css_node (icon_info->widget), NULL);
 
-      node = gtk_widget_get_css_node (icon_info->widget);
-      parent = gtk_css_node_get_parent (node);
-      sibling = gtk_css_node_get_first_child (parent);
-      if (node != sibling)
-        gtk_css_node_insert_before (parent, node, sibling);
-    }
+  icon_info = priv->icons[second_icon_pos];
+  if (icon_info)
+    gtk_css_node_insert_before (parent, gtk_widget_get_css_node (icon_info->widget), NULL);
 }
 
 static EntryIconInfo*


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