diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2013-02-22 09:14:04 -0500 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2013-02-23 14:53:23 -0500 |
commit | 894f84c623f2e280376be2945159fbf354377913 (patch) | |
tree | 10f14953b0f5ab878213d62002e5cbf27e589c26 /gtk/gtkcombobox.c | |
parent | f4e5d98d1fa1cf88ba910e0f058e665f636f924e (diff) | |
download | gtk+-894f84c623f2e280376be2945159fbf354377913.tar.gz |
Revert "combobox: Don't special-case RTL child positions anymore"
This reverts commit cf712c462d766e32840da21a67708bbf2cbb25a6.
https://bugzilla.gnome.org/show_bug.cgi?id=694451
Diffstat (limited to 'gtk/gtkcombobox.c')
-rw-r--r-- | gtk/gtkcombobox.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 246516fe6e..e7ef489f61 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -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) |