diff options
author | Matthias Clasen <maclas@gmx.de> | 2003-07-08 22:49:35 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2003-07-08 22:49:35 +0000 |
commit | 1f012b369be420b7ba0948ea2a0b4acfa2922bce (patch) | |
tree | fcf0593d865b96084cf5952fe158bb74ed0291be /gtk/gtkcontainer.c | |
parent | 8500d9458ee3f21fef41f199dabe5cdfca0010ed (diff) | |
download | gtk+-1f012b369be420b7ba0948ea2a0b4acfa2922bce.tar.gz |
Consider the text direction when sorting children. (#116540, Soeren
2003-07-09 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcontainer.c (gtk_container_focus_sort_tab): Consider the text direction
when sorting children. (#116540, Soeren Sandmann)
Diffstat (limited to 'gtk/gtkcontainer.c')
-rw-r--r-- | gtk/gtkcontainer.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 44483298d1..53f2472325 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -1570,10 +1570,12 @@ gtk_container_focus (GtkWidget *widget, static gint tab_compare (gconstpointer a, - gconstpointer b) + gconstpointer b, + gpointer data) { const GtkWidget *child1 = a; const GtkWidget *child2 = b; + GtkTextDirection text_direction = GPOINTER_TO_INT (data); gint y1 = child1->allocation.y + child1->allocation.height / 2; gint y2 = child2->allocation.y + child2->allocation.height / 2; @@ -1583,7 +1585,10 @@ tab_compare (gconstpointer a, gint x1 = child1->allocation.x + child1->allocation.width / 2; gint x2 = child2->allocation.x + child2->allocation.width / 2; - return (x1 < x2) ? -1 : ((x1 == x2) ? 0 : 1); + if (text_direction == GTK_TEXT_DIR_RTL) + return (x1 < x2) ? 1 : ((x1 == x2) ? 0 : -1); + else + return (x1 < x2) ? -1 : ((x1 == x2) ? 0 : 1); } else return (y1 < y2) ? -1 : 1; @@ -1595,7 +1600,8 @@ gtk_container_focus_sort_tab (GtkContainer *container, GtkDirectionType direction, GtkWidget *old_focus) { - children = g_list_sort (children, tab_compare); + GtkTextDirection text_direction = gtk_widget_get_direction (GTK_WIDGET (container)); + children = g_list_sort_with_data (children, tab_compare, GINT_TO_POINTER (text_direction)); /* if we are going backwards then reverse the order * of the children. |