TreeViewColumn resizing #63732



the TreeViewColumn resizing code doesn't considers the
tree_view->priv->hadjustment. so if the tree_view is in a scrolled
window that is scrolled to the left, the column jumps away... (sorry,
uggly expanation)

attached the patch to fix this


have a nice day
detlef
--- gtktreeview.c	Thu Nov  1 07:29:35 2001
+++ ../../gtkdet/gtk/gtktreeview.c	Sun Nov  4 12:20:53 2001
@@ -1854,6 +1894,9 @@
   gtk_grab_remove (widget);
   gdk_pointer_ungrab (event->time);
 
+  if (tree_view->priv->hadjustment)
+    x += tree_view->priv->hadjustment->value;
+  
   width = gtk_tree_view_new_column_width (GTK_TREE_VIEW (widget), i, &x);
   _gtk_tree_view_column_set_width (gtk_tree_view_get_column (GTK_TREE_VIEW (widget), i), width);
 
@@ -2278,19 +2321,23 @@
 {
   gint x;
   gint new_width;
-
+  GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
+  
   if (event->is_hint || event->window != widget->window)
     gtk_widget_get_pointer (widget, &x, NULL);
   else
     x = event->x;
-
-  new_width = gtk_tree_view_new_column_width (GTK_TREE_VIEW (widget),
-					      GTK_TREE_VIEW (widget)->priv->drag_pos, &x);
-  if (x != GTK_TREE_VIEW (widget)->priv->x_drag)
-    _gtk_tree_view_column_set_width (gtk_tree_view_get_column (GTK_TREE_VIEW (widget), GTK_TREE_VIEW (widget)->priv->drag_pos), new_width);
+  
+  if (tree_view->priv->hadjustment)
+    x += tree_view->priv->hadjustment->value;
+    
+  new_width = gtk_tree_view_new_column_width (tree_view,
+					      tree_view->priv->drag_pos, &x);
+  if (x != tree_view->priv->x_drag)
+    _gtk_tree_view_column_set_width (gtk_tree_view_get_column (tree_view, tree_view->priv->drag_pos), new_width);
 
   /* FIXME: Do we need to scroll */
-  _gtk_tree_view_update_size (GTK_TREE_VIEW (widget));
+  _gtk_tree_view_update_size (tree_view);
   return FALSE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]