[gtk+] GtkMenuButton: improve rtl support



commit d03ceb8b2c61ada3e39c0cd76bde6c8c28a91658
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Sep 21 23:53:11 2012 -0400

    GtkMenuButton: improve rtl support
    
    Show the menu at the side the arrow points to,
    also in rtl locales.
    https://bugzilla.gnome.org/show_bug.cgi?id=684606

 gtk/gtkmenubutton.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index 0edd78b..051b9da 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -336,12 +336,14 @@ menu_position_side_func (GtkMenu       *menu,
   GdkScreen *screen;
   GdkWindow *window;
   GtkAlign align;
+  GtkTextDirection direction;
 
   gtk_widget_get_preferred_size (GTK_WIDGET (priv->popup),
                                  &menu_req, NULL);
 
   window = gtk_widget_get_window (widget);
 
+  direction = gtk_widget_get_direction (widget);
   align = gtk_widget_get_valign (GTK_WIDGET (menu));
   screen = gtk_widget_get_screen (GTK_WIDGET (menu));
   monitor_num = gdk_screen_get_monitor_at_window (screen, window);
@@ -353,7 +355,9 @@ menu_position_side_func (GtkMenu       *menu,
 
   gtk_widget_get_allocation (widget, &allocation);
 
-  if (priv->arrow_type == GTK_ARROW_RIGHT)
+  if ((priv->arrow_type == GTK_ARROW_RIGHT && direction == GTK_TEXT_DIR_LTR) ||
+      (priv->arrow_type == GTK_ARROW_LEFT && direction == GTK_TEXT_DIR_RTL))
+
     {
       if (*x + allocation.width + menu_req.width <= monitor.x + monitor.width)
         *x += allocation.width;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]