Commit 968d257b authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/widgets/gimpwidgets-utils.c (gimp_menu_position) more menus which pop

2003-09-24  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpwidgets-utils.c (gimp_menu_position)
	* app/widgets/gimpcontainerpopup.c (gimp_container_popup_show):
	more menus which pop up correctly with RTL languages.
parent 67f97bbb
2003-09-24 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpwidgets-utils.c (gimp_menu_position)
* app/widgets/gimpcontainerpopup.c (gimp_container_popup_show):
more menus which pop up correctly with RTL languages.
2003-09-24 Sven Neumann <sven@gimp.org>
 
* libgimpwidgets/gimpwidgets.c (gimp_table_attach_aligned): use a
......@@ -424,8 +424,8 @@ gimp_container_popup_show (GimpContainerPopup *popup,
GdkScreen *screen;
gint orig_x;
gint orig_y;
gint scr_width;
gint scr_height;
gint screen_width;
gint screen_height;
gint x;
gint y;
......@@ -443,20 +443,30 @@ gimp_container_popup_show (GimpContainerPopup *popup,
screen = gtk_widget_get_screen (widget);
scr_width = gdk_screen_get_width (screen);
scr_height = gdk_screen_get_height (screen);
screen_width = gdk_screen_get_width (screen);
screen_height = gdk_screen_get_height (screen);
x = orig_x;
y = orig_y + widget->allocation.height;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
{
x = orig_x + widget->allocation.width - requisition.width;
if ((x + requisition.width) > scr_width)
x += (widget->allocation.width - requisition.width);
if (x < 0)
x -= widget->allocation.width - requisition.width;
}
else
{
x = orig_x;
if ((y + requisition.height) > scr_height)
if (x + requisition.width > screen_width)
x += widget->allocation.width - requisition.width;
}
y = orig_y + widget->allocation.height;
if (y + requisition.height > screen_height)
y = orig_y - requisition.height;
gtk_window_move (GTK_WINDOW (popup), x, y);
gtk_widget_show (GTK_WIDGET (popup));
}
......
......@@ -262,17 +262,31 @@ gimp_menu_position (GtkMenu *menu,
screen = gtk_widget_get_screen (GTK_WIDGET (menu));
screen_width = gdk_screen_get_width (screen) + 2;
screen_height = gdk_screen_get_height (screen) + 2;
screen_width = gdk_screen_get_width (screen);
screen_height = gdk_screen_get_height (screen);
*x = CLAMP (pointer_x, 2, MAX (0, screen_width - requisition.width));
*y = CLAMP (pointer_y, 2, MAX (0, screen_height - requisition.height));
if (gtk_widget_get_direction (GTK_WIDGET (menu)) == GTK_TEXT_DIR_RTL)
{
*x = pointer_x - 2 - requisition.width;
if (*x < 0)
*x = pointer_x + 2;
}
else
{
*x = pointer_x + 2;
if (*x + requisition.width > screen_width)
*x = pointer_x - 2 - requisition.width;
}
*y = pointer_y + 2;
*x += (pointer_x <= *x) ? 2 : -2;
*y += (pointer_y <= *y) ? 2 : -2;
if (*y + requisition.height > screen_height)
*y = pointer_y - 2 - requisition.height;
*x = MAX (*x, 0);
*y = MAX (*y, 0);
if (*x < 0) *x = 0;
if (*y < 0) *y = 0;
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment