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:
parent
72d8deb606
commit
d03ceb8b2c
@ -336,12 +336,14 @@ menu_position_side_func (GtkMenu *menu,
|
|||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
GtkAlign align;
|
GtkAlign align;
|
||||||
|
GtkTextDirection direction;
|
||||||
|
|
||||||
gtk_widget_get_preferred_size (GTK_WIDGET (priv->popup),
|
gtk_widget_get_preferred_size (GTK_WIDGET (priv->popup),
|
||||||
&menu_req, NULL);
|
&menu_req, NULL);
|
||||||
|
|
||||||
window = gtk_widget_get_window (widget);
|
window = gtk_widget_get_window (widget);
|
||||||
|
|
||||||
|
direction = gtk_widget_get_direction (widget);
|
||||||
align = gtk_widget_get_valign (GTK_WIDGET (menu));
|
align = gtk_widget_get_valign (GTK_WIDGET (menu));
|
||||||
screen = gtk_widget_get_screen (GTK_WIDGET (menu));
|
screen = gtk_widget_get_screen (GTK_WIDGET (menu));
|
||||||
monitor_num = gdk_screen_get_monitor_at_window (screen, window);
|
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);
|
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)
|
if (*x + allocation.width + menu_req.width <= monitor.x + monitor.width)
|
||||||
*x += allocation.width;
|
*x += allocation.width;
|
||||||
|
Loading…
Reference in New Issue
Block a user