Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.7616
diff -u -p -r1.7616 ChangeLog
--- ChangeLog	20 Mar 2006 05:38:37 -0000	1.7616
+++ ChangeLog	20 Mar 2006 16:57:45 -0000
@@ -1,3 +1,14 @@
+Mon Mar 20 17:49:38 2006  Tim Janik  <timj@imendio.com>
+
+	* gtk/gtkcontainer.h:
+	* gtk/gtkcontainer.c: export function to scroll a focused child into
+	the visible area.
+
+	* gtk/gtkwidget.c:
+	gtk_widget_size_allocate(): adjust scroll position of containers with
+	focussed children upon reallocations by calling
+	gtk_container_scroll_focus_adjustments().
+
 2006-03-20  Matthias Clasen  <mclasen@redhat.com>
 
 	* gtk/gtkmain.c (gtk_get_option_group): Make sure gettext
Index: gtk/gtkcontainer.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcontainer.c,v
retrieving revision 1.141
diff -u -p -r1.141 gtkcontainer.c
--- gtk/gtkcontainer.c	14 Dec 2005 19:39:44 -0000	1.141
+++ gtk/gtkcontainer.c	20 Mar 2006 16:57:46 -0000
@@ -1468,21 +1468,24 @@ gtk_container_real_set_focus_child (GtkC
 	g_object_ref (container->focus_child);
     }
 
+  _gtk_container_scroll_focus_adjustments (container);
+}
 
-  /* check for h/v adjustments
-   */
+void
+_gtk_container_scroll_focus_adjustments (GtkContainer *container)
+{
   if (container->focus_child)
     {
       GtkAdjustment *hadj;
       GtkAdjustment *vadj;
       GtkWidget *focus_child;
       gint x, y;
-
+      
       hadj = g_object_get_qdata (G_OBJECT (container), hadjustment_key_id);   
       vadj = g_object_get_qdata (G_OBJECT (container), vadjustment_key_id);
       if (hadj || vadj) 
 	{
-
+          
 	  focus_child = container->focus_child;
 	  while (GTK_IS_CONTAINER (focus_child) && 
 		 GTK_CONTAINER (focus_child)->focus_child)
@@ -1492,9 +1495,9 @@ gtk_container_real_set_focus_child (GtkC
 	  
 	  gtk_widget_translate_coordinates (focus_child, container->focus_child, 
 					    0, 0, &x, &y);
-
-	   x += container->focus_child->allocation.x;
-	   y += container->focus_child->allocation.y;
+          
+          x += container->focus_child->allocation.x;
+          y += container->focus_child->allocation.y;
 	  
 	  if (vadj)
 	    gtk_adjustment_clamp_page (vadj, y, y + focus_child->allocation.height);
Index: gtk/gtkcontainer.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcontainer.h,v
retrieving revision 1.54
diff -u -p -r1.54 gtkcontainer.h
--- gtk/gtkcontainer.h	20 Mar 2005 07:01:21 -0000	1.54
+++ gtk/gtkcontainer.h	20 Mar 2006 16:57:46 -0000
@@ -143,18 +143,18 @@ gboolean gtk_container_get_focus_chain  
 					 GList         **focusable_widgets);
 void     gtk_container_unset_focus_chain (GtkContainer  *container);
 
-/* Widget-level methods */
+void            gtk_container_set_focus_vadjustment    (GtkContainer   *container,
+							GtkAdjustment  *adjustment);
+GtkAdjustment*  gtk_container_get_focus_vadjustment    (GtkContainer   *container);
+void            gtk_container_set_focus_hadjustment    (GtkContainer   *container,
+							GtkAdjustment  *adjustment);
+GtkAdjustment*  gtk_container_get_focus_hadjustment    (GtkContainer   *container);
+void	       _gtk_container_scroll_focus_adjustments (GtkContainer   *container);
+void            gtk_container_set_focus_child	       (GtkContainer   *container,
+							GtkWidget      *child);
 
 void   gtk_container_set_reallocate_redraws (GtkContainer    *container,
 					     gboolean         needs_redraws);
-void   gtk_container_set_focus_child	   (GtkContainer     *container,
-					    GtkWidget	     *child);
-void   gtk_container_set_focus_vadjustment (GtkContainer     *container,
-					    GtkAdjustment    *adjustment);
-GtkAdjustment *gtk_container_get_focus_vadjustment (GtkContainer *container);
-void   gtk_container_set_focus_hadjustment (GtkContainer     *container,
-					    GtkAdjustment    *adjustment);
-GtkAdjustment *gtk_container_get_focus_hadjustment (GtkContainer *container);
 
 void    gtk_container_resize_children      (GtkContainer     *container);
 
Index: gtk/gtkwidget.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.c,v
retrieving revision 1.427
diff -u -p -r1.427 gtkwidget.c
--- gtk/gtkwidget.c	9 Mar 2006 18:48:38 -0000	1.427
+++ gtk/gtkwidget.c	20 Mar 2006 16:57:47 -0000
@@ -2964,6 +2964,8 @@ gtk_widget_size_allocate (GtkWidget	*wid
       gtk_widget_invalidate_widget_windows (widget->parent, invalidate);
       gdk_region_destroy (invalidate);
     }
+  if (GTK_IS_CONTAINER (widget))
+    _gtk_container_scroll_focus_adjustments (GTK_CONTAINER (widget));
 }
 
 /**
