From 1004bd8b600be94be4abc27f0772eb6848558c95 Mon Sep 17 00:00:00 2001 From: Thomas Thurman Date: Mon, 4 Jun 2007 12:50:50 +0000 Subject: [PATCH] fix label layout for RTL languages. Closes #433400. 2007-06-04 Thomas Thurman * src/metaaccellabel.c (meta_accel_label_expose_event): fix label layout for RTL languages. Closes #433400. svn path=/trunk/; revision=3228 --- ChangeLog | 5 +++++ src/metaaccellabel.c | 26 ++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02e983e75..c312bfc46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-06-04 Thomas Thurman + + * src/metaaccellabel.c (meta_accel_label_expose_event): fix + label layout for RTL languages. Closes #433400. + 2007-06-03 Thomas Thurman * src/frames.c (meta_frames_ensure_layout): Pango layout for diff --git a/src/metaaccellabel.c b/src/metaaccellabel.c index 0c2a76d3b..cdc86369c 100644 --- a/src/metaaccellabel.c +++ b/src/metaaccellabel.c @@ -271,15 +271,33 @@ meta_accel_label_expose_event (GtkWidget *widget, if (widget->allocation.width >= widget->requisition.width + ac_width) { - int x; - int y; + GtkTextDirection direction = gtk_widget_get_direction (widget); + gint x; + gint y; + if (direction == GTK_TEXT_DIR_RTL) + { + widget->allocation.x += ac_width; + } widget->allocation.width -= ac_width; + if (GTK_WIDGET_CLASS (parent_class)->expose_event) GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); - widget->allocation.width += ac_width; - x = widget->allocation.x + widget->allocation.width - misc->xpad - ac_width; + if (direction == GTK_TEXT_DIR_RTL) + { + widget->allocation.x -= ac_width; + } + widget->allocation.width += ac_width; + + if (direction == GTK_TEXT_DIR_RTL) + { + x = widget->allocation.x + misc->xpad; + } + else + { + x = widget->allocation.x + widget->allocation.width - misc->xpad - ac_width; + } y = (widget->allocation.y * (1.0 - misc->yalign) + (widget->allocation.y + widget->allocation.height -