forked from AuroraMiddleware/gtk
don't switch submenu opening direction for overlapping reasons if there is
2007-06-01 Michael Natterer <mitch@imendio.com> * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): don't switch submenu opening direction for overlapping reasons if there is even less space on the other side (bug #441863, Tommi Komulainen). svn path=/trunk/; revision=18002
This commit is contained in:
parent
f667ed1996
commit
62c13f0463
@ -1,3 +1,9 @@
|
||||
2007-06-01 Michael Natterer <mitch@imendio.com>
|
||||
|
||||
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): don't switch
|
||||
submenu opening direction for overlapping reasons if there is even
|
||||
less space on the other side (bug #441863, Tommi Komulainen).
|
||||
|
||||
2007-06-01 Michael Natterer <mitch@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdialog.c (response_cb): change fix for #347883
|
||||
|
@ -1174,6 +1174,7 @@ gtk_menu_item_position_menu (GtkMenu *menu,
|
||||
gint horizontal_offset;
|
||||
gint vertical_offset;
|
||||
gint parent_xthickness;
|
||||
gint available_left, available_right;
|
||||
|
||||
g_return_if_fail (menu != NULL);
|
||||
g_return_if_fail (x != NULL);
|
||||
@ -1207,6 +1208,9 @@ gtk_menu_item_position_menu (GtkMenu *menu,
|
||||
|
||||
get_offsets (menu, &horizontal_offset, &vertical_offset);
|
||||
|
||||
available_left = tx - monitor.x;
|
||||
available_right = monitor.x + monitor.width - (tx + widget->allocation.width);
|
||||
|
||||
if (GTK_IS_MENU_BAR (widget->parent))
|
||||
{
|
||||
menu_item->from_menubar = TRUE;
|
||||
@ -1266,7 +1270,8 @@ gtk_menu_item_position_menu (GtkMenu *menu,
|
||||
switch (menu_item->submenu_direction)
|
||||
{
|
||||
case GTK_DIRECTION_LEFT:
|
||||
if ((tx - twidth - parent_xthickness - horizontal_offset) >= monitor.x)
|
||||
if (tx - twidth - parent_xthickness - horizontal_offset >= monitor.x ||
|
||||
available_left >= available_right)
|
||||
tx -= twidth + parent_xthickness + horizontal_offset;
|
||||
else
|
||||
{
|
||||
@ -1276,7 +1281,8 @@ gtk_menu_item_position_menu (GtkMenu *menu,
|
||||
break;
|
||||
|
||||
case GTK_DIRECTION_RIGHT:
|
||||
if ((tx + widget->allocation.width + parent_xthickness + horizontal_offset + twidth) <= monitor.x + monitor.width)
|
||||
if (tx + widget->allocation.width + parent_xthickness + horizontal_offset + twidth <= monitor.x + monitor.width ||
|
||||
available_right >= available_left)
|
||||
tx += widget->allocation.width + parent_xthickness + horizontal_offset;
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user