Removing hack and fixing gtk_tree_view_column_cell_get_size().
Now consult gtk_cell_area_context_get_preferred_height(). It can be that height-for-widths requested here were too large when multiple cells are in play because of the alignments stored in the context... removing the temporary focus-line-width hack.
This commit is contained in:
parent
0f4a2d322b
commit
c8c5ed8fa1
@ -2473,44 +2473,36 @@ gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
|
|||||||
gint *width,
|
gint *width,
|
||||||
gint *height)
|
gint *height)
|
||||||
{
|
{
|
||||||
int focus_line_width;
|
gint min_width = 0, min_height = 0;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
||||||
|
|
||||||
if (height)
|
|
||||||
* height = 0;
|
|
||||||
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);
|
|
||||||
|
|
||||||
g_signal_handler_block (tree_column->cell_area_context,
|
g_signal_handler_block (tree_column->cell_area_context,
|
||||||
tree_column->context_changed_signal);
|
tree_column->context_changed_signal);
|
||||||
|
|
||||||
gtk_cell_area_get_preferred_width (tree_column->cell_area,
|
gtk_cell_area_get_preferred_width (tree_column->cell_area,
|
||||||
tree_column->cell_area_context,
|
tree_column->cell_area_context,
|
||||||
tree_column->tree_view,
|
tree_column->tree_view,
|
||||||
width, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
|
gtk_cell_area_context_get_preferred_width (tree_column->cell_area_context, &min_width, NULL);
|
||||||
|
|
||||||
gtk_cell_area_get_preferred_height_for_width (tree_column->cell_area,
|
gtk_cell_area_get_preferred_height_for_width (tree_column->cell_area,
|
||||||
tree_column->cell_area_context,
|
tree_column->cell_area_context,
|
||||||
tree_column->tree_view,
|
tree_column->tree_view,
|
||||||
*width + focus_line_width * 2,
|
min_width,
|
||||||
height,
|
&min_height,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_signal_handler_unblock (tree_column->cell_area_context,
|
g_signal_handler_unblock (tree_column->cell_area_context,
|
||||||
tree_column->context_changed_signal);
|
tree_column->context_changed_signal);
|
||||||
|
|
||||||
|
|
||||||
|
if (height)
|
||||||
|
* height = min_height;
|
||||||
|
if (width)
|
||||||
|
* width = min_width;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user