Merge from trunk:
2007-06-01 Michael Natterer <mitch@imendio.com> Merge from trunk: * 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=/branches/gtk-2-10/; revision=18003
This commit is contained in:
committed by
Michael Natterer
parent
4795ae8e55
commit
7f330fe2dc
@@ -1,3 +1,11 @@
|
||||
2007-06-01 Michael Natterer <mitch@imendio.com>
|
||||
|
||||
Merge from trunk:
|
||||
|
||||
* 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-05-31 Mathias Hasselmann <mathias.hasselmann@gmx.de>
|
||||
|
||||
* gtk/gtkfilechooserdialog.c: Reset the internal response_requested flag,
|
||||
|
||||
@@ -1105,6 +1105,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);
|
||||
@@ -1138,6 +1139,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;
|
||||
@@ -1197,7 +1201,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
|
||||
{
|
||||
@@ -1207,7 +1212,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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user