Fix borderline cases in tab visibility calculation. (#168105, Carlos

2006-06-04  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtknotebook.c (gtk_notebook_calculate_shown_tabs):
        (gtk_notebook_calc_tabs): Fix borderline cases in tab
        visibility calculation.  (#168105, Carlos Garnacho Parro)
This commit is contained in:
Matthias Clasen 2006-06-05 01:38:49 +00:00 committed by Matthias Clasen
parent 150b52e207
commit 1a98d20c19
3 changed files with 31 additions and 9 deletions

View File

@ -1,5 +1,9 @@
2006-06-04 Matthias Clasen <mclasen@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_calculate_shown_tabs):
(gtk_notebook_calc_tabs): Fix borderline cases in tab
visibility calculation. (#168105, Carlos Garnacho Parro)
* gdk/x11/gdkfont-x11.c (_gdk_font_destroy): Remove the right
XID from the xid table. (#34327, Sampo Savolainen, Tim Janik)

View File

@ -1,5 +1,9 @@
2006-06-04 Matthias Clasen <mclasen@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_calculate_shown_tabs):
(gtk_notebook_calc_tabs): Fix borderline cases in tab
visibility calculation. (#168105, Carlos Garnacho Parro)
* gdk/x11/gdkfont-x11.c (_gdk_font_destroy): Remove the right
XID from the xid table. (#34327, Sampo Savolainen, Tim Janik)

View File

@ -4807,7 +4807,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
&(notebook->focus_tab),
remaining_space, STEP_NEXT);
}
if (*remaining_space <= 0)
{
/* show 1 tab */
@ -4851,9 +4851,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
&(notebook->first_tab), remaining_space,
STEP_PREV);
page = notebook->focus_tab->data;
if (*remaining_space <= 0 &&
!gtk_widget_get_child_visible(page->tab_label))
if (*remaining_space < 0)
{
notebook->first_tab =
gtk_notebook_search_page (notebook, notebook->first_tab,
@ -5457,8 +5455,10 @@ gtk_notebook_calc_tabs (GtkNotebook *notebook,
GtkNotebookPage *page = NULL;
GList *children;
GList *last_list = NULL;
GList *last_calculated_child = NULL;
gboolean pack;
gint tab_pos = get_effective_tab_pos (notebook);
guint real_direction;
if (!start)
return;
@ -5466,7 +5466,9 @@ gtk_notebook_calc_tabs (GtkNotebook *notebook,
children = start;
pack = GTK_NOTEBOOK_PAGE (start)->pack;
if (pack == GTK_PACK_END)
direction = (direction == STEP_PREV) ? STEP_NEXT : STEP_PREV;
real_direction = (direction == STEP_PREV) ? STEP_NEXT : STEP_PREV;
else
real_direction = direction;
while (1)
{
@ -5489,14 +5491,20 @@ gtk_notebook_calc_tabs (GtkNotebook *notebook,
{
*tab_space = - (*tab_space +
page->requisition.width);
if (*tab_space == 0 && direction == STEP_PREV)
children = last_calculated_child;
*end = children;
}
return;
}
last_calculated_child = children;
}
last_list = children;
}
if (direction == STEP_NEXT)
if (real_direction == STEP_NEXT)
children = children->next;
else
children = children->prev;
@ -5519,24 +5527,30 @@ gtk_notebook_calc_tabs (GtkNotebook *notebook,
{
*tab_space = - (*tab_space +
page->requisition.height);
if (*tab_space == 0 && direction == STEP_PREV)
children = last_calculated_child;
*end = children;
}
return;
}
last_calculated_child = children;
}
last_list = children;
}
if (direction == STEP_NEXT)
if (real_direction == STEP_NEXT)
children = children->next;
else
children = children->prev;
}
break;
}
if (direction == STEP_PREV)
if (real_direction == STEP_PREV)
return;
pack = (pack == GTK_PACK_END) ? GTK_PACK_START : GTK_PACK_END;
direction = STEP_PREV;
real_direction = STEP_PREV;
children = last_list;
}
}