[gtk+/treeview-refactor] Add temporary hack to get the row heights right
- From: Kristian Rietveld <kristian src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/treeview-refactor] Add temporary hack to get the row heights right
- Date: Sun, 28 Nov 2010 20:15:35 +0000 (UTC)
commit cbbff6c5e635d66f04e6ace4239296e24067bb93
Author: Kristian Rietveld <kris gtk org>
Date: Sun Nov 28 21:02:36 2010 +0100
Add temporary hack to get the row heights right
gtk/gtktreeviewcolumn.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index c0c2119..7f07e4d 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -2472,6 +2472,8 @@ gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
gint *width,
gint *height)
{
+ int focus_line_width;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
if (height)
@@ -2479,6 +2481,18 @@ gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
if (width)
* width = 0;
+ /* FIXME: This is a temporary hack to get things to allocate mostly right.
+ *
+ * We will add twice the focus-line-width to the for-width
+ * parameter below. If we do not do this, the height returned is the
+ * height for two lines of text instead of one. It feels like some lines
+ * get less width than expected (due to subtraction of focus_line_width?)
+ * and will unnecessarily wrap.
+ */
+ gtk_widget_style_get (tree_column->tree_view,
+ "focus-line-width", &focus_line_width,
+ NULL);
+
gtk_cell_area_context_sum_preferred_width (tree_column->cell_area_context);
gtk_cell_area_get_preferred_width (tree_column->cell_area,
@@ -2488,7 +2502,7 @@ gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
gtk_cell_area_get_preferred_height_for_width (tree_column->cell_area,
tree_column->cell_area_context,
tree_column->tree_view,
- *width,
+ *width + focus_line_width * 2,
height,
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]