diff options
Diffstat (limited to 'lib/ephy-gui.c')
-rw-r--r-- | lib/ephy-gui.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c index 293da7c68..de7f7ba86 100644 --- a/lib/ephy-gui.c +++ b/lib/ephy-gui.c @@ -17,7 +17,7 @@ */ #ifdef HAVE_CONFIG_H -#include <config.h> +#include "config.h" #endif #include "ephy-gui.h" @@ -47,16 +47,28 @@ ephy_gui_menu_position_under_widget (GtkMenu *menu, GtkWidget *w = GTK_WIDGET (user_data); gint screen_width, screen_height; GtkRequisition requisition; + gboolean rtl; - gdk_window_get_origin (w->window, x, y); - *x += w->allocation.x; - *y += w->allocation.y + w->allocation.height; + rtl = (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL); + gdk_window_get_origin (w->window, x, y); gtk_widget_size_request (GTK_WIDGET (menu), &requisition); + /* FIXME multihead */ screen_width = gdk_screen_width (); screen_height = gdk_screen_height (); + if (rtl) + { + *x += w->allocation.x + w->allocation.width - requisition.width; + } + else + { + *x += w->allocation.x; + } + + *y += w->allocation.y + w->allocation.height; + *x = CLAMP (*x, 0, MAX (0, screen_width - requisition.width)); *y = CLAMP (*y, 0, MAX (0, screen_height - requisition.height)); } |