Files
gtk3/debian/patches/033_treeview_resizing.patch
Loïc Minier be42e9ad9a * New upstream release series; these are development releases, the new API
may still change incompatibly.
  - Target at experimental; include check-dist.
  - Bump shlibs to >= 2.11.2.
  - Refresh patches 001_static-linking-dont-query-immodules, 005_xpmico,
    009_gtk-export-filechooser, 015_default-fallback-icon-theme,
    033_treeview_resizing, 041_ia32-libs to apply cleanly.
  - Update patch 021_loader-files-d to apply with the upstream G_MODULE
    changes and the support for included modules.
  - Update patch 030_gtkentry_password-char-circle to apply.
  - Drop patch 031_cursor-blinking-timeout, merged upstream.
  - Disable 040_filechooser_single-click for now as it doesn't apply cleanly
    and doesn't seem critical; add a description and cross-refs.
  - Update relibtoolizing patch, 070_mandatory-relibtoolize.
  - Bump up libglib2.0-dev build-dep to >= 2.13.1.
* XXX WIP XXX
2007-06-13 12:05:15 +00:00

159 lines
5.0 KiB
Diff

Index: gtk+2.0-2.11.2/gtk/gtktreeviewcolumn.c
===================================================================
--- gtk+2.0-2.11.2.orig/gtk/gtktreeviewcolumn.c 2007-06-06 14:59:53.000000000 +0200
+++ gtk+2.0-2.11.2/gtk/gtktreeviewcolumn.c 2007-06-13 11:38:51.000000000 +0200
@@ -2129,6 +2129,7 @@
tree_column->tree_view != NULL &&
GTK_WIDGET_REALIZED (tree_column->tree_view))
{
+ tree_column->use_resized_width = FALSE;
gtk_widget_queue_resize (tree_column->tree_view);
}
Index: gtk+2.0-2.11.2/gtk/gtktreeview.c
===================================================================
--- gtk+2.0-2.11.2.orig/gtk/gtktreeview.c 2007-06-06 13:43:08.000000000 +0200
+++ gtk+2.0-2.11.2/gtk/gtktreeview.c 2007-06-13 11:38:51.000000000 +0200
@@ -2105,18 +2105,20 @@
/* GtkWidget::size_allocate helper */
static void
-gtk_tree_view_size_allocate_columns (GtkWidget *widget)
+gtk_tree_view_size_allocate_columns (GtkWidget *widget,
+ gboolean width_changed)
{
GtkTreeView *tree_view;
GList *list, *first_column, *last_column;
GtkTreeViewColumn *column;
GtkAllocation allocation;
gint width = 0;
- gint extra, extra_per_column;
+ gint extra, extra_per_column, extra_for_last;
gint full_requested_width = 0;
gint number_of_expand_columns = 0;
gboolean column_changed = FALSE;
gboolean rtl;
+ gboolean update_expand;
tree_view = GTK_TREE_VIEW (widget);
@@ -2151,12 +2153,38 @@
number_of_expand_columns++;
}
- extra = MAX (widget->allocation.width - full_requested_width, 0);
+ /* Only update the expand value if the width of the widget changed,
+ * the number of expand columns are if there are no expand
+ * columns.
+ */
+ update_expand = width_changed ||
+ number_of_expand_columns != tree_view->priv->last_number_of_expand_columns ||
+ number_of_expand_columns == 0;
+
+ if (!update_expand)
+ {
+ extra = tree_view->priv->last_extra_space;
+ extra_for_last = MAX (widget->allocation.width - full_requested_width - extra, 0);
+ }
+ else
+ {
+ extra = MAX (widget->allocation.width - full_requested_width, 0);
+ extra_for_last = 0;
+
+ tree_view->priv->last_extra_space = extra;
+ }
+
if (number_of_expand_columns > 0)
extra_per_column = extra/number_of_expand_columns;
else
extra_per_column = 0;
+ if (update_expand)
+ {
+ tree_view->priv->last_extra_space_per_column = extra_per_column;
+ tree_view->priv->last_number_of_expand_columns = number_of_expand_columns;
+ }
+
for (list = (rtl ? last_column : first_column);
list != (rtl ? first_column->prev : last_column->next);
list = (rtl ? list->prev : list->next))
@@ -2211,6 +2239,10 @@
{
column->width += extra;
}
+ else if (extra_for_last > 0 && list == last_column)
+ {
+ column->width += extra_for_last;
+ }
g_object_notify (G_OBJECT (column), "width");
@@ -2245,13 +2277,13 @@
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
- if (allocation->width != widget->allocation.width)
- width_changed = TRUE;
-
widget->allocation = *allocation;
tree_view = GTK_TREE_VIEW (widget);
+ if (tree_view->priv->prev_width != widget->allocation.width)
+ width_changed = TRUE;
+
tmp_list = tree_view->priv->children;
while (tmp_list)
@@ -2338,7 +2370,7 @@
allocation->height - TREE_VIEW_HEADER_HEIGHT (tree_view));
}
- gtk_tree_view_size_allocate_columns (widget);
+ gtk_tree_view_size_allocate_columns (widget, width_changed);
if (tree_view->priv->tree == NULL)
invalidate_empty_focus (tree_view);
@@ -2749,7 +2781,7 @@
gtk_grab_add (widget);
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_IN_COLUMN_RESIZE);
- column->resized_width = column->width;
+ column->resized_width = column->width - tree_view->priv->last_extra_space_per_column;
/* block attached dnd signal handler */
drag_data = g_object_get_data (G_OBJECT (widget), "gtk-site-data");
@@ -3458,6 +3490,8 @@
{
column->use_resized_width = TRUE;
column->resized_width = new_width;
+ if (column->expand)
+ column->resized_width -= tree_view->priv->last_extra_space_per_column;
gtk_widget_queue_resize (widget);
}
@@ -11253,7 +11287,7 @@
if (GTK_WIDGET_REALIZED (tree_view))
{
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
- gtk_tree_view_size_allocate_columns (GTK_WIDGET (tree_view));
+ gtk_tree_view_size_allocate_columns (GTK_WIDGET (tree_view), FALSE);
}
g_signal_emit (tree_view, tree_view_signals[COLUMNS_CHANGED], 0);
Index: gtk+2.0-2.11.2/gtk/gtktreeprivate.h
===================================================================
--- gtk+2.0-2.11.2.orig/gtk/gtktreeprivate.h 2007-06-06 13:43:08.000000000 +0200
+++ gtk+2.0-2.11.2/gtk/gtktreeprivate.h 2007-06-13 11:38:51.000000000 +0200
@@ -264,6 +264,10 @@
gboolean tree_lines_enabled;
GdkGC *tree_line_gc;
+
+ gint last_extra_space;
+ gint last_extra_space_per_column;
+ gint last_number_of_expand_columns;
};
#ifdef __GNUC__