Index: app/widgets/gimpcontainertreeview-dnd.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpcontainertreeview-dnd.c,v retrieving revision 1.1 diff -u -p -r1.1 gimpcontainertreeview-dnd.c --- app/widgets/gimpcontainertreeview-dnd.c 19 Mar 2003 15:17:13 -0000 1.1 +++ app/widgets/gimpcontainertreeview-dnd.c 9 Oct 2003 20:09:26 -0000 @@ -122,12 +122,45 @@ gimp_container_tree_view_drop_status (Gi return FALSE; } +static guint scroll_timeout_id = 0; +static gint scroll_distance = 0; + +static gboolean +scroll_timeout (gpointer data) +{ + GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (data); + GtkAdjustment *adj; + gdouble new_value; + + adj = gtk_tree_view_get_vadjustment (GTK_TREE_VIEW (tree_view->view)); + + g_print ("scroll_timeout distance = %d\n", scroll_distance); + + if (scroll_distance < 0) + new_value = adj->value - 10; + else + new_value = adj->value + 10; + + new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size); + + gtk_adjustment_set_value (adj, new_value); + + return TRUE; +} + void gimp_container_tree_view_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, GimpContainerTreeView *tree_view) { + if (scroll_timeout_id) + { + g_source_remove (scroll_timeout_id); + scroll_timeout_id = 0; + scroll_distance = 0; + } + gtk_tree_view_unset_rows_drag_dest (tree_view->view); } @@ -141,6 +174,26 @@ gimp_container_tree_view_drag_motion (Gt { GtkTreePath *path; GtkTreeViewDropPosition drop_pos; + + if (y < 20 || y > (widget->allocation.height - 20)) + { + if (y < 20) + scroll_distance = MIN (-y, -1); + else + scroll_distance = MAX (widget->allocation.height - y, 1); + + if (scroll_timeout_id) + g_source_remove (scroll_timeout_id); + + scroll_timeout_id = g_timeout_add (10 * ABS (scroll_distance), + scroll_timeout, tree_view); + } + else if (scroll_timeout_id) + { + g_source_remove (scroll_timeout_id); + scroll_timeout_id = 0; + scroll_distance = 0; + } if (gimp_container_tree_view_drop_status (tree_view, context, x, y, time,