



*** ../../gtk+-2.18.4.org/gtk/gtkstyle.c	2009-12-01 04:21:24.000000000 +0100
--- gtkstyle.c	2010-01-11 22:01:37.000000000 +0100
***************
*** 3514,3528 ****
        if (area)
  	gdk_gc_set_clip_rectangle (gc, area);
  
!       gdk_draw_rectangle (window, gc, TRUE,
!                           x, y, width, height);
        if (area)
  	gdk_gc_set_clip_rectangle (gc, NULL);
      }
    else
      gtk_style_apply_default_background (style, window,
!                                         widget && !GTK_WIDGET_NO_WINDOW (widget),
!                                         state_type, area, x, y, width, height);
  
    if (is_spinbutton_box)
      {
--- 3514,3529 ----
        if (area)
  	gdk_gc_set_clip_rectangle (gc, area);
  
!       if (!detail || strncmp (detail, "cell", 4) != 0)
! 	gdk_draw_rectangle (window, gc, TRUE,
! 			    x, y, width, height);
        if (area)
  	gdk_gc_set_clip_rectangle (gc, NULL);
      }
    else
      gtk_style_apply_default_background (style, window,
! 				        widget && !GTK_WIDGET_NO_WINDOW (widget),
! 				        state_type, area, x, y, width, height);
  
    if (is_spinbutton_box)
      {




*** ../../gtk+-2.18.4.org/gtk/gtktreeprivate.h	2009-12-01 04:21:24.000000000 +0100
--- gtktreeprivate.h	2010-01-11 21:34:15.000000000 +0100
***************
*** 105,110 ****
--- 105,113 ----
    GtkAdjustment *hadjustment;
    GtkAdjustment *vadjustment;
  
+   GtkTreeViewBgScroll bgscroll_hor;
+   GtkTreeViewBgScroll bgscroll_ver;
+ 
    GdkWindow *bin_window;
    GdkWindow *header_window;
    GdkWindow *drag_window;
***************
*** 115,125 ****
--- 118,131 ----
    GtkTreeRowReference *last_button_press_2;
  
    /* bin_window offset */
+   GList *first_column;
    GtkTreeRowReference *top_row;
+   gint first_column_dx;
    gint top_row_dy;
    /* dy == y pos of top_row + top_row_dy */
    /* we cache it for simplicity of the code */
    gint dy;
+   gint dx;
    gint drag_column_x;
    gint cursor_offset;
  
***************
*** 176,181 ****
--- 182,192 ----
    GtkTreeViewDropPosition drag_dest_pos;
    guint open_dest_timeout;
  
+ #ifdef IMPLEMENT_DRAGWINDOW_ANCHOR
+   gboolean dragwindow_anchor_set;
+   GtkAnchorType dragwindow_anchor;
+ #endif
+ 
    gint pressed_button;
    gint press_start_x;
    gint press_start_y;




*** ../../gtk+-2.18.4.org/gtk/gtktreeview.c	2009-12-01 04:21:24.000000000 +0100
--- gtktreeview.c	2010-01-11 21:43:14.000000000 +0100
***************
*** 17,23 ****
   * Boston, MA 02111-1307, USA.
   */
  
- 
  #include "config.h"
  #include <string.h>
  #include <gdk/gdkkeysyms.h>
--- 17,22 ----
***************
*** 63,73 ****
  #define BACKGROUND_HEIGHT(node) (GTK_RBNODE_GET_HEIGHT (node))
  #define CELL_HEIGHT(node, separator) ((BACKGROUND_HEIGHT (node)) - (separator))
  
  /* Translate from bin_window coordinates to rbtree (tree coordinates) and
   * vice versa.
   */
! #define TREE_WINDOW_Y_TO_RBTREE_Y(tree_view,y) ((y) + tree_view->priv->dy)
! #define RBTREE_Y_TO_TREE_WINDOW_Y(tree_view,y) ((y) - tree_view->priv->dy)
  
  /* This is in bin_window coordinates */
  #define BACKGROUND_FIRST_PIXEL(tree_view,tree,node) (RBTREE_Y_TO_TREE_WINDOW_Y (tree_view, _gtk_rbtree_node_find_offset ((tree), (node))))
--- 62,137 ----
  #define BACKGROUND_HEIGHT(node) (GTK_RBNODE_GET_HEIGHT (node))
  #define CELL_HEIGHT(node, separator) ((BACKGROUND_HEIGHT (node)) - (separator))
  
+ gint rem (gint x, gint y)
+   {
+     gint result=x;
+ 
+     while (result<=-y) result+=y;
+     while (result>=y) result-=y;
+ 
+     return result;
+   }
+ gint Y_OFFSET(GtkTreeView* tree_view)
+   {
+     gint pm_height;
+ 
+     if (GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] &&
+ 	GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] != (GdkPixmap*) GDK_PARENT_RELATIVE)
+       gdk_drawable_get_size (GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)],
+ 			     NULL, &pm_height);
+     else
+       pm_height=-1;
+     
+     if (tree_view->priv->bgscroll_ver != GTK_TREE_VIEW_BG_SCROLL_MOVING)
+       return 0;
+     else
+       return ((pm_height==-1)?0:rem(tree_view->priv->vadjustment->value+pm_height, pm_height));
+   }
+ gint X_OFFSET(GtkTreeView* tree_view, GtkTreeViewColumn** column)
+   {  
+     gint width;
+     gint offset; 
+     gboolean rtl; 
+     GList *list;
+ 
+     rtl = (gtk_widget_get_direction (GTK_WIDGET(tree_view)) == GTK_TEXT_DIR_RTL);
+ 
+     offset = 0; 
+     list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
+     if (list) 
+       { 
+         *column = list->data ;
+         width = gtk_tree_view_column_get_width(*column); 
+       } 
+     else 
+       { 
+          *column=NULL;
+          width=-1;
+       } 
+ 
+     while ((width>=0) && (offset + width <= tree_view->priv->dx)) {
+       offset += width;
+       list =  (rtl ? list->prev : list->next);
+       if (list) 
+ 	{
+ 	  *column = list->data;
+           width = gtk_tree_view_column_get_width(*column);
+ 	}
+       else
+ 	{
+ 	  *column = NULL;
+           width=-1;
+ 	}
+     };
+     return offset - tree_view->priv->dx;
+   };
+ 
+ 
  /* Translate from bin_window coordinates to rbtree (tree coordinates) and
   * vice versa.
   */
! #define TREE_WINDOW_Y_TO_RBTREE_Y(tree_view,y) ((y) + tree_view->priv->dy - Y_OFFSET(tree_view))
! #define RBTREE_Y_TO_TREE_WINDOW_Y(tree_view,y) ((y) - tree_view->priv->dy + Y_OFFSET(tree_view))
  
  /* This is in bin_window coordinates */
  #define BACKGROUND_FIRST_PIXEL(tree_view,tree,node) (RBTREE_Y_TO_TREE_WINDOW_Y (tree_view, _gtk_rbtree_node_find_offset ((tree), (node))))
***************
*** 76,86 ****
--- 140,162 ----
  #define ROW_HEIGHT(tree_view,height) \
    ((height > 0) ? (height) : (tree_view)->priv->expander_size)
  
+ #define SET_BACKGROUND(widget,tree_view,detail)	     \
+   if ((GdkPixmap*) GDK_PARENT_RELATIVE == widget->style->bg_pixmap[widget->state]) { \
+     gdk_window_set_back_pixmap (widget->window, NULL, TRUE); \
+     gdk_window_set_back_pixmap (tree_view->priv->bin_window, NULL, TRUE); \
+   } else if (widget->style->rc_style && widget->style->rc_style->bg_pixmap_name[widget->state]) { \
+     gdk_window_set_back_pixmap (widget->window, NULL, FALSE); \
+     gdk_window_set_back_pixmap (tree_view->priv->bin_window, widget->style->bg_pixmap[widget->state], FALSE); \
+   } else { \
+     gdk_window_set_back_pixmap (widget->window, NULL, FALSE); \
+     gdk_window_set_background (tree_view->priv->bin_window, &widget->style->base[widget->state]); \
+   }
  
  typedef struct _GtkTreeViewChild GtkTreeViewChild;
  struct _GtkTreeViewChild
  {
    GtkWidget *widget;
+   gint node_offset;
    gint x;
    gint y;
    gint width;
***************
*** 144,150 ****
    PROP_RUBBER_BANDING,
    PROP_ENABLE_GRID_LINES,
    PROP_ENABLE_TREE_LINES,
!   PROP_TOOLTIP_COLUMN
  };
  
  /* object signals */
--- 220,233 ----
    PROP_RUBBER_BANDING,
    PROP_ENABLE_GRID_LINES,
    PROP_ENABLE_TREE_LINES,
!   PROP_TOOLTIP_COLUMN,
!   PROP_BGSCROLL_HOR,
!   PROP_BGSCROLL_VER
! #ifdef IMPLEMENT_DRAGWINDOW_ANCHOR
!   ,
!   PROP_ENABLE_DRAGWINDOW_ANCHOR,
!   PROP_DRAGWINDOW_ANCHOR
! #endif
  };
  
  /* object signals */
***************
*** 301,306 ****
--- 384,393 ----
  static gboolean presize_handler_callback (gpointer     data);
  static void     install_presize_handler  (GtkTreeView *tree_view);
  static void     install_scroll_sync_handler (GtkTreeView *tree_view);
+ static void     gtk_tree_view_set_first_column   (GtkTreeView *tree_view,
+ 					     GtkTreeViewColumn *column,
+ 					     gint         offset);
+ static void	gtk_tree_view_dx_to_first_column (GtkTreeView *tree_view);
  static void     gtk_tree_view_set_top_row   (GtkTreeView *tree_view,
  					     GtkTreePath *path,
  					     gint         offset);
***************
*** 580,585 ****
--- 667,690 ----
                                                          GTK_PARAM_READWRITE));
  
    g_object_class_install_property (o_class,
+                                    PROP_BGSCROLL_HOR,
+                                    g_param_spec_enum ("bgscroll-hor",
+ 						      P_("Background Scroll Horizontal"),
+ 						      P_("Define the horizontol scrolling policy for background placement"),
+ 						      GTK_TYPE_TREE_VIEW_BG_SCROLL,
+  						      GTK_TREE_VIEW_BG_SCROLL_DEFAULT,
+ 						      GTK_PARAM_READWRITE));
+ 
+   g_object_class_install_property (o_class,
+                                    PROP_BGSCROLL_VER,
+                                    g_param_spec_enum ("bgscroll-ver",
+ 						      P_("Background Scroll Vertical"),
+ 						      P_("Define the vertical scrolling policy for background placement"),
+ 						      GTK_TYPE_TREE_VIEW_BG_SCROLL,
+  						      GTK_TREE_VIEW_BG_SCROLL_DEFAULT,
+ 						      GTK_PARAM_READWRITE));
+ 
+   g_object_class_install_property (o_class,
                                     PROP_HEADERS_VISIBLE,
                                     g_param_spec_boolean ("headers-visible",
  							 P_("Headers Visible"),
***************
*** 764,769 ****
--- 869,901 ----
  						       -1,
  						       GTK_PARAM_READWRITE));
  
+ #ifdef IMPLEMENT_DRAGWINDOW_ANCHOR
+   /**
+    * GtkTreeView:dragwindow-anchor:
+    *
+    * The anchor point of the drag window. 
+    *
+    * Since: 2.20
+    */
+     g_object_class_install_property (o_class,
+ 				     PROP_ENABLE_DRAGWINDOW_ANCHOR,
+ 				     g_param_spec_boolean ("enable-dragwindow-anchor",
+ 							   P_("Allow dragwindow anchor"),
+ 							   P_("Use a anchor point for the drag window"),
+ 							   FALSE,
+ 							   GTK_PARAM_READWRITE));
+ 
+     g_object_class_install_property (o_class,
+ 				     PROP_DRAGWINDOW_ANCHOR,
+ 				     g_param_spec_enum ("dragwindow-anchor",
+ 							P_("Dragwindow anchor"),
+ 							P_("The anchor point of the drag window"),
+ 							GTK_TYPE_ANCHOR_TYPE,
+ 							GTK_ANCHOR_CENTER,
+ 							GTK_PARAM_READWRITE));
+ 
+ #endif
+ 
    /* Style properties */
  #define _TREE_VIEW_EXPANDER_SIZE 12
  #define _TREE_VIEW_VERTICAL_SEPARATOR 2
***************
*** 1333,1338 ****
--- 1465,1475 ----
  
    /* We need some padding */
    tree_view->priv->dy = 0;
+   tree_view->priv->dx = 0;
+ 
+   tree_view->priv->bgscroll_hor = GTK_TREE_VIEW_BG_SCROLL_DEFAULT;
+   tree_view->priv->bgscroll_ver = GTK_TREE_VIEW_BG_SCROLL_DEFAULT;
+ 
    tree_view->priv->cursor_offset = 0;
    tree_view->priv->n_columns = 0;
    tree_view->priv->header_height = 1;
***************
*** 1372,1377 ****
--- 1509,1519 ----
    tree_view->priv->tooltip_column = -1;
  
    tree_view->priv->post_validation_flag = FALSE;
+ 
+ #ifdef IMPLEMENT_DRAGWINDOW_ANCHOR
+   tree_view->priv->dragwindow_anchor_set = FALSE;
+   tree_view->priv->dragwindow_anchor = GTK_ANCHOR_CENTER;
+ #endif
  }
***************
*** 1448,1453 ****
--- 1590,1609 ----
      case PROP_TOOLTIP_COLUMN:
        gtk_tree_view_set_tooltip_column (tree_view, g_value_get_int (value));
        break;
+     case PROP_BGSCROLL_HOR:
+       gtk_tree_view_set_bg_scrolling (tree_view, g_value_get_enum (value), GTK_TREE_VIEW_BG_SCROLL_NONE);
+       break;
+     case PROP_BGSCROLL_VER:
+       gtk_tree_view_set_bg_scrolling (tree_view, GTK_TREE_VIEW_BG_SCROLL_NONE, g_value_get_enum (value));
+       break;
+ #ifdef IMPLEMENT_DRAGWINDOW_ANCHOR
+     case PROP_ENABLE_DRAGWINDOW_ANCHOR:
+       gtk_tree_view_set_enable_dragwindow_anchor (tree_view, g_value_get_boolean(value));
+       break;
+     case PROP_DRAGWINDOW_ANCHOR:
+       gtk_tree_view_set_dragwindow_anchor (tree_view, g_value_get_enum(value));
+       break;
+ #endif
      default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        break;
***************
*** 1523,1528 ****
--- 1679,1702 ----
      case PROP_TOOLTIP_COLUMN:
        g_value_set_int (value, tree_view->priv->tooltip_column);
        break;
+     case PROP_BGSCROLL_HOR:
+       g_value_set_enum (value, tree_view->priv->bgscroll_hor);
+       break;
+     case PROP_BGSCROLL_VER:
+       g_value_set_enum (value, tree_view->priv->bgscroll_ver);
+       break;
+ #ifdef IMPLEMENT_DRAGWINDOW_ANCHOR
+     case PROP_ENABLE_DRAGWINDOW_ANCHOR:
+       g_value_set_boolean(value, gtk_tree_view_get_enable_dragwindow_anchor (tree_view));
+       break;
+     case PROP_DRAGWINDOW_ANCHOR:
+       {
+ 	GtkAnchorType anchor;
+ 	gtk_tree_view_get_dragwindow_anchor (tree_view, &anchor);
+         g_value_set_enum (value, anchor);
+       }
+       break;
+ #endif
      default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        break;
***************
*** 1770,1775 ****
--- 1944,1950 ----
    GList *tmp_list;
    GdkWindowAttr attributes;
    gint attributes_mask;
+   gint pm_height;
  
    GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
  
***************
*** 1790,1800 ****
  				   &attributes, attributes_mask);
    gdk_window_set_user_data (widget->window, widget);
  
    /* Make the window for the tree */
    attributes.x = 0;
    attributes.y = TREE_VIEW_HEADER_HEIGHT (tree_view);
    attributes.width = MAX (tree_view->priv->width, widget->allocation.width);
!   attributes.height = widget->allocation.height;
    attributes.event_mask = (GDK_EXPOSURE_MASK |
                             GDK_SCROLL_MASK |
                             GDK_POINTER_MOTION_MASK |
--- 1965,1984 ----
  				   &attributes, attributes_mask);
    gdk_window_set_user_data (widget->window, widget);
  
+   if (GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] &&
+       GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)]  != (GdkPixmap*) GDK_PARENT_RELATIVE)
+     {
+       gdk_drawable_get_size (widget->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)],
+ 			     NULL, &pm_height);
+     }
+   else
+     pm_height=0;
+ 
    /* Make the window for the tree */
    attributes.x = 0;
    attributes.y = TREE_VIEW_HEADER_HEIGHT (tree_view);
    attributes.width = MAX (tree_view->priv->width, widget->allocation.width);
!   attributes.height = widget->allocation.height+pm_height; /* we need the pm_height for scrolling */
    attributes.event_mask = (GDK_EXPOSURE_MASK |
                             GDK_SCROLL_MASK |
                             GDK_POINTER_MOTION_MASK |
***************
*** 1827,1835 ****
  
    /* Add them all up. */
    widget->style = gtk_style_attach (widget->style, widget->window);
!   gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
!   gdk_window_set_background (tree_view->priv->bin_window, &widget->style->base[widget->state]);
!   gtk_style_set_background (widget->style, tree_view->priv->header_window, GTK_STATE_NORMAL);
  
    tmp_list = tree_view->priv->children;
    while (tmp_list)
--- 2011,2018 ----
  
    /* Add them all up. */
    widget->style = gtk_style_attach (widget->style, widget->window);
!   SET_BACKGROUND(widget, tree_view, "realize");
!   gtk_style_set_background (widget->style, tree_view->priv->header_window, GTK_STATE_NORMAL); \
  
    tmp_list = tree_view->priv->children;
    while (tmp_list)
***************
*** 1847,1853 ****
    gtk_tree_view_set_grid_lines (tree_view, tree_view->priv->grid_lines);
    gtk_tree_view_set_enable_tree_lines (tree_view, tree_view->priv->tree_lines_enabled);
  
!   install_presize_handler (tree_view); 
  }
  
  static void
--- 2030,2036 ----
    gtk_tree_view_set_grid_lines (tree_view, tree_view->priv->grid_lines);
    gtk_tree_view_set_enable_tree_lines (tree_view, tree_view->priv->tree_lines_enabled);
  
!   install_presize_handler (tree_view);
  }
  
  static void
***************
*** 2163,2169 ****
    gboolean column_changed = FALSE;
    gboolean rtl;
    gboolean update_expand;
!   
    tree_view = GTK_TREE_VIEW (widget);
  
    for (last_column = g_list_last (tree_view->priv->columns);
--- 2346,2352 ----
    gboolean column_changed = FALSE;
    gboolean rtl;
    gboolean update_expand;
! 
    tree_view = GTK_TREE_VIEW (widget);
  
    for (last_column = g_list_last (tree_view->priv->columns);
***************
*** 2212,2218 ****
    if (!update_expand)
      {
        extra = tree_view->priv->last_extra_space;
!       extra_for_last = MAX (widget->allocation.width - full_requested_width - extra, 0);
      }
    else
      {
--- 2395,2401 ----
    if (!update_expand)
      {
        extra = tree_view->priv->last_extra_space;
!       extra_for_last = MAX (widget->allocation.width - full_requested_width - extra + tree_view->priv->first_column_dx, 0);
      }
    else
      {
***************
*** 2299,2325 ****
        allocation.width = column->width;
        width += column->width;
  
!       if (column->width > old_width)
          column_changed = TRUE;
  
        gtk_widget_size_allocate (column->button, &allocation);
  
!       if (column->window)
  	gdk_window_move_resize (column->window,
                                  allocation.x + (rtl ? 0 : allocation.width) - TREE_VIEW_DRAG_WIDTH/2,
  				allocation.y,
                                  TREE_VIEW_DRAG_WIDTH, allocation.height);
      }
  
    /* We change the width here.  The user might have been resizing columns,
     * so the total width of the tree view changes.
     */
    tree_view->priv->width = width;
-   if (width_changed)
-     *width_changed = TRUE;
- 
    if (column_changed)
!     gtk_widget_queue_draw (GTK_WIDGET (tree_view));
  }
  
  
--- 2482,2511 ----
        allocation.width = column->width;
        width += column->width;
  
!       if (column->width != old_width)
          column_changed = TRUE;
  
        gtk_widget_size_allocate (column->button, &allocation);
  
!       if (column->window) {
  	gdk_window_move_resize (column->window,
                                  allocation.x + (rtl ? 0 : allocation.width) - TREE_VIEW_DRAG_WIDTH/2,
  				allocation.y,
                                  TREE_VIEW_DRAG_WIDTH, allocation.height);
+       }
      }
  
    /* We change the width here.  The user might have been resizing columns,
     * so the total width of the tree view changes.
     */
    tree_view->priv->width = width;
    if (column_changed)
!     {
!       if (width_changed)
!         *width_changed = TRUE;
! 
!       gtk_widget_queue_draw (GTK_WIDGET (tree_view));
!     }
  }
  
  
***************
*** 2331,2337 ****
    GList *tmp_list;
    gboolean width_changed = FALSE;
    gint old_width = widget->allocation.width;
! 
    if (allocation->width != widget->allocation.width)
      width_changed = TRUE;
  
--- 2517,2524 ----
    GList *tmp_list;
    gboolean width_changed = FALSE;
    gint old_width = widget->allocation.width;
!   gboolean early_repaint = FALSE;
!  
    if (allocation->width != widget->allocation.width)
      width_changed = TRUE;
  
***************
*** 2389,2396 ****
      }
    else
      if (tree_view->priv->hadjustment->value + allocation->width > tree_view->priv->width)
!       tree_view->priv->hadjustment->value = MAX (tree_view->priv->width - allocation->width, 0);
  
    gtk_adjustment_changed (tree_view->priv->hadjustment);
  
    tree_view->priv->vadjustment->page_size = allocation->height - TREE_VIEW_HEADER_HEIGHT (tree_view);
--- 2576,2597 ----
      }
    else
      if (tree_view->priv->hadjustment->value + allocation->width > tree_view->priv->width)
!       {
!         tree_view->priv->hadjustment->value = MAX (tree_view->priv->width - allocation->width, 0);
!       }
! 
!   /* we are resize the window, and the visible part is larger than the current shown part;
!      check that hidden columns are made visible again
!   */
!   if (tree_view->priv->bgscroll_hor != GTK_TREE_VIEW_BG_SCROLL_MOVING &&
!       tree_view->priv->hadjustment->value != tree_view->priv->dx)
!     {
!        tree_view->priv->dx *= -1;
!        gtk_tree_view_adjustment_changed (tree_view->priv->hadjustment, tree_view);
  
+        /* we have done the repainting of the window! */
+        early_repaint = TRUE;
+     }
    gtk_adjustment_changed (tree_view->priv->hadjustment);
  
    tree_view->priv->vadjustment->page_size = allocation->height - TREE_VIEW_HEADER_HEIGHT (tree_view);
***************
*** 2403,2419 ****
  
    /* now the adjustments and window sizes are in sync, we can sync toprow/dy again */
    if (tree_view->priv->height <= tree_view->priv->vadjustment->page_size)
!     gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), 0);
    else if (tree_view->priv->vadjustment->value + tree_view->priv->vadjustment->page_size > tree_view->priv->height)
!     gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment),
!                               tree_view->priv->height - tree_view->priv->vadjustment->page_size);
!   else if (gtk_tree_row_reference_valid (tree_view->priv->top_row))
!     gtk_tree_view_top_row_to_dy (tree_view);
!   else
!     gtk_tree_view_dy_to_top_row (tree_view);
!   
    if (GTK_WIDGET_REALIZED (widget))
      {
        gdk_window_move_resize (widget->window,
  			      allocation->x, allocation->y,
  			      allocation->width, allocation->height);
--- 2604,2634 ----
  
    /* now the adjustments and window sizes are in sync, we can sync toprow/dy again */
    if (tree_view->priv->height <= tree_view->priv->vadjustment->page_size)
!     {
!       gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), 0);
!     }
    else if (tree_view->priv->vadjustment->value + tree_view->priv->vadjustment->page_size > tree_view->priv->height)
!     {
!       gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment),
!                                 tree_view->priv->height - tree_view->priv->vadjustment->page_size);
!     }
!   else if (width_changed)
!     {
!       tree_view->priv->dy=0;
!       gtk_tree_view_adjustment_changed (tree_view->priv->vadjustment, tree_view);
!     }
! 
    if (GTK_WIDGET_REALIZED (widget))
      {
+       gint pm_height;
+ 
+       if (GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] &&
+ 	  GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)]  != (GdkPixmap*) GDK_PARENT_RELATIVE)
+ 	gdk_drawable_get_size (widget->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)],
+ 			       NULL, &pm_height);
+       else
+ 	pm_height=0;
+ 
        gdk_window_move_resize (widget->window,
  			      allocation->x, allocation->y,
  			      allocation->width, allocation->height);
***************
*** 2422,2432 ****
  			      0,
  			      MAX (tree_view->priv->width, allocation->width),
  			      tree_view->priv->header_height);
!       gdk_window_move_resize (tree_view->priv->bin_window,
! 			      - (gint) tree_view->priv->hadjustment->value,
! 			      TREE_VIEW_HEADER_HEIGHT (tree_view),
  			      MAX (tree_view->priv->width, allocation->width),
! 			      allocation->height - TREE_VIEW_HEADER_HEIGHT (tree_view));
      }
  
    if (tree_view->priv->tree == NULL)
--- 2637,2645 ----
  			      0,
  			      MAX (tree_view->priv->width, allocation->width),
  			      tree_view->priv->header_height);
!       gdk_window_resize (tree_view->priv->bin_window,
  			      MAX (tree_view->priv->width, allocation->width),
! 			      (allocation->height+pm_height) - TREE_VIEW_HEADER_HEIGHT (tree_view));
      }
  
    if (tree_view->priv->tree == NULL)
***************
*** 2447,2453 ****
        /* This little hack only works if we have an LTR locale, and no column has the  */
        if (width_changed)
  	{
! 	  if (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_LTR &&
  	      ! has_expand_column)
  	    invalidate_last_column (tree_view);
  	  else
--- 2660,2668 ----
        /* This little hack only works if we have an LTR locale, and no column has the  */
        if (width_changed)
  	{
! 	  if (early_repaint)
! 	    ;
!           else if (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_LTR &&
  	      ! has_expand_column)
  	    invalidate_last_column (tree_view);
  	  else
***************
*** 2590,2595 ****
--- 2805,2811 ----
        background_area.y = y_offset + event->y;
        background_area.height = ROW_HEIGHT (tree_view, GTK_RBNODE_GET_HEIGHT (node));
        background_area.x = 0;
+   background_area.x += tree_view->priv->first_column_dx;
  
  
        /* Let the column have a chance at selecting it. */
***************
*** 2769,2777 ****
  	      && !node_selected
  	      && tree_view->priv->selection->type == GTK_SELECTION_MULTIPLE)
  	    {
! 	      tree_view->priv->press_start_y += tree_view->priv->dy;
! 	      tree_view->priv->rubber_band_x = event->x;
! 	      tree_view->priv->rubber_band_y = event->y + tree_view->priv->dy;
  	      tree_view->priv->rubber_band_status = RUBBER_BAND_MAYBE_START;
  
  	      if ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK)
--- 2985,2994 ----
  	      && !node_selected
  	      && tree_view->priv->selection->type == GTK_SELECTION_MULTIPLE)
  	    {
! 	      tree_view->priv->press_start_x += tree_view->priv->dx;
!               tree_view->priv->press_start_y = TREE_WINDOW_Y_TO_RBTREE_Y(tree_view, event->y);
! 	      tree_view->priv->rubber_band_x = event->x + tree_view->priv->dx;
! 	      tree_view->priv->rubber_band_y = TREE_WINDOW_Y_TO_RBTREE_Y(tree_view, event->y);
  	      tree_view->priv->rubber_band_status = RUBBER_BAND_MAYBE_START;
  
  	      if ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK)
***************
*** 3613,3619 ****
    gfloat value;
  
    gdk_window_get_pointer (tree_view->priv->bin_window, NULL, &y, NULL);
!   y += tree_view->priv->dy;
  
    gtk_tree_view_get_visible_rect (tree_view, &visible_rect);
  
--- 3830,3836 ----
    gfloat value;
  
    gdk_window_get_pointer (tree_view->priv->bin_window, NULL, &y, NULL);
!   y = TREE_WINDOW_Y_TO_RBTREE_Y(tree_view, y);
  
    gtk_tree_view_get_visible_rect (tree_view, &visible_rect);
  
***************
*** 3640,3645 ****
--- 3857,3863 ----
    gfloat value;
  
    gdk_window_get_pointer (tree_view->priv->bin_window, &x, NULL, NULL);
+   x += tree_view->priv->dx;
  
    gtk_tree_view_get_visible_rect (tree_view, &visible_rect);
  
***************
*** 3653,3660 ****
      }
    offset = offset/3;
  
!   value = CLAMP (tree_view->priv->hadjustment->value + offset,
! 		 0.0, tree_view->priv->hadjustment->upper - tree_view->priv->hadjustment->page_size);
    gtk_adjustment_set_value (tree_view->priv->hadjustment, value);
  
    return TRUE;
--- 3871,3878 ----
      }
    offset = offset/3;
  
!   value = CLAMP (tree_view->priv->hadjustment->value + offset, 0.0,
! 		 tree_view->priv->hadjustment->upper - tree_view->priv->hadjustment->page_size);
    gtk_adjustment_set_value (tree_view->priv->hadjustment, value);
  
    return TRUE;
***************
*** 3839,3846 ****
    GtkRBTree *start_tree, *end_tree;
    GtkRBNode *start_node, *end_node;
  
!   _gtk_rbtree_find_offset (tree_view->priv->tree, MIN (tree_view->priv->press_start_y, tree_view->priv->rubber_band_y), &start_tree, &start_node);
!   _gtk_rbtree_find_offset (tree_view->priv->tree, MAX (tree_view->priv->press_start_y, tree_view->priv->rubber_band_y), &end_tree, &end_node);
  
    /* Handle the start area first */
    if (!tree_view->priv->rubber_band_start_node)
--- 4057,4068 ----
    GtkRBTree *start_tree, *end_tree;
    GtkRBNode *start_node, *end_node;
  
!   gint y;
! 
!   y=MIN (tree_view->priv->press_start_y, tree_view->priv->rubber_band_y);
!   _gtk_rbtree_find_offset (tree_view->priv->tree, y, &start_tree, &start_node);
!   y=MAX (tree_view->priv->press_start_y, tree_view->priv->rubber_band_y);
!   _gtk_rbtree_find_offset (tree_view->priv->tree, y, &end_tree, &end_node);
  
    /* Handle the start area first */
    if (!tree_view->priv->rubber_band_start_node)
***************
*** 3894,3900 ****
    else if (!end_node)
      {
        /* Find the last node in the tree */
!       _gtk_rbtree_find_offset (tree_view->priv->tree, tree_view->priv->height - 1,
  			       &end_tree, &end_node);
  
        /* Selection reached end of the tree */
--- 4116,4133 ----
    else if (!end_node)
      {
        /* Find the last node in the tree */
!       gint y;
!       gint bin_window_height;
! 
!       gdk_drawable_get_size (GTK_WIDGET(tree_view)->window,
! 			     NULL, &bin_window_height);
!       bin_window_height -= TREE_VIEW_HEADER_HEIGHT (tree_view);
! 
!       y = TREE_WINDOW_Y_TO_RBTREE_Y(tree_view, bin_window_height);
! 
!       if (y < 0)
! 	y = 0;
!       _gtk_rbtree_find_offset (tree_view->priv->tree, y-1,
  			       &end_tree, &end_node);
  
        /* Selection reached end of the tree */
***************
*** 3947,3964 ****
    GdkRectangle common;
    GdkRegion *invalid_region;
  
!   old_area.x = MIN (tree_view->priv->press_start_x, tree_view->priv->rubber_band_x);
!   old_area.y = MIN (tree_view->priv->press_start_y, tree_view->priv->rubber_band_y) - tree_view->priv->dy;
    old_area.width = ABS (tree_view->priv->rubber_band_x - tree_view->priv->press_start_x) + 1;
    old_area.height = ABS (tree_view->priv->rubber_band_y - tree_view->priv->press_start_y) + 1;
  
    gdk_window_get_pointer (tree_view->priv->bin_window, &x, &y, NULL);
  
!   x = MAX (x, 0);
!   y = MAX (y, 0) + tree_view->priv->dy;
  
!   new_area.x = MIN (tree_view->priv->press_start_x, x);
!   new_area.y = MIN (tree_view->priv->press_start_y, y) - tree_view->priv->dy;
    new_area.width = ABS (x - tree_view->priv->press_start_x) + 1;
    new_area.height = ABS (y - tree_view->priv->press_start_y) + 1;
  
--- 4180,4197 ----
    GdkRectangle common;
    GdkRegion *invalid_region;
  
!   old_area.x = MIN (tree_view->priv->press_start_x, tree_view->priv->rubber_band_x) - tree_view->priv->dx;
!   old_area.y = RBTREE_Y_TO_TREE_WINDOW_Y(tree_view, MIN (tree_view->priv->press_start_y, tree_view->priv->rubber_band_y));
    old_area.width = ABS (tree_view->priv->rubber_band_x - tree_view->priv->press_start_x) + 1;
    old_area.height = ABS (tree_view->priv->rubber_band_y - tree_view->priv->press_start_y) + 1;
  
    gdk_window_get_pointer (tree_view->priv->bin_window, &x, &y, NULL);
  
!   x = MAX (x, 0) + tree_view->priv->dx;
!   y = TREE_WINDOW_Y_TO_RBTREE_Y(tree_view, MAX (y, 0));
  
!   new_area.x = MIN (tree_view->priv->press_start_x, x) - tree_view->priv->dx;
!   new_area.y = RBTREE_Y_TO_TREE_WINDOW_Y(tree_view, MIN (tree_view->priv->press_start_y, y));
    new_area.width = ABS (x - tree_view->priv->press_start_x) + 1;
    new_area.height = ABS (y - tree_view->priv->press_start_y) + 1;
  
***************
*** 4000,4007 ****
    GdkRectangle rect;
    GdkRectangle rubber_rect;
  
!   rubber_rect.x = MIN (tree_view->priv->press_start_x, tree_view->priv->rubber_band_x);
!   rubber_rect.y = MIN (tree_view->priv->press_start_y, tree_view->priv->rubber_band_y) - tree_view->priv->dy;
    rubber_rect.width = ABS (tree_view->priv->press_start_x - tree_view->priv->rubber_band_x) + 1;
    rubber_rect.height = ABS (tree_view->priv->press_start_y - tree_view->priv->rubber_band_y) + 1;
  
--- 4233,4240 ----
    GdkRectangle rect;
    GdkRectangle rubber_rect;
  
!   rubber_rect.x = MIN (tree_view->priv->press_start_x, tree_view->priv->rubber_band_x) - tree_view->priv->dx;
!   rubber_rect.y = RBTREE_Y_TO_TREE_WINDOW_Y(tree_view, MIN (tree_view->priv->press_start_y, tree_view->priv->rubber_band_y));
    rubber_rect.width = ABS (tree_view->priv->press_start_x - tree_view->priv->rubber_band_x) + 1;
    rubber_rect.height = ABS (tree_view->priv->press_start_y - tree_view->priv->rubber_band_y) + 1;
  
***************
*** 4119,4125 ****
  
    area.x = 0;
    area.y = 0;
!   gdk_drawable_get_size (tree_view->priv->bin_window, &area.width, &area.height);
    gdk_window_invalidate_rect (tree_view->priv->bin_window, &area, FALSE);
  }
  
--- 4352,4360 ----
  
    area.x = 0;
    area.y = 0;
!   gdk_drawable_get_size (tree_view->priv->bin_window, &area.width, NULL);
!   gdk_drawable_get_size (GTK_WIDGET(tree_view)->window, NULL, &area.height);
!   area.height -= TREE_VIEW_HEADER_HEIGHT (tree_view);
    gdk_window_invalidate_rect (tree_view->priv->bin_window, &area, FALSE);
  }
  
***************
*** 4134,4140 ****
    if (!GTK_WIDGET_HAS_FOCUS (tree_view))
      return;
  
!   gdk_drawable_get_size (tree_view->priv->bin_window, &w, &h);
  
    w -= 2;
    h -= 2;
--- 4369,4377 ----
    if (!GTK_WIDGET_HAS_FOCUS (tree_view))
      return;
  
!   gdk_drawable_get_size (tree_view->priv->bin_window, &w, NULL);
!   gdk_drawable_get_size (GTK_WIDGET(tree_view)->window, NULL, &h);
!   h -= TREE_VIEW_HEADER_HEIGHT (tree_view);
  
    w -= 2;
    h -= 2;
***************
*** 4162,4169 ****
        && tree_view->priv->grid_lines != GTK_TREE_VIEW_GRID_LINES_BOTH)
      return;
  
    /* Only draw the lines for visible rows and columns */
!   for (list = tree_view->priv->columns; list; list = list->next, i++)
      {
        GtkTreeViewColumn *column = list->data;
  
--- 4399,4408 ----
        && tree_view->priv->grid_lines != GTK_TREE_VIEW_GRID_LINES_BOTH)
      return;
  
+   current_x += tree_view->priv->first_column_dx;
+  
    /* Only draw the lines for visible rows and columns */
!   for (list = (tree_view->priv->first_column)?tree_view->priv->first_column:tree_view->priv->columns; list; list = list->next, i++)
      {
        GtkTreeViewColumn *column = list->data;
  
***************
*** 4258,4268 ****
      new_y = 0;
    y_offset = -_gtk_rbtree_find_offset (tree_view->priv->tree, new_y, &tree, &node);
    gdk_drawable_get_size (tree_view->priv->bin_window,
!                          &bin_window_width, &bin_window_height);
  
    if (tree_view->priv->height < bin_window_height)
      {
!       gtk_paint_flat_box (widget->style,
                            event->window,
                            widget->state,
                            GTK_SHADOW_NONE,
--- 4497,4510 ----
      new_y = 0;
    y_offset = -_gtk_rbtree_find_offset (tree_view->priv->tree, new_y, &tree, &node);
    gdk_drawable_get_size (tree_view->priv->bin_window,
!                          &bin_window_width, NULL);
!   gdk_drawable_get_size (GTK_WIDGET(tree_view)->window,
!                          NULL, &bin_window_height);
!   bin_window_height -= TREE_VIEW_HEADER_HEIGHT (tree_view);
  
    if (tree_view->priv->height < bin_window_height)
      {
!       gtk_paint_box (widget->style,
                            event->window,
                            widget->state,
                            GTK_SHADOW_NONE,
***************
*** 4323,4337 ****
      }
  
    /* Find the last column */
!   for (last_column = g_list_last (tree_view->priv->columns);
         last_column && !(GTK_TREE_VIEW_COLUMN (last_column->data)->visible);
!        last_column = last_column->prev)
      ;
  
    /* and the first */
!   for (first_column = g_list_first (tree_view->priv->columns);
         first_column && !(GTK_TREE_VIEW_COLUMN (first_column->data)->visible);
!        first_column = first_column->next)
      ;
  
    /* Actually process the expose event.  To do this, we want to
--- 4565,4580 ----
      }
  
    /* Find the last column */
!   for (last_column = (rtl ? g_list_first (tree_view->priv->columns) : g_list_last (tree_view->priv->columns));
         last_column && !(GTK_TREE_VIEW_COLUMN (last_column->data)->visible);
!        last_column = (rtl ? last_column->next : last_column->prev))
      ;
  
    /* and the first */
!   for (first_column = (tree_view->priv->first_column)?tree_view->priv->first_column:
!        (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
         first_column && !(GTK_TREE_VIEW_COLUMN (first_column->data)->visible);
!        first_column = (rtl ? first_column->prev : first_column->next))
      ;
  
    /* Actually process the expose event.  To do this, we want to
***************
*** 4351,4356 ****
--- 4594,4600 ----
        max_height = ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node));
  
        cell_offset = 0;
+       cell_offset += tree_view->priv->first_column_dx;
        highlight_x = 0; /* should match x coord of first cell */
        expander_cell_width = 0;
  
***************
*** 4385,4392 ****
  
        has_special_cell = gtk_tree_view_has_special_cell (tree_view);
  
!       for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
! 	   list;
  	   list = (rtl ? list->prev : list->next))
  	{
  	  GtkTreeViewColumn *column = list->data;
--- 4629,4636 ----
  
        has_special_cell = gtk_tree_view_has_special_cell (tree_view);
  
!       for (list = first_column;
! 	   list != (rtl ? last_column->prev : last_column->next);
  	   list = (rtl ? list->prev : list->next))
  	{
  	  GtkTreeViewColumn *column = list->data;
***************
*** 4416,4421 ****
--- 4660,4670 ----
  	  background_area.x = cell_offset;
  	  background_area.width = column->width;
  
+ 	  if (list == last_column)
+ 	    {
+ 	       background_area.width -= tree_view->priv->first_column_dx;
+ 	    };
+ 
            cell_area = background_area;
            cell_area.y += vertical_separator / 2;
            cell_area.x += horizontal_separator / 2;
***************
*** 4528,4533 ****
--- 4777,4783 ----
  	      else
  		g_snprintf (new_detail, 128, "%s_middle", detail);
  
+ if (state != GTK_STATE_NORMAL)
  	      gtk_paint_flat_box (widget->style,
  				  event->window,
  				  state,
***************
*** 4539,4547 ****
--- 4789,4810 ----
  				  background_area.y,
  				  background_area.width,
  				  background_area.height);
+ else
+ 	      gtk_paint_box (widget->style,
+ 				  event->window,
+ 				  state,
+ 				  GTK_SHADOW_NONE,
+ 				  &event->area,
+ 				  widget,
+ 				  new_detail,
+ 				  background_area.x,
+ 				  background_area.y,
+ 				  background_area.width,
+ 				  background_area.height);
  	    }
  	  else
  	    {
+ if (state != GTK_STATE_NORMAL)
  	      gtk_paint_flat_box (widget->style,
  				  event->window,
  				  state,
***************
*** 4553,4558 ****
--- 4816,4833 ----
  				  background_area.y,
  				  background_area.width,
  				  background_area.height);
+ else
+ 	      gtk_paint_box (widget->style,
+ 				  event->window,
+ 				  state,
+ 				  GTK_SHADOW_NONE,
+ 				  &event->area,
+ 				  widget,
+ 				  detail,
+ 				  background_area.x,
+ 				  background_area.y,
+ 				  background_area.width,
+ 				  background_area.height);
  	    }
  
  	  if (draw_hgrid_lines)
***************
*** 4647,4652 ****
--- 4922,4930 ----
  	    }
  
  	  if (gtk_tree_view_is_expander_column (tree_view, column) &&
+ #ifdef IMPLEMENT_EXTENDED_TREELINES
+ 	      (TREE_VIEW_DRAW_EXPANDERS(tree_view) || (tree_view->priv->level_indentation>0)) &&
+ #endif
  	      tree_view->priv->tree_lines_enabled)
  	    {
  	      gint x = background_area.x;
***************
*** 4655,4660 ****
--- 4933,4942 ----
  	      gint y1 = background_area.y + background_area.height/2;
  	      gint y2 = background_area.y + background_area.height;
  
+ #ifdef IMPLEMENT_EXTENDED_TREELINES
+ 	      gint exp_mult = (TREE_VIEW_DRAW_EXPANDERS(tree_view)) ? 1 :0;
+ #endif
+ 
  	      if (rtl)
  		x += background_area.width - 1;
  
***************
*** 4663,4680 ****
  	        {
  		  gdk_draw_line (event->window,
  				 tree_view->priv->tree_line_gc,
! 			         x + tree_view->priv->expander_size * (depth - 1.5) * mult,
  				 y1,
! 			         x + tree_view->priv->expander_size * (depth - 1.1) * mult,
  				 y1);
  	        }
  	      else if (depth > 1)
  	        {
  		  gdk_draw_line (event->window,
  				 tree_view->priv->tree_line_gc,
! 			         x + tree_view->priv->expander_size * (depth - 1.5) * mult,
  				 y1,
! 			         x + tree_view->priv->expander_size * (depth - 0.5) * mult,
  				 y1);
  		}
  
--- 4945,4978 ----
  	        {
  		  gdk_draw_line (event->window,
  				 tree_view->priv->tree_line_gc,
! 			         x + tree_view->priv->expander_size * (depth - 1.5) * mult
! #ifdef IMPLEMENT_EXTENDED_TREELINES
!                                    * exp_mult + (depth - 2) * tree_view->priv->level_indentation * mult
! #endif
! 				 ,
  				 y1,
! 			         x + tree_view->priv->expander_size * (depth - 1.1) * mult
! #ifdef IMPLEMENT_EXTENDED_TREELINES
!                                    * exp_mult + (depth - 1) * tree_view->priv->level_indentation * mult
! #endif
! 				 ,
  				 y1);
  	        }
  	      else if (depth > 1)
  	        {
  		  gdk_draw_line (event->window,
  				 tree_view->priv->tree_line_gc,
! 			         x + tree_view->priv->expander_size * (depth - 1.5) * mult
! #ifdef IMPLEMENT_EXTENDED_TREELINES
!                                    * exp_mult + (depth - 2) * tree_view->priv->level_indentation * mult
! #endif
! 				 ,
  				 y1,
! 				 x + tree_view->priv->expander_size * (depth - 0.5) * mult
! #ifdef IMPLEMENT_EXTENDED_TREELINES
!                                    * exp_mult + (depth - 1) * tree_view->priv->level_indentation * mult
! #endif
! 				 ,
  				 y1);
  		}
  
***************
*** 4687,4702 ****
  	          if (!_gtk_rbtree_next (tree, node))
  		    gdk_draw_line (event->window,
  				   tree_view->priv->tree_line_gc,
! 				   x + tree_view->priv->expander_size * (depth - 1.5) * mult,
  				   y0,
! 				   x + tree_view->priv->expander_size * (depth - 1.5) * mult,
  				   y1);
  		  else
  		    gdk_draw_line (event->window,
  				   tree_view->priv->tree_line_gc,
! 				   x + tree_view->priv->expander_size * (depth - 1.5) * mult,
  				   y0,
! 				   x + tree_view->priv->expander_size * (depth - 1.5) * mult,
  				   y2);
  
  		  tmp_node = tree->parent_node;
--- 4985,5016 ----
  	          if (!_gtk_rbtree_next (tree, node))
  		    gdk_draw_line (event->window,
  				   tree_view->priv->tree_line_gc,
! 				   x + tree_view->priv->expander_size * (depth - 1.5) * mult
! #ifdef IMPLEMENT_EXTENDED_TREELINES
!                                      * exp_mult + (depth - 2) * tree_view->priv->level_indentation * mult
! #endif
! 				   ,
  				   y0,
! 				   x + tree_view->priv->expander_size * (depth - 1.5) * mult
! #ifdef IMPLEMENT_EXTENDED_TREELINES
!                                      * exp_mult + (depth - 2) * tree_view->priv->level_indentation * mult
! #endif
! 				   ,
  				   y1);
  		  else
  		    gdk_draw_line (event->window,
  				   tree_view->priv->tree_line_gc,
! 				   x + tree_view->priv->expander_size * (depth - 1.5) * mult
! #ifdef IMPLEMENT_EXTENDED_TREELINES
!                                      * exp_mult + (depth - 2) * tree_view->priv->level_indentation * mult
! #endif
! 				   ,
  				   y0,
! 				   x + tree_view->priv->expander_size * (depth - 1.5) * mult
! #ifdef IMPLEMENT_EXTENDED_TREELINES
!                                      * exp_mult + (depth - 2) * tree_view->priv->level_indentation * mult
! #endif
! 				   ,
  				   y2);
  
  		  tmp_node = tree->parent_node;
***************
*** 4707,4715 ****
  	              if (_gtk_rbtree_next (tmp_tree, tmp_node))
  			gdk_draw_line (event->window,
  				       tree_view->priv->tree_line_gc,
! 				       x + tree_view->priv->expander_size * (i - 0.5) * mult,
  				       y0,
! 				       x + tree_view->priv->expander_size * (i - 0.5) * mult,
  				       y2);
  
  		      tmp_node = tmp_tree->parent_node;
--- 5021,5037 ----
  	              if (_gtk_rbtree_next (tmp_tree, tmp_node))
  			gdk_draw_line (event->window,
  				       tree_view->priv->tree_line_gc,
! 				       x + tree_view->priv->expander_size * (i - 0.5) * mult
! #ifdef IMPLEMENT_EXTENDED_TREELINES
!                                          * exp_mult + (i-1) * tree_view->priv->level_indentation * mult
! #endif
! 				       ,
  				       y0,
! 				       x + tree_view->priv->expander_size * (i - 0.5) * mult
! #ifdef IMPLEMENT_EXTENDED_TREELINES
!                                          * exp_mult + (i-1) * tree_view->priv->level_indentation * mult
! #endif
! 				       ,
  				       y2);
  
  		      tmp_node = tmp_tree->parent_node;
***************
*** 5629,5635 ****
         last_column = last_column->prev)
      ;
  
!   for (first_column = g_list_first (tree_view->priv->columns);
         first_column && !(GTK_TREE_VIEW_COLUMN (first_column->data)->visible);
         first_column = first_column->next)
      ;
--- 5951,5958 ----
         last_column = last_column->prev)
      ;
  
!   for (first_column = (tree_view->priv->first_column)?tree_view->priv->first_column:
! 	 g_list_first (tree_view->priv->columns);
         first_column && !(GTK_TREE_VIEW_COLUMN (first_column->data)->visible);
         first_column = first_column->next)
      ;
***************
*** 6041,6048 ****
        gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), tree_view->priv->height - tree_view->priv->vadjustment->page_size);
        gtk_tree_view_dy_to_top_row (tree_view);
      }
-   else
-     gtk_tree_view_top_row_to_dy (tree_view);
  
    /* update width/height and queue a resize */
    if (size_changed)
--- 6364,6369 ----
***************
*** 6347,6356 ****
  {
    if (tree_view->priv->height <= tree_view->priv->vadjustment->page_size)
      gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), 0);
!   else if (gtk_tree_row_reference_valid (tree_view->priv->top_row))
!     gtk_tree_view_top_row_to_dy (tree_view);
!   else
!     gtk_tree_view_dy_to_top_row (tree_view);
  
    tree_view->priv->scroll_sync_timer = 0;
  
--- 6668,6678 ----
  {
    if (tree_view->priv->height <= tree_view->priv->vadjustment->page_size)
      gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), 0);
! 
!   if (tree_view->priv->width <= tree_view->priv->hadjustment->page_size)
!     gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->hadjustment), 0);
!   else 
!     gtk_tree_view_dx_to_first_column (tree_view);
  
    tree_view->priv->scroll_sync_timer = 0;
  
***************
*** 6371,6376 ****
--- 6693,6762 ----
  }
  
  static void
+ gtk_tree_view_set_first_column (GtkTreeView *tree_view,
+ 			   GtkTreeViewColumn *column,
+ 			   gint         offset)
+ {
+   if (!column)
+     {
+       tree_view->priv->first_column = NULL;
+       tree_view->priv->first_column_dx = 0;
+     }
+   else
+     {
+       GList* priv_column;
+ 
+       priv_column=tree_view->priv->columns;
+       while (priv_column && (priv_column->data != column)) {
+         priv_column=priv_column->next;
+       };
+       tree_view->priv->first_column = priv_column;
+       tree_view->priv->first_column_dx = offset;
+     }
+ }
+ 
+ static void
+ gtk_tree_view_dx_to_first_column (GtkTreeView *tree_view)
+ {
+   gint offset;
+   GtkTreeViewColumn *column;
+ 
+   if (tree_view->priv->bgscroll_hor == GTK_TREE_VIEW_BG_SCROLL_MOVING)
+     return;
+ 
+   if (tree_view->priv->hadjustment == NULL)
+     return;
+ 
+   if (tree_view->priv->tree == NULL)
+     {
+       gtk_tree_view_set_first_column (tree_view, NULL, 0);
+     }
+   else
+     {
+ 
+       offset = X_OFFSET(tree_view, &column);
+ 
+       if (tree_view->priv->hadjustment->value + tree_view->priv->hadjustment->page_size >= tree_view->priv->hadjustment->upper) 
+ 	{
+ 	  if (-offset > tree_view->priv->hadjustment->value)
+ 	    {
+ 	      offset = -tree_view->priv->hadjustment->value;
+ 	    }
+ 	} 
+ 
+       if (column == NULL)
+         {
+ 	  tree_view->priv->first_column = NULL;
+ 	  tree_view->priv->first_column_dx = 0;
+ 	}
+       else
+         {
+ 	  gtk_tree_view_set_first_column (tree_view, column, offset);
+ 	}
+     }
+ }
+ 
+ static void
  gtk_tree_view_set_top_row (GtkTreeView *tree_view,
  			   GtkTreePath *path,
  			   gint         offset)
***************
*** 6407,6413 ****
    else
      {
        offset = _gtk_rbtree_find_offset (tree_view->priv->tree,
! 					tree_view->priv->dy,
  					&tree, &node);
  
        if (tree == NULL)
--- 6793,6799 ----
    else
      {
        offset = _gtk_rbtree_find_offset (tree_view->priv->tree,
! 					tree_view->priv->dy-Y_OFFSET(tree_view),
  					&tree, &node);
  
        if (tree == NULL)
***************
*** 6688,6693 ****
--- 7074,7081 ----
  
    gdk_window_get_pointer (tree_view->priv->bin_window,
                            &x, &y, &state);
+   x += tree_view->priv->dx;
+   y = TREE_WINDOW_Y_TO_RBTREE_Y(tree_view, y);
  
    gtk_tree_view_get_visible_rect (tree_view, &visible_rect);
  
***************
*** 7094,7099 ****
--- 7482,7492 ----
    GdkPixmap *row_pix;
    TreeViewDragInfo *di;
  
+   gint hotspot_x;
+   gint hotspot_y;
+   gint icon_height;
+   gint icon_width;
+ 
    tree_view = GTK_TREE_VIEW (widget);
  
    /* if the user uses a custom DND source impl, we don't set the icon here */
***************
*** 7115,7127 ****
    row_pix = gtk_tree_view_create_row_drag_icon (tree_view,
                                                  path);
  
    gtk_drag_set_icon_pixmap (context,
                              gdk_drawable_get_colormap (row_pix),
                              row_pix,
                              NULL,
!                             /* the + 1 is for the black border in the icon */
!                             tree_view->priv->press_start_x + 1,
!                             cell_y + 1);
  
    g_object_unref (row_pix);
    gtk_tree_path_free (path);
--- 7508,7574 ----
    row_pix = gtk_tree_view_create_row_drag_icon (tree_view,
                                                  path);
  
+   gdk_drawable_get_size (row_pix, &icon_width, &icon_height);
+ 
+ #ifdef IMPLEMENT_DRAGWINDOW_ANCHOR
+   /* the + 1 is for the black border in the icon */
+   hotspot_x=1; 
+   hotspot_y=1;
+   if (tree_view->priv->dragwindow_anchor_set)
+     {
+       switch (tree_view->priv->dragwindow_anchor)
+ 	{
+ 	case GTK_ANCHOR_NORTH:
+ 	case GTK_ANCHOR_CENTER:
+ 	case GTK_ANCHOR_SOUTH:
+ 	  hotspot_x += icon_width/2;
+ 	  break;
+ 	case GTK_ANCHOR_NORTH_EAST:
+ 	case GTK_ANCHOR_EAST:
+ 	case GTK_ANCHOR_SOUTH_EAST:
+ 	  hotspot_x += icon_width;
+ 	  break;
+ 	case GTK_ANCHOR_NORTH_WEST:
+ 	case GTK_ANCHOR_WEST:
+ 	case GTK_ANCHOR_SOUTH_WEST:
+ 	  hotspot_x += 0;
+ 	  break;
+ 	}
+       switch (tree_view->priv->dragwindow_anchor)
+ 	{
+ 	case GTK_ANCHOR_WEST:
+ 	case GTK_ANCHOR_CENTER:
+ 	case GTK_ANCHOR_EAST:
+ 	  hotspot_y += icon_height/2;
+ 	  break;
+ 	case GTK_ANCHOR_SOUTH_WEST:
+ 	case GTK_ANCHOR_SOUTH:
+ 	case GTK_ANCHOR_SOUTH_EAST:
+ 	  hotspot_y += icon_height;
+ 	  break;
+ 	case GTK_ANCHOR_NORTH_WEST:
+ 	case GTK_ANCHOR_NORTH:
+ 	case GTK_ANCHOR_NORTH_EAST:
+ 	  hotspot_y += 0;
+ 	  break;
+ 	}
+     }
+   else
+     {
+       hotspot_x += tree_view->priv->press_start_x;
+       hotspot_y += cell_y;
+     }
+ #else
+       hotspot_x += tree_view->priv->press_start_x+1;
+       hotspot_y += cell_y+1;
+ #endif
+ 
    gtk_drag_set_icon_pixmap (context,
                              gdk_drawable_get_colormap (row_pix),
                              row_pix,
                              NULL,
!                             hotspot_x,
!                             hotspot_y);
  
    g_object_unref (row_pix);
    gtk_tree_path_free (path);
***************
*** 7688,7694 ****
    GList *last_column, *first_column;
    GList *tmp_list;
    gboolean rtl;
! 
    if (! GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
      return FALSE;
  
--- 8135,8141 ----
    GList *last_column, *first_column;
    GList *tmp_list;
    gboolean rtl;
!  
    if (! GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
      return FALSE;
  
***************
*** 7945,7952 ****
  
    if (GTK_WIDGET_REALIZED (widget))
      {
!       gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
!       gdk_window_set_background (tree_view->priv->bin_window, &widget->style->base[widget->state]);
        gtk_style_set_background (widget->style, tree_view->priv->header_window, GTK_STATE_NORMAL);
  
        gtk_tree_view_set_grid_lines (tree_view, tree_view->priv->grid_lines);
--- 8392,8398 ----
  
    if (GTK_WIDGET_REALIZED (widget))
      {
!       SET_BACKGROUND(widget,tree_view,"style_set");
        gtk_style_set_background (widget->style, tree_view->priv->header_window, GTK_STATE_NORMAL);
  
        gtk_tree_view_set_grid_lines (tree_view, tree_view->priv->grid_lines);
***************
*** 8126,8131 ****
--- 8572,8588 ----
    child = g_slice_new (GtkTreeViewChild);
  
    child->widget = child_widget;
+ 
+   if (tree_view->priv->bgscroll_ver != GTK_TREE_VIEW_BG_SCROLL_MOVING ||
+       !GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] ||
+       GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] == (GdkPixmap*) GDK_PARENT_RELATIVE)
+     child->node_offset = tree_view->priv->vadjustment->value+y-Y_OFFSET(tree_view);
+   else
+     {
+       fprintf (stderr, "DEBUG: ++ y %d vadj->value %lf Y_OFFSET %d\n", y, tree_view->priv->vadjustment->value, Y_OFFSET(tree_view));
+       child->node_offset = tree_view->priv->vadjustment->value+y-Y_OFFSET(tree_view);
+     }
+ 
    child->x = x;
    child->y = y;
    child->width = width;
***************
*** 8591,8597 ****
  
    gtk_widget_queue_draw (GTK_WIDGET (tree_view));
  
-   gtk_tree_view_dy_to_top_row (tree_view);
  }
  
  
--- 9048,9053 ----
***************
*** 8620,8626 ****
    rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
  
    total_width = 0;
!   for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
         list;
         list = (rtl ? list->prev : list->next))
      {
--- 9076,9084 ----
    rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
  
    total_width = 0;
! 
!   for (list = (tree_view->priv->first_column) ? tree_view->priv->first_column :
! 	 (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
         list;
         list = (rtl ? list->prev : list->next))
      {
***************
*** 8640,8653 ****
      }
  
    if (x1)
!     *x1 = total_width;
  
    if (x2)
      {
        if (column->visible)
!         *x2 = total_width + column->width;
        else
!         *x2 = total_width; /* width of 0 */
      }
  }
  static void
--- 9098,9114 ----
      }
  
    if (x1)
!     {
!       *x1 = total_width;
!       *x1 += tree_view->priv->first_column_dx;
!     }
  
    if (x2)
      {
        if (column->visible)
!         *x2 = *x1 + column->width;
        else
!         *x2 = *x1; /* width of 0 */
      }
  }
  static void
***************
*** 8692,8703 ****
    if (indent_expanders)
      {
        if (rtl)
! 	x_offset -= tree_view->priv->expander_size * _gtk_rbtree_get_depth (tree);
        else
! 	x_offset += tree_view->priv->expander_size * _gtk_rbtree_get_depth (tree);
      }
  
!   *x1 = x_offset;
    
    if (tmp_column && tmp_column->visible)
      /* +1 because x2 isn't included in the range. */
--- 9153,9177 ----
    if (indent_expanders)
      {
        if (rtl)
! 	x_offset -= tree_view->priv->expander_size * _gtk_rbtree_get_depth (tree)
! #ifdef IMPLEMENT_EXTENDED_TREELINES
!                                    + (_gtk_rbtree_get_depth (tree)) * tree_view->priv->level_indentation
! #endif
! 
! 	  ;
        else
! 	x_offset += tree_view->priv->expander_size * _gtk_rbtree_get_depth (tree)
! #ifdef IMPLEMENT_EXTENDED_TREELINES
!                                    + (_gtk_rbtree_get_depth (tree)) * tree_view->priv->level_indentation
! #endif
! 	  ;
      }
  
!   if (x1)
!     {
!       *x1 = x_offset;
!       *x1 += tree_view->priv->first_column_dx;
!     }
    
    if (tmp_column && tmp_column->visible)
      /* +1 because x2 isn't included in the range. */
***************
*** 9404,9409 ****
--- 9878,9885 ----
  
    widget = GTK_WIDGET (tree_view);
  
+   x_offset += tree_view->priv->first_column_dx;
+ 
    gtk_tree_view_get_arrow_xrange (tree_view, tree, &x_offset, &x2);
  
    area.x = x_offset;
***************
*** 9744,9750 ****
    gtk_tree_view_real_set_cursor (tree_view, cursor_path, TRUE, FALSE);
  
    y -= window_y;
-   gtk_tree_view_scroll_to_point (tree_view, -1, y);
    gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node);
    _gtk_tree_view_queue_draw_node (tree_view, cursor_tree, cursor_node, NULL);
  
--- 10220,10225 ----
***************
*** 10494,10533 ****
  {
    if (GTK_WIDGET_REALIZED (tree_view))
      {
!       gint dy;
! 	
!       gdk_window_move (tree_view->priv->bin_window,
! 		       - tree_view->priv->hadjustment->value,
! 		       TREE_VIEW_HEADER_HEIGHT (tree_view));
!       gdk_window_move (tree_view->priv->header_window,
! 		       - tree_view->priv->hadjustment->value,
! 		       0);
!       dy = tree_view->priv->dy - (int) tree_view->priv->vadjustment->value;
!       if (dy && tree_view->priv->edited_column)
  	{
! 	  if (GTK_IS_WIDGET (tree_view->priv->edited_column->editable_widget))
  	    {
! 	      GList *list;
! 	      GtkWidget *widget;
! 	      GtkTreeViewChild *child = NULL;
  
! 	      widget = GTK_WIDGET (tree_view->priv->edited_column->editable_widget);
! 	      adjust_allocation (widget, 0, dy); 
! 	      
! 	      for (list = tree_view->priv->children; list; list = list->next)
  		{
! 		  child = (GtkTreeViewChild *)list->data;
! 		  if (child->widget == widget)
  		    {
! 		      child->y += dy;
! 		      break;
  		    }
  		}
  	    }
  	}
-       gdk_window_scroll (tree_view->priv->bin_window, 0, dy);
  
!       if (tree_view->priv->dy != (int) tree_view->priv->vadjustment->value)
          {
            /* update our dy and top_row */
            tree_view->priv->dy = (int) tree_view->priv->vadjustment->value;
--- 10969,11242 ----
  {
    if (GTK_WIDGET_REALIZED (tree_view))
      {
!       gint dy, dx;
!       gint updateX;
!       gint updateY;
!       gint invalidateAllWindow=0;
! 
!       gint org_dy;
! 
!       if (GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] == (GdkPixmap*) GDK_PARENT_RELATIVE)
  	{
!           dy = 0;
! 	  updateY = 1;
! 
!           dx = 0;
! 	  updateX = 1;
! 
! 	  invalidateAllWindow=1;
! 	}
!       else
! 	{
! 
! 	  if (tree_view->priv->dy < 0)
  	    {
! 	      dy = 0;
! 	      updateY = 1;
! 	      invalidateAllWindow=1;
! 	    }
! 	  else
! 	    {
! 	      dy = tree_view->priv->dy - (int) tree_view->priv->vadjustment->value;
! 	      updateY = (dy != 0);
! 	    }
  
! 	  if (tree_view->priv->bgscroll_hor == GTK_TREE_VIEW_BG_SCROLL_MOVING)
! 	    {
! 	      updateX=(tree_view->priv->dx < 0);
! 	      tree_view->priv->dx = 0;
! 	      dx=0;
! 	    }
! 	  else if (tree_view->priv->dx >=0)
! 	    {
! 	      dx = tree_view->priv->dx - (int) tree_view->priv->hadjustment->value;
! 	      updateX = (dx != 0);
! 	    }
! 	  else
! 	    {
! 	      dx = -tree_view->priv->dx - (int) tree_view->priv->hadjustment->value;
! 	      updateX = 1;
! 	      invalidateAllWindow=1;
! 	    }
! 	}
! 
!       if (tree_view->priv->bgscroll_hor == GTK_TREE_VIEW_BG_SCROLL_MOVING)
! 	{
!           if (tree_view->priv->bgscroll_ver == GTK_TREE_VIEW_BG_SCROLL_MOVING) 
! 	    {
! 	      gdk_window_move (tree_view->priv->bin_window,
! 			       -tree_view->priv->hadjustment->value,
! 			       TREE_VIEW_HEADER_HEIGHT (tree_view)-Y_OFFSET(tree_view));
! 	      gdk_window_move (tree_view->priv->header_window,
! 			       -tree_view->priv->hadjustment->value,
! 			       0);
! 	    }
! 	  else
! 	    {
! 	      gdk_window_move (tree_view->priv->bin_window,
! 			       -tree_view->priv->hadjustment->value,
! 			       TREE_VIEW_HEADER_HEIGHT (tree_view));
! 	      gdk_window_move (tree_view->priv->header_window,
! 			       -tree_view->priv->hadjustment->value,
! 			       0);
! 	    }
! 	}
!       else
! 	{
!           if (tree_view->priv->bgscroll_ver == GTK_TREE_VIEW_BG_SCROLL_MOVING) 
! 	    {
! 	      gdk_window_move (tree_view->priv->bin_window,
! 			       0,
! 			       TREE_VIEW_HEADER_HEIGHT (tree_view)-Y_OFFSET(tree_view));
! 	      gdk_window_move (tree_view->priv->header_window,
! 			       -tree_view->priv->hadjustment->value,
! 			       0);
! 	    }
! 	  else
! 	    {
! 	      gdk_window_move (tree_view->priv->bin_window,
! 			       0,
! 			       TREE_VIEW_HEADER_HEIGHT (tree_view));
! 	      gdk_window_move (tree_view->priv->header_window,
! 			       -tree_view->priv->hadjustment->value,
! 			       0);
! 	    }
! 	}
! 
!       if (updateX || updateY)
!         {
! 
! 	  GdkRectangle invalid_rect;
! 
! 	  if (invalidateAllWindow)
! 	    {
! 	      invalid_rect.x=0;
! 	      invalid_rect.width=GTK_WIDGET(tree_view)->allocation.width+tree_view->priv->hadjustment->value;
! 	    }
! 	  else if (tree_view->priv->bgscroll_hor != GTK_TREE_VIEW_BG_SCROLL_MOVING &&
! 	      GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] &&
! 	      GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] != (GdkPixmap*) GDK_PARENT_RELATIVE)
! 	    {
! 	      invalid_rect.x=0;
! 	      invalid_rect.width=GTK_WIDGET(tree_view)->allocation.width;
! 	    }
! 	  else
! 	    {
! 	      gint bin_window_width;
! 
! 	      gdk_drawable_get_size (GTK_WIDGET(tree_view)->window,
! 				      &bin_window_width, NULL);
! 
! 	      if (dx == 0)
! 		{
! 		  invalid_rect.x=tree_view->priv->hadjustment->value;
! 		  invalid_rect.width=bin_window_width;
! 		  //		  invalid_rect.x=0;
! 		  //		  invalid_rect.width=bin_window_width;
! 		}
! 	      else if (dx < 0)
! 		{
! 		  /* scroll right */
! 		  invalid_rect.x=bin_window_width+dx;
! 		  invalid_rect.width=-dx;
! 		}
! 	      else 
! 		{
! 		  /* scroll left */
! 		  invalid_rect.x=0;
! 		  invalid_rect.width=dx;
! 		}
! 
! 	      //	      invalid_rect.x=tree_view->priv->hadjustment->value;
! 	      //	      invalid_rect.width=GTK_WIDGET(tree_view)->allocation.width;
! 	    }
! 
! 	  if (invalidateAllWindow)
! 	    {
! 	      gint bin_window_height;
! 
! 	      gdk_drawable_get_size (GTK_WIDGET(tree_view)->window,
! 				     NULL, &bin_window_height);
! 	      bin_window_height -= TREE_VIEW_HEADER_HEIGHT (tree_view);
! 
! 	      invalid_rect.y=0+Y_OFFSET(tree_view);
! 
! 	      invalid_rect.height=bin_window_height;
! 
! 	      gdk_window_invalidate_rect (tree_view->priv->bin_window, &invalid_rect, TRUE);
! 
! 	    }
! 	  else if (!GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] ||
! 		   GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] == (GdkPixmap*) GDK_PARENT_RELATIVE)
! 	    {
! 	      gdk_window_scroll (tree_view->priv->bin_window, dx, dy);
! 	    }
! 	  else 
! 	    {
! 	      if (tree_view->priv->bgscroll_hor != GTK_TREE_VIEW_BG_SCROLL_MOVING &&
! 		  tree_view->priv->bgscroll_ver != GTK_TREE_VIEW_BG_SCROLL_MOVING)
  		{
! 		  if (dy == 0)
  		    {
! 		      gint bin_window_height;
! 
! 		      gdk_drawable_get_size (GTK_WIDGET(tree_view)->window,
! 					     NULL, &bin_window_height);
! 		      bin_window_height -= TREE_VIEW_HEADER_HEIGHT (tree_view);
! 
! 		      invalid_rect.y=0+Y_OFFSET(tree_view);
! 		      invalid_rect.height=bin_window_height;
! 		    }
! 		  else if (dy > 0)
! 		    {
! 		      /* scroll down */
! 		      gint bin_window_height;
! 
! 		      gdk_drawable_get_size (GTK_WIDGET(tree_view)->window,
! 					     NULL, &bin_window_height);
! 		      bin_window_height -= TREE_VIEW_HEADER_HEIGHT (tree_view);
! 
! 		      //invalid_rect.y=bin_window_height-dy+Y_OFFSET(tree_view);
! 		      //invalid_rect.height=dy;
! 	
! 		      invalid_rect.y=0+Y_OFFSET(tree_view);
! 		      invalid_rect.height=bin_window_height;
! 		    }
! 		  else
! 		    {
! 		      /* scroll up */
! 		      gint bin_window_height;
! 
! 		      gdk_drawable_get_size (GTK_WIDGET(tree_view)->window,
! 					     NULL, &bin_window_height);
! 		      bin_window_height -= TREE_VIEW_HEADER_HEIGHT (tree_view);
! 
! 		      //invalid_rect.y=0+Y_OFFSET(tree_view);
! 		      //invalid_rect.height=-dy;
! 
! 		      invalid_rect.y=0+Y_OFFSET(tree_view);
! 		      invalid_rect.height=bin_window_height;
  		    }
  		}
+ 	      else if (tree_view->priv->bgscroll_ver != GTK_TREE_VIEW_BG_SCROLL_MOVING)
+ 		{
+ 		  gint bin_window_height;
+ 
+ 		  gdk_drawable_get_size (GTK_WIDGET(tree_view)->window,
+ 					 NULL, &bin_window_height);
+ 		  bin_window_height -= TREE_VIEW_HEADER_HEIGHT (tree_view);
+ 
+ 		  invalid_rect.y=0;
+ 		  invalid_rect.height=bin_window_height;
+ 		}
+ 	      else
+ 		{
+ 		  if (dy == 0)
+ 		    {
+ 		      gint bin_window_height;
+ 
+ 		      gdk_drawable_get_size (GTK_WIDGET(tree_view)->window,
+ 					     NULL, &bin_window_height);
+ 		      bin_window_height -= TREE_VIEW_HEADER_HEIGHT (tree_view);
+ 
+ 		      invalid_rect.y=0+Y_OFFSET(tree_view);
+ 		      invalid_rect.height=bin_window_height;
+ 		    }
+ 		  else if (dy > 0)
+ 		    {
+ 		      /* scroll up */
+ 		      invalid_rect.y=0+Y_OFFSET(tree_view);
+ 		      invalid_rect.height=dy;
+ 		    }
+ 		  else
+ 		    {
+ 		      /* scroll down */
+ 		      gint bin_window_height;
+ 
+ 		      gdk_drawable_get_size (GTK_WIDGET(tree_view)->window,
+ 					     NULL, &bin_window_height);
+ 		      bin_window_height -= TREE_VIEW_HEADER_HEIGHT (tree_view);
+ 
+ 		      invalid_rect.y=bin_window_height+dy+Y_OFFSET(tree_view);
+ 		      invalid_rect.height=-dy;
+ 		    }
+ 		}
+ 
+ 	      gdk_window_invalidate_rect (tree_view->priv->bin_window, &invalid_rect, TRUE);
  	    }
+         }
+ 
+       org_dy=tree_view->priv->dy;
+ 
+       if (updateX)
+ 	{
+           /* update our dx and first_column */
+           tree_view->priv->dx = (int) tree_view->priv->hadjustment->value;
+ 
+           gtk_tree_view_dx_to_first_column (tree_view);
  	}
  
!       if (updateY)
          {
            /* update our dy and top_row */
            tree_view->priv->dy = (int) tree_view->priv->vadjustment->value;
***************
*** 10536,10543 ****
              gtk_tree_view_dy_to_top_row (tree_view);
  	}
  
!       gdk_window_process_updates (tree_view->priv->header_window, TRUE);
!       gdk_window_process_updates (tree_view->priv->bin_window, TRUE);
      }
  }
  
--- 11245,11386 ----
              gtk_tree_view_dy_to_top_row (tree_view);
  	}
  
!       if ((updateX || updateY) && tree_view->priv->edited_column)
! 	{
! 	  if (GTK_IS_WIDGET (tree_view->priv->edited_column->editable_widget))
! 	    {
! 	      GList *list;
! 	      GtkWidget *widget;
! 	      GtkTreeViewChild *child = NULL;
! 
! 	      gboolean childVisible = FALSE;
! 	      gint x_offset=0;
! 	      gint y_offset=0;
! 
! 	      gboolean seenFirstColumn;
! 
! 	      gint vertical_separator;
! 	      gint horizontal_separator;
!   
!               gtk_widget_style_get (GTK_WIDGET(tree_view),
! 				    "vertical-separator", &vertical_separator,
! 				    "horizontal-separator", &horizontal_separator,
! 				    NULL);
! 	      x_offset+= horizontal_separator / 2;
! 	      //	      y_offset+= vertical_separator / 2;
! 
! 	      widget = GTK_WIDGET (tree_view->priv->edited_column->editable_widget);
! 
!               for (list = tree_view->priv->children; list; list = list->next)
!                 {
!                   child = (GtkTreeViewChild *)list->data;
!                   if (child->widget == widget)
!                     {
!                       break;
!                     }
!                 }
! 
! 	      x_offset += tree_view->priv->first_column_dx;
! 	      seenFirstColumn = childVisible = (tree_view->priv->first_column==NULL);
! 	      for (list = tree_view->priv->columns; 
! 		   list;
! 		   list = list->next)
! 		{
! 		  if (tree_view->priv->first_column && (list->data == tree_view->priv->first_column->data))
! 		    seenFirstColumn = TRUE;
! 
! 		  if (list->data == tree_view->priv->edited_column)
! 		    {
! 		      childVisible = seenFirstColumn;
! 		      break;
! 		    }
! 
! 		  if (seenFirstColumn)
!                     x_offset += ((GtkTreeViewColumn*) (list->data))->width;
! 		}
! 
! 	      if (childVisible)
! 		{
! 		  if (tree_view->priv->bgscroll_ver != GTK_TREE_VIEW_BG_SCROLL_MOVING ||
! 		      !GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] ||
! 		      GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)] == (GdkPixmap*) GDK_PARENT_RELATIVE)
! 		    {
! 		      gint bin_window_height;
! 
! 		      gdk_drawable_get_size (GTK_WIDGET(tree_view)->window,
! 					     NULL, &bin_window_height);
! 		      bin_window_height -= TREE_VIEW_HEADER_HEIGHT (tree_view);
! 
! 
! 		      y_offset += child->node_offset - tree_view->priv->dy ;
! 
! 		      /* we have to actively hide the edit widget when we are outside
! 		       * the visible page; otherwise the widget reappears at another
! 		       * instance of the tiled background (which will obviously be the 
! 		       * wrong place)
! 		       */
! 		      if ((y_offset < 0) || (y_offset > bin_window_height))
! 			childVisible = FALSE;
! 		    }
! 		  else
! 		    {
! 		      gint bin_window_height;
! 		      gint pm_height;
! 
! 		      gdk_drawable_get_size (GTK_WIDGET(tree_view)->window,
! 					     NULL, &bin_window_height);
! 		      bin_window_height -= TREE_VIEW_HEADER_HEIGHT (tree_view);
! 
! 		      gdk_drawable_get_size (GTK_WIDGET(tree_view)->style->bg_pixmap[GTK_WIDGET_STATE (tree_view)],
! 					     NULL, &pm_height);
! 
! 		      y_offset = child->y;
! 
! 		      /* we have to update the y position of the edit widget
! 		       * if we cross the break between two tiled background pictures
! 		       */
! 		      int n1=(int) (org_dy / pm_height);
! 		      int n2=(int) (tree_view->priv->dy / pm_height);
! 		      y_offset += (n1-n2)*pm_height;
! 
! 		      /* we have to actively hide the edit widget when we are outside
! 		       * the visible page; otherwise the widget reappears at another
! 		       * instance of the tiled background (which will obviously be the 
! 		       * wrong place)
! 		       */
! 		      if ((child->node_offset > tree_view->priv->dy ) &&
! 			  (child->node_offset < tree_view->priv->dy + bin_window_height))
! 			;
! 		      else
! 			childVisible = FALSE;
! 
! 		    }
! 
! 
! 		}
! 	      
! 	      //	      adjust_allocation (widget, child->x-x_offset, child->y-y_offset); 
! 
! 	      child->x=x_offset;
! 	      child->y=y_offset;
! 
! 	      if (!childVisible)
! 		gdk_window_hide (widget->window);
! 	      else
! 		{
! 		  gdk_window_show (widget->window);
! 	          gdk_window_move (widget->window,
! 			           child->x,
! 			           child->y);
! 		}
! 	    }
! 	}
! 
!       if (updateX || updateY)
! 	{
! 	  gdk_window_process_updates (tree_view->priv->header_window, TRUE);
! 	  gdk_window_process_updates (tree_view->priv->bin_window, TRUE);
! 	}
      }
  }
  
***************
*** 10673,10678 ****
--- 11516,11527 ----
        tree_view->priv->fixed_height_check = 0;
        tree_view->priv->fixed_height = -1;
        tree_view->priv->dy = tree_view->priv->top_row_dy = 0;
+       tree_view->priv->dx = tree_view->priv->first_column_dx = 0;
+ 
+ #ifdef IMPLEMENT_DRAGWINDOW_ANCHOR
+       tree_view->priv->dragwindow_anchor_set = FALSE;
+       tree_view->priv->dragwindow_anchor = GTK_ANCHOR_CENTER;
+ #endif
      }
  
    tree_view->priv->model = model;
***************
*** 10873,10878 ****
--- 11722,11728 ----
  				   gboolean     headers_visible)
  {
    gint x, y;
+   gint header_height;
    GList *list;
    GtkTreeViewColumn *column;
  
***************
*** 10884,10906 ****
      return;
  
    if (headers_visible)
!     GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE);
    else
!     GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE);
  
    if (GTK_WIDGET_REALIZED (tree_view))
      {
        gdk_window_get_position (tree_view->priv->bin_window, &x, &y);
        if (headers_visible)
  	{
! 	  gdk_window_move_resize (tree_view->priv->bin_window, x, y  + TREE_VIEW_HEADER_HEIGHT (tree_view), tree_view->priv->width, GTK_WIDGET (tree_view)->allocation.height -  + TREE_VIEW_HEADER_HEIGHT (tree_view));
  
            if (GTK_WIDGET_MAPPED (tree_view))
              gtk_tree_view_map_buttons (tree_view);
   	}
        else
  	{
! 	  gdk_window_move_resize (tree_view->priv->bin_window, x, y, tree_view->priv->width, tree_view->priv->height);
  
  	  for (list = tree_view->priv->columns; list; list = list->next)
  	    {
--- 11734,11763 ----
      return;
  
    if (headers_visible)
!     {
!       GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE);
!       header_height = TREE_VIEW_HEADER_HEIGHT (tree_view);
!     }
    else
!     {
!       header_height = TREE_VIEW_HEADER_HEIGHT (tree_view);
!       GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE);
!     }
  
    if (GTK_WIDGET_REALIZED (tree_view))
      {
        gdk_window_get_position (tree_view->priv->bin_window, &x, &y);
+ 
        if (headers_visible)
  	{
! 	  gdk_window_move_resize (tree_view->priv->bin_window, x, y  + header_height, tree_view->priv->width, GTK_WIDGET (tree_view)->allocation.height - header_height);
  
            if (GTK_WIDGET_MAPPED (tree_view))
              gtk_tree_view_map_buttons (tree_view);
   	}
        else
  	{
! 	  gdk_window_move_resize (tree_view->priv->bin_window, x, y - header_height, tree_view->priv->width, GTK_WIDGET (tree_view->priv->bin_window)->allocation.height);
  
  	  for (list = tree_view->priv->columns; list; list = list->next)
  	    {
***************
*** 10915,10921 ****
    tree_view->priv->vadjustment->page_increment = (GTK_WIDGET (tree_view)->allocation.height - TREE_VIEW_HEADER_HEIGHT (tree_view)) / 2;
    tree_view->priv->vadjustment->lower = 0;
    tree_view->priv->vadjustment->upper = tree_view->priv->height;
-   gtk_adjustment_changed (tree_view->priv->vadjustment);
  
    gtk_widget_queue_resize (GTK_WIDGET (tree_view));
  
--- 11772,11777 ----
***************
*** 10923,10928 ****
--- 11779,12001 ----
  }
  
  /**
+  * gtk_tree_view_get_bg_scrolling:
+  * @tree_view: A #GtkTreeView.
+  * @hor_bg_scrolling: the policy used for background placement in case of horizontol scrolling
+  * @ver_bg_scrolling: the policy used for background placement in case of vertical scrolling
+  *
+  * Returns %TRUE if the the @tree_view has scrollbars attached.
+  *
+  * Return value: Whether the @tree_view has scrollbars and the policy used for background placement.
+  **/
+ gboolean
+ gtk_tree_view_get_bg_scrolling (GtkTreeView          *tree_view,
+                                 GtkTreeViewBgScroll  *hor_bg_scrolling,
+                                 GtkTreeViewBgScroll  *ver_bg_scrolling)
+ {
+   gboolean result=FALSE;
+ 
+   g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
+ 
+   if (tree_view->priv->hadjustment)
+     {
+       if (hor_bg_scrolling)
+         *hor_bg_scrolling = tree_view->priv->bgscroll_hor;
+       result = TRUE;
+     }
+   else
+     {
+       if (hor_bg_scrolling)
+         *hor_bg_scrolling = GTK_TREE_VIEW_BG_SCROLL_NONE;
+     }
+ 
+   if (tree_view->priv->vadjustment)
+     {
+       if (ver_bg_scrolling)
+ 	*ver_bg_scrolling = tree_view->priv->bgscroll_ver;
+       result = TRUE;
+     }
+   else
+     {
+       if (ver_bg_scrolling)
+         *ver_bg_scrolling = GTK_TREE_VIEW_BG_SCROLL_NONE;
+     }
+ 
+   return result;
+ }
+ 
+ /**
+  * gtk_tree_view_set_bg_scrolling:
+  * @tree_view: A #GtkTreeView.
+  * @hor_bg_scrolling: the policy used for background placement in case of horizontol scrolling
+  * @ver_bg_scrolling: the policy used for background placement in case of vertical scrolling
+  *
+  * Sets the background placement in case of scrolling.
+  **/
+ 
+ void
+ gtk_tree_view_set_bg_scrolling (GtkTreeView         *tree_view,
+ 			        GtkTreeViewBgScroll hor_bg_scrolling,
+ 				GtkTreeViewBgScroll ver_bg_scrolling)
+ {
+   g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+ 
+   if ((hor_bg_scrolling ==  GTK_TREE_VIEW_BG_SCROLL_DEFAULT) &&
+       (tree_view->priv->bgscroll_hor == GTK_TREE_VIEW_BG_SCROLL_FIXED))
+     hor_bg_scrolling = GTK_TREE_VIEW_BG_SCROLL_FIXED;
+   else if ((hor_bg_scrolling ==  GTK_TREE_VIEW_BG_SCROLL_FIXED) &&
+       (tree_view->priv->bgscroll_hor == GTK_TREE_VIEW_BG_SCROLL_DEFAULT))
+     hor_bg_scrolling = GTK_TREE_VIEW_BG_SCROLL_DEFAULT;
+ 
+   if ((ver_bg_scrolling ==  GTK_TREE_VIEW_BG_SCROLL_DEFAULT) &&
+       (tree_view->priv->bgscroll_ver == GTK_TREE_VIEW_BG_SCROLL_FIXED))
+     ver_bg_scrolling = GTK_TREE_VIEW_BG_SCROLL_FIXED;
+   else if ((ver_bg_scrolling ==  GTK_TREE_VIEW_BG_SCROLL_FIXED) &&
+       (tree_view->priv->bgscroll_ver == GTK_TREE_VIEW_BG_SCROLL_DEFAULT))
+     ver_bg_scrolling = GTK_TREE_VIEW_BG_SCROLL_DEFAULT;
+ 
+ 
+   if (hor_bg_scrolling != GTK_TREE_VIEW_BG_SCROLL_NONE) 
+     {
+       if (tree_view->priv->bgscroll_hor != hor_bg_scrolling)
+ 	{
+ 	  if (hor_bg_scrolling == GTK_TREE_VIEW_BG_SCROLL_MOVING)
+ 	    {
+ 	      /* from FIXED to MOVING */
+ 	      if (tree_view->priv->hadjustment)
+ 		{
+ 		  GList* list;
+ 		  gint offset = 0;
+ 		  gboolean rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
+ 
+ 		  if (tree_view->priv->first_column)
+ 		    {
+ 		      for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
+ 			   (list != NULL) && (list != tree_view->priv->first_column);
+ 			   list = (rtl ? list->prev : list->next))
+ 			{
+ 			  offset +=((GtkTreeViewColumn*) (list->data))->width;
+ 			}
+ 		    }
+ 
+                   tree_view->priv->bgscroll_hor = hor_bg_scrolling;
+ 	          gtk_tree_view_set_first_column(tree_view, NULL, 0);
+ 
+ 		  tree_view->priv->dx *= -1;
+                   gtk_tree_view_adjustment_changed (tree_view->priv->hadjustment, tree_view);
+ 		}
+ 	    }
+ 	  else 
+ 	    {
+ 	      /* from MOVING to FIXED */
+ 	      if (tree_view->priv->hadjustment)
+ 		{
+ 		  GList* list;
+ 		  gint offset = tree_view->priv->hadjustment->value;
+ 		  gboolean rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
+ 
+ 		  GtkTreeViewColumn* column=NULL;
+ 
+ 		  for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
+ 		       (list != NULL) && (offset >= ((GtkTreeViewColumn*) (list->data))->width);
+ 		       list = (rtl ? list->prev : list->next))
+ 		    {
+ 		      column=(GtkTreeViewColumn*) (list->data);
+ 		      offset -= column->width;
+ 		    }
+ 
+ 		  tree_view->priv->dx=0;
+                   tree_view->priv->bgscroll_hor = hor_bg_scrolling;
+ 		  if (offset==0)
+ 	            gtk_tree_view_set_first_column(tree_view, column, 0);
+ 		  else if (column==NULL)
+ 	            gtk_tree_view_set_first_column(tree_view, column, -offset);
+ 		  else
+ 	            gtk_tree_view_set_first_column(tree_view, column, column->width-offset);
+ 
+                   gtk_tree_view_adjustment_changed (tree_view->priv->hadjustment, tree_view);
+ 		}
+ 	    }
+ 	}
+ 
+       if (tree_view->priv->hadjustment)
+         g_object_notify (G_OBJECT (tree_view), "bgscroll-hor");
+     }
+ 
+   if (ver_bg_scrolling != GTK_TREE_VIEW_BG_SCROLL_NONE) 
+     {
+       if (tree_view->priv->bgscroll_ver != ver_bg_scrolling)
+ 	{
+ 	  if (ver_bg_scrolling == GTK_TREE_VIEW_BG_SCROLL_MOVING)
+ 	    {
+ 	      /* from FIXED to MOVING */
+ 	      if (tree_view->priv->vadjustment)
+ 		{
+ 		  tree_view->priv->dy=0;
+                   tree_view->priv->bgscroll_ver = ver_bg_scrolling;
+ 
+                   gtk_tree_view_adjustment_changed (tree_view->priv->vadjustment, tree_view);
+ 		}
+ 	    }
+ 	  else 
+ 	    {
+ 	      /* from MOVING to FIXED */
+ 	      if (tree_view->priv->vadjustment)
+ 		{
+ 		  tree_view->priv->dy=-1;
+                   tree_view->priv->bgscroll_ver = ver_bg_scrolling;
+ 
+                   gtk_tree_view_adjustment_changed (tree_view->priv->vadjustment, tree_view);
+ 		}
+ 	    }
+  	}
+ 
+      if (tree_view->priv->vadjustment)
+         g_object_notify (G_OBJECT (tree_view), "bgscroll-ver");
+     }
+ }
+ 
+ #ifdef IMPLEMENT_DRAGWINDOW_ANCHOR
+ gboolean          
+ gtk_tree_view_get_enable_dragwindow_anchor (GtkTreeView *tree_view)
+ {
+   g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
+ 
+   return tree_view->priv->dragwindow_anchor_set;
+ }
+ 
+ void
+ gtk_tree_view_set_enable_dragwindow_anchor (GtkTreeView  *tree_view,
+                                             gboolean     setting)
+ {
+ 
+   g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+ 
+   tree_view->priv->dragwindow_anchor_set = setting;
+ }
+ 
+ gboolean
+ gtk_tree_view_get_dragwindow_anchor (GtkTreeView   *tree_view,
+                                      GtkAnchorType *anchor)
+ {
+   g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
+ 
+   *anchor = tree_view->priv->dragwindow_anchor;
+   return tree_view->priv->dragwindow_anchor_set;
+ }
+ 
+ void 
+ gtk_tree_view_set_dragwindow_anchor (GtkTreeView    *tree_view,
+                                      GtkAnchorType  anchor)
+ {
+ 
+   g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+ 
+   tree_view->priv->dragwindow_anchor = anchor;
+ }
+ #endif
+ 
+ /**
   * gtk_tree_view_columns_autosize:
   * @tree_view: A #GtkTreeView.
   *
***************
*** 12992,12998 ****
    g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
  
    if (tx)
!     *tx = wx + tree_view->priv->hadjustment->value;
    if (ty)
      *ty = wy + tree_view->priv->dy;
  }
--- 14065,14071 ----
    g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
  
    if (tx)
!     *tx = wx + tree_view->priv->dx;
    if (ty)
      *ty = wy + tree_view->priv->dy;
  }
***************
*** 13024,13030 ****
    g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
  
    if (wx)
!     *wx = tx - tree_view->priv->hadjustment->value;
    if (wy)
      *wy = ty - tree_view->priv->dy;
  }
--- 14097,14103 ----
    g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
  
    if (wx)
!     *wx = tx - tree_view->priv->dx;
    if (wy)
      *wy = ty - tree_view->priv->dy;
  }
***************
*** 13117,13125 ****
    g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
  
    if (bx)
!     *bx = wx + tree_view->priv->hadjustment->value;
    if (by)
!     *by = wy - TREE_VIEW_HEADER_HEIGHT (tree_view);
  }
  
  /**
--- 14190,14198 ----
    g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
  
    if (bx)
!     *bx = wx + tree_view->priv->dx;
    if (by)
!     *by = wy - TREE_VIEW_HEADER_HEIGHT (tree_view) + Y_OFFSET (tree_view);
  }
  
  /**
***************
*** 13145,13153 ****
    g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
  
    if (wx)
!     *wx = bx - tree_view->priv->hadjustment->value;
    if (wy)
!     *wy = by + TREE_VIEW_HEADER_HEIGHT (tree_view);
  }
  
  /**
--- 14218,14226 ----
    g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
  
    if (wx)
!     *wx = bx - tree_view->priv->dx;
    if (wy)
!     *wy = by + TREE_VIEW_HEADER_HEIGHT (tree_view) - Y_OFFSET (tree_view);
  }
  
  /**
***************
*** 13175,13181 ****
    if (bx)
      *bx = tx;
    if (by)
!     *by = ty - tree_view->priv->dy;
  }
  
  /**
--- 14248,14254 ----
    if (bx)
      *bx = tx;
    if (by)
!     *by = RBTREE_Y_TO_TREE_WINDOW_Y(tree_view, ty);
  }
  
  /**
***************
*** 13203,13209 ****
    if (tx)
      *tx = bx;
    if (ty)
!     *ty = by + tree_view->priv->dy;
  }
  
  
--- 14276,14282 ----
    if (tx)
      *tx = bx;
    if (ty)
!     *ty = TREE_WINDOW_Y_TO_RBTREE_Y(tree_view, by);
  }
  
  
***************
*** 13701,13712 ****
    expose_area.width = bin_window_width + 2;
    expose_area.height = background_area.height + 2;
  
!   gdk_draw_rectangle (drawable,
!                       widget->style->base_gc [GTK_WIDGET_STATE (widget)],
!                       TRUE,
!                       0, 0,
!                       bin_window_width + 2,
!                       background_area.height + 2);
  
    rtl = gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL;
  
--- 14774,14798 ----
    expose_area.width = bin_window_width + 2;
    expose_area.height = background_area.height + 2;
  
!   if (widget->style->bg_pixmap[GTK_WIDGET_STATE (widget)] &&
!       widget->style->bg_pixmap[GTK_WIDGET_STATE (widget)] != (GdkPixmap*) GDK_PARENT_RELATIVE)
!     {
!       gdk_draw_rectangle (drawable,
! 			  widget->style->base_gc[GTK_STATE_ACTIVE],
! 			  TRUE,
! 			  0, 0,
! 			  bin_window_width + 2,
! 			  background_area.height + 2);
!     }
!   else
!     {
!       gdk_draw_rectangle (drawable,
! 			  widget->style->base_gc [GTK_WIDGET_STATE (widget)],
! 			  TRUE,
! 			  0, 0,
! 			  bin_window_width + 2,
! 			  background_area.height + 2);
!     }
  
    rtl = gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL;
  
***************
*** 13774,13785 ****
        cell_offset += column->width;
      }
  
!   gdk_draw_rectangle (drawable,
!                       widget->style->black_gc,
!                       FALSE,
!                       0, 0,
!                       bin_window_width + 1,
!                       background_area.height + 1);
  
    return drawable;
  }
--- 14860,14884 ----
        cell_offset += column->width;
      }
  
!   if (widget->style->bg_pixmap[GTK_WIDGET_STATE (widget)] &&
!       widget->style->bg_pixmap[GTK_WIDGET_STATE (widget)] != (GdkPixmap*) GDK_PARENT_RELATIVE)
!     {
!       gdk_draw_rectangle (drawable,
! 			  widget->style->text_gc[GTK_STATE_ACTIVE],
! 			  FALSE,
! 			  0, 0,
! 			  bin_window_width + 1,
! 			  background_area.height + 1);
!     }
!   else 
!     {
!       gdk_draw_rectangle (drawable,
! 			  widget->style->black_gc,
! 			  FALSE,
! 			  0, 0,
! 			  bin_window_width + 1,
! 			  background_area.height + 1);
!     }
  
    return drawable;
  }
***************
*** 15046,15053 ****
  
    if (GTK_WIDGET_REALIZED (widget))
      {
!       gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
!       gdk_window_set_background (tree_view->priv->bin_window, &widget->style->base[widget->state]);
      }
  
    gtk_widget_queue_draw (widget);
--- 16145,16151 ----
  
    if (GTK_WIDGET_REALIZED (widget))
      {
!       SET_BACKGROUND(widget,tree_view,"state_changed");
      }
  
    gtk_widget_queue_draw (widget);




*** ../../gtk+-2.18.4.org/gtk/gtktreeview.h	2009-06-04 21:18:04.000000000 +0200
--- gtktreeview.h	2010-01-11 21:31:51.000000000 +0100
***************
*** 32,37 ****
--- 32,47 ----
  
  G_BEGIN_DECLS
  
+ #define IMPLEMENT_DRAGWINDOW_ANCHOR
+ #define IMPLEMENT_EXTENDED_TREELINES
+ 
+ typedef enum
+ {
+   GTK_TREE_VIEW_BG_SCROLL_DEFAULT,
+   GTK_TREE_VIEW_BG_SCROLL_FIXED,
+   GTK_TREE_VIEW_BG_SCROLL_MOVING,
+   GTK_TREE_VIEW_BG_SCROLL_NONE
+ } GtkTreeViewBgScroll;
  
  typedef enum
  {
***************
*** 154,160 ****
  								    GtkAdjustment             *adjustment);
  gboolean               gtk_tree_view_get_headers_visible           (GtkTreeView               *tree_view);
  void                   gtk_tree_view_set_headers_visible           (GtkTreeView               *tree_view,
! 								    gboolean                   headers_visible);
  void                   gtk_tree_view_columns_autosize              (GtkTreeView               *tree_view);
  gboolean               gtk_tree_view_get_headers_clickable         (GtkTreeView *tree_view);
  void                   gtk_tree_view_set_headers_clickable         (GtkTreeView               *tree_view,
--- 164,189 ----
  								    GtkAdjustment             *adjustment);
  gboolean               gtk_tree_view_get_headers_visible           (GtkTreeView               *tree_view);
  void                   gtk_tree_view_set_headers_visible           (GtkTreeView               *tree_view,
!                                                                     gboolean                   headers_visible);
! 
! gboolean               gtk_tree_view_get_bg_scrolling              (GtkTreeView               *tree_view,
!                                                                     GtkTreeViewBgScroll       *hor_bg_scrolling,
!                                                                     GtkTreeViewBgScroll       *ver_bg_scrolling);
! void                   gtk_tree_view_set_bg_scrolling              (GtkTreeView               *tree_view,
! 								    GtkTreeViewBgScroll        hor_bg_scrolling,
! 								    GtkTreeViewBgScroll        ver_bg_scrolling);
! 
! #ifdef IMPLEMENT_DRAGWINDOW_ANCHOR
! gboolean               gtk_tree_view_get_dragwindow_anchor         (GtkTreeView               *tree_view,
!                                                                     GtkAnchorType             *anchor);
! void                   gtk_tree_view_set_dragwindow_anchor         (GtkTreeView               *tree_view,
!                                                                     GtkAnchorType              anchor);
! 
! gboolean               gtk_tree_view_get_enable_dragwindow_anchor  (GtkTreeView               *tree_view);
! void                   gtk_tree_view_set_enable_dragwindow_anchor  (GtkTreeView               *tree_view,
!                                                                     gboolean                   setting);
! #endif
! 
  void                   gtk_tree_view_columns_autosize              (GtkTreeView               *tree_view);
  gboolean               gtk_tree_view_get_headers_clickable         (GtkTreeView *tree_view);
  void                   gtk_tree_view_set_headers_clickable         (GtkTreeView               *tree_view,




