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
This commit is contained in:
Matthias Clasen 2012-09-21 23:53:11 -04:00
parent 72d8deb606
commit d03ceb8b2c

View File

@ -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;