]> Pileus Git - ~andy/gtk/commitdiff
Fix borderline cases in tab visibility calculation. (#168105, Carlos
authorMatthias Clasen <mclasen@redhat.com>
Mon, 5 Jun 2006 01:38:49 +0000 (01:38 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 5 Jun 2006 01:38:49 +0000 (01:38 +0000)
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)

ChangeLog
ChangeLog.pre-2-10
gtk/gtknotebook.c

index a2e1455b10ad9d20c270b7cfe060e5b030851bf2..528acb438d3cf529d4776b5dc043d038adcd3db7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
 
index a2e1455b10ad9d20c270b7cfe060e5b030851bf2..528acb438d3cf529d4776b5dc043d038adcd3db7 100644 (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)
 
index 12a85bc74b875527e4269a1b9a6f30315c76acaf..9f4d7cd2833da00a205806704cb0e50a4e987de2 100644 (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;
     }
 }