Revert "combobox: Don't special-case RTL child positions anymore"

This reverts commit cf712c462d.

https://bugzilla.gnome.org/show_bug.cgi?id=694451
This commit is contained in:
Cosimo Cecchi 2013-02-22 09:14:04 -05:00
parent f4e5d98d1f
commit 894f84c623

View 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)