Index: gtk/gtkwidget.c
===================================================================
diff -Nup /tmp/tmp /tmp/tmp.2
--- gtk/gtkwidget.c	(revision 13914)
+++ gtk/gtkwidget.c	(revision 13915)
@@ -3419,6 +3419,11 @@ gtk_widget_size_allocate (GtkWidget	*wid
       gtk_widget_invalidate_widget_windows (widget->parent, invalidate);
       gdk_region_destroy (invalidate);
     }
+
+#ifdef MAEMO_CHANGES
+  if (GTK_IS_CONTAINER (widget))
+    _gtk_container_post_size_allocate (GTK_CONTAINER (widget));
+#endif
 }
 
 /**
Index: gtk/gtkcontainer.c
===================================================================
diff -Nup /tmp/tmp /tmp/tmp.2
--- gtk/gtkcontainer.c	(revision 13914)
+++ gtk/gtkcontainer.c	(revision 13915)
@@ -1303,6 +1303,18 @@ gtk_container_get_resize_container (GtkC
   return GTK_IS_RESIZE_CONTAINER (widget) ? (GtkContainer*) widget : NULL;
 }
 
+#ifdef MAEMO_CHANGES
+static GSList *size_allocated_containers = NULL;
+static guint   collect_size_allocated_containers = 0;
+void
+_gtk_container_post_size_allocate (GtkContainer *container)
+{
+  size_allocated_containers = g_slist_prepend (size_allocated_containers, container);
+}
+
+static void container_scroll_focus_adjustments (GtkContainer *container);
+#endif
+
 static gboolean
 gtk_container_idle_sizer (gpointer data)
 {
@@ -1325,9 +1337,49 @@ gtk_container_idle_sizer (gpointer data)
       g_slist_free_1 (slist);
 
       GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
+#ifdef MAEMO_CHANGES
+      collect_size_allocated_containers++;
+#endif
       gtk_container_check_resize (GTK_CONTAINER (widget));
+#ifdef MAEMO_CHANGES
+      collect_size_allocated_containers--;
+#endif
     }
 
+#ifdef MAEMO_CHANGES
+  /* adjust scroll position in all windows that recently resized a container */
+  if (collect_size_allocated_containers == 0)
+    {
+      GtkWidget *last = NULL;
+      GSList *current;
+      /* collect involved toplevels */
+      for (current = size_allocated_containers; current; current = current->next)
+        current->data = gtk_widget_get_toplevel (current->data);
+      /* sort toplevels to allow deduping */
+      size_allocated_containers = g_slist_sort (size_allocated_containers, g_direct_equal);
+      /* adjust focus position on toplevels */
+      for (current = size_allocated_containers; current; current = current->next)
+        if (last != current->data) /* dedup toplevels */
+          {
+            last = current->data;
+            if (GTK_IS_WINDOW (current->data))
+              {
+                GtkWidget *focus = GTK_WINDOW (current->data)->focus_widget;
+                if (focus && !GTK_IS_CONTAINER (focus))
+                  focus = focus->parent;
+                while (focus)
+                  {
+                    /* adjust all focus widget parents that could possibly scroll */
+                    container_scroll_focus_adjustments (GTK_CONTAINER (focus));
+                    focus = focus->parent;
+                  }
+              }
+          }
+      g_slist_free (size_allocated_containers);
+      size_allocated_containers = NULL;
+    }
+#endif
+  
   gdk_window_process_all_updates ();
 
   GDK_THREADS_LEAVE ();
@@ -1686,7 +1738,14 @@ gtk_container_real_set_focus_child (GtkC
 	g_object_ref (container->focus_child);
     }
 
+#ifdef MAEMO_CHANGES
+  container_scroll_focus_adjustments (container);
+}
 
+static void
+container_scroll_focus_adjustments (GtkContainer *container)
+{
+#endif
   /* check for h/v adjustments
    */
   if (container->focus_child)
Index: gtk/gtkcontainer.h
===================================================================
diff -Nup /tmp/tmp /tmp/tmp.2
--- gtk/gtkcontainer.h	(revision 13914)
+++ gtk/gtkcontainer.h	(revision 13915)
@@ -156,6 +156,10 @@ void   gtk_container_set_focus_hadjustme
 					    GtkAdjustment    *adjustment);
 GtkAdjustment *gtk_container_get_focus_hadjustment (GtkContainer *container);
 
+#ifdef MAEMO_CHANGES
+void    _gtk_container_post_size_allocate  (GtkContainer     *container);
+#endif
+
 void    gtk_container_resize_children      (GtkContainer     *container);
 
 GType   gtk_container_child_type	   (GtkContainer     *container);
Index: ChangeLog
===================================================================
diff -Nup /tmp/tmp /tmp/tmp.2
--- ChangeLog	(revision 13914)
+++ ChangeLog	(revision 13915)
@@ -1,3 +1,13 @@
+2007-09-19 13:58:27  Tim Janik  <timj@imendio.com>
+
+	* gtk/gtkcontainer.h, gtk/gtkcontainer.c: added _gtk_container_post_size_allocate()
+	for gtkwidget.c to notify containers about size allocation.
+	adjust scroll area around focussed widget for every window after any container
+	got resized.
+
+	* gtk/gtkwidget.c: call _gtk_container_post_size_allocate() at the
+	end of gtk_widget_size_allocate() to allow containers to adjust to size allocation.
+
 2007-09-19  Kristian Rietveld  <kris@imendio.com>
 
 	* gtk/gtktreeview.c (gtk_tree_view_maybe_begin_dragging_row): add
