diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-12-20 22:09:21 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-12-20 22:09:21 +0800 |
commit | c1563eced7a53f75f6dbddbba78a9245723e3b26 (patch) | |
tree | 23966e825f0b282ddb432fb40f6bd19113392f96 /lib | |
parent | 2de282d4de16460ed3d812eedabf1bf843b4603a (diff) | |
download | gsoc2013-epiphany-c1563eced7a53f75f6dbddbba78a9245723e3b26.tar gsoc2013-epiphany-c1563eced7a53f75f6dbddbba78a9245723e3b26.tar.gz gsoc2013-epiphany-c1563eced7a53f75f6dbddbba78a9245723e3b26.tar.bz2 gsoc2013-epiphany-c1563eced7a53f75f6dbddbba78a9245723e3b26.tar.lz gsoc2013-epiphany-c1563eced7a53f75f6dbddbba78a9245723e3b26.tar.xz gsoc2013-epiphany-c1563eced7a53f75f6dbddbba78a9245723e3b26.tar.zst gsoc2013-epiphany-c1563eced7a53f75f6dbddbba78a9245723e3b26.zip |
Fix popup coordinates in RTL mode.
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.
Diffstat (limited to 'lib')
-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)); } |