diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/ephy-gui.c | 20 |
2 files changed, 22 insertions, 4 deletions
@@ -1,5 +1,11 @@ 2003-12-20 Christian Persch <chpe@cvs.gnome.org> + * lib/ephy-gui.c: (ephy_gui_menu_position_under_widget): + + Fix popup coordinates in RTL mode. + +2003-12-20 Christian Persch <chpe@cvs.gnome.org> + * data/glade/prefs-dialog.glade: (add_language_dialog): Set the label's mnemonic widget. 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)); } |