forked from AuroraMiddleware/gtk
menu: Yeah cool, you're the last child
Nobody cares.
This commit is contained in:
parent
b1b12a239f
commit
dba1926a42
@ -3565,17 +3565,15 @@ static gboolean
|
|||||||
compute_child_offset (GtkMenu *menu,
|
compute_child_offset (GtkMenu *menu,
|
||||||
GtkWidget *menu_item,
|
GtkWidget *menu_item,
|
||||||
gint *offset,
|
gint *offset,
|
||||||
gint *height,
|
gint *height)
|
||||||
gboolean *is_last_child)
|
|
||||||
{
|
{
|
||||||
GtkMenuPrivate *priv = menu->priv;
|
GtkMenuPrivate *priv = menu->priv;
|
||||||
gint item_top_attach;
|
gint item_top_attach;
|
||||||
gint item_bottom_attach;
|
|
||||||
gint child_offset = 0;
|
gint child_offset = 0;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
get_effective_child_attach (menu_item, NULL, NULL,
|
get_effective_child_attach (menu_item, NULL, NULL,
|
||||||
&item_top_attach, &item_bottom_attach);
|
&item_top_attach, NULL);
|
||||||
|
|
||||||
/* there is a possibility that we get called before _size_request,
|
/* there is a possibility that we get called before _size_request,
|
||||||
* so check the height table for safety.
|
* so check the height table for safety.
|
||||||
@ -3589,8 +3587,6 @@ compute_child_offset (GtkMenu *menu,
|
|||||||
for (i = 0; i < item_top_attach; i++)
|
for (i = 0; i < item_top_attach; i++)
|
||||||
child_offset += priv->heights[i];
|
child_offset += priv->heights[i];
|
||||||
|
|
||||||
if (is_last_child)
|
|
||||||
*is_last_child = (item_bottom_attach == gtk_menu_get_n_rows (menu));
|
|
||||||
if (offset)
|
if (offset)
|
||||||
*offset = child_offset;
|
*offset = child_offset;
|
||||||
if (height)
|
if (height)
|
||||||
@ -3610,14 +3606,12 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
|
|||||||
gint height;
|
gint height;
|
||||||
gint y;
|
gint y;
|
||||||
gint arrow_height;
|
gint arrow_height;
|
||||||
gboolean last_child = 0;
|
|
||||||
|
|
||||||
/* We need to check if the selected item fully visible.
|
/* We need to check if the selected item fully visible.
|
||||||
* If not we need to scroll the menu so that it becomes fully
|
* If not we need to scroll the menu so that it becomes fully
|
||||||
* visible.
|
* visible.
|
||||||
*/
|
*/
|
||||||
if (compute_child_offset (menu, menu_item,
|
if (compute_child_offset (menu, menu_item, &child_offset, &child_height))
|
||||||
&child_offset, &child_height, &last_child))
|
|
||||||
{
|
{
|
||||||
y = priv->scroll_offset;
|
y = priv->scroll_offset;
|
||||||
height = gdk_surface_get_height (gtk_widget_get_surface (widget));
|
height = gdk_surface_get_height (gtk_widget_get_surface (widget));
|
||||||
@ -3952,7 +3946,7 @@ gtk_menu_real_move_scroll (GtkMenu *menu,
|
|||||||
gint child_height;
|
gint child_height;
|
||||||
|
|
||||||
if (compute_child_offset (menu, menu_shell->priv->active_menu_item,
|
if (compute_child_offset (menu, menu_shell->priv->active_menu_item,
|
||||||
&child_offset, &child_height, NULL))
|
&child_offset, &child_height))
|
||||||
child_offset += child_height / 2;
|
child_offset += child_height / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user