]> Pileus Git - ~andy/gtk/commitdiff
Revert "combobox: Don't special-case RTL child positions anymore"
authorCosimo Cecchi <cosimoc@gnome.org>
Fri, 22 Feb 2013 14:14:04 +0000 (09:14 -0500)
committerCosimo Cecchi <cosimoc@gnome.org>
Sat, 23 Feb 2013 19:53:23 +0000 (14:53 -0500)
This reverts commit cf712c462d766e32840da21a67708bbf2cbb25a6.

https://bugzilla.gnome.org/show_bug.cgi?id=694451

gtk/gtkcombobox.c

index 246516fe6ea644e6c6850be51c2b8e50649f7fe8..e7ef489f61fa3c686d7aa0d649140a956cf7d87f 100644 (file)
@@ -468,6 +468,8 @@ static void     gtk_combo_box_get_preferred_height_for_width (GtkWidget    *widg
                                                               gint         *natural_size);
 static GtkWidgetPath *gtk_combo_box_get_path_for_child       (GtkContainer *container,
                                                               GtkWidget    *child);
+static void     gtk_combo_box_direction_changed              (GtkWidget    *widget,
+                                                              GtkTextDirection  previous_direction);
 
 G_DEFINE_TYPE_WITH_CODE (GtkComboBox, gtk_combo_box, GTK_TYPE_BIN,
                          G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT,
@@ -508,6 +510,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
   widget_class->get_preferred_height_for_width = gtk_combo_box_get_preferred_height_for_width;
   widget_class->get_preferred_width_for_height = gtk_combo_box_get_preferred_width_for_height;
   widget_class->destroy = gtk_combo_box_destroy;
+  widget_class->direction_changed = gtk_combo_box_direction_changed;
 
   object_class = (GObjectClass *)klass;
   object_class->constructor = gtk_combo_box_constructor;
@@ -1379,6 +1382,27 @@ gtk_combo_box_button_state_flags_changed (GtkWidget     *widget,
   gtk_widget_queue_draw (widget);
 }
 
+static void
+gtk_combo_box_invalidate_order_foreach (GtkWidget *widget)
+{
+  _gtk_widget_invalidate_style_context (widget, GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
+}
+
+static void
+gtk_combo_box_invalidate_order (GtkComboBox *combo_box)
+{
+  gtk_container_forall (GTK_CONTAINER (combo_box),
+                        (GtkCallback) gtk_combo_box_invalidate_order_foreach,
+                        NULL);
+}
+
+static void
+gtk_combo_box_direction_changed (GtkWidget        *widget,
+                                 GtkTextDirection  previous_direction)
+{
+  gtk_combo_box_invalidate_order (GTK_COMBO_BOX (widget));
+}
+
 static GtkWidgetPath *
 gtk_combo_box_get_path_for_child (GtkContainer *container,
                                   GtkWidget    *child)
@@ -1407,6 +1431,9 @@ gtk_combo_box_get_path_for_child (GtkContainer *container,
       if (widget && gtk_widget_get_visible (widget))
         visible_children = g_list_prepend (visible_children, widget);
 
+      if (gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL)
+        visible_children = g_list_reverse (visible_children);
+
       pos = 0;
 
       for (l = visible_children; l; l = l->next)