After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 687816 - GtkTreeView does not draw correctly since commit aaedc7b6
GtkTreeView does not draw correctly since commit aaedc7b6
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
3.6.x
Other Linux
: Normal major
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks:
 
 
Reported: 2012-11-06 23:39 UTC by John Lindgren
Modified: 2012-11-26 02:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Recalculate row height when adding columns (499 bytes, patch)
2012-11-06 23:39 UTC, John Lindgren
none Details | Review

Description John Lindgren 2012-11-06 23:39:55 UTC
Created attachment 228322 [details] [review]
Recalculate row height when adding columns

Forwarded from https://bugs.archlinux.org/task/32343.

In Audacious, we create a GtkTreeView like so:

    gtk_tree_view_new_with_model()
    gtk_tree_view_set_fixed_height_mode(TRUE)
    gtk_tree_view_append_column()
    gtk_tree_view_append_column()
    ...

gtk_tree_view_set_fixed_height_mode() calls validate_row() on one row of the model in order to calculate the row height for all rows.  The problem is, the row height cannot be calculated correctly before columns are added to the view, leading to visual corruption as illustrated in this screencast:

    https://bugs.archlinux.org/task/32343?getfile=9556

Before commit aaedc7b6, this was not a problem because gtk_tree_view_style_updated() was called when the treeview was realized (after the columns had been added), causing the row height to be recalculated.  Commit aaedc7b6 causes the gtk_tree_view_style_updated() call to be optimized out, and as an unintended consequence, the treeview is now drawn with the incorrect row height calculated by gtk_tree_view_set_fixed_height_mode() before any columns were added.

I am attaching a patch that copies into gtk_tree_view_insert_column() the same two lines used in gtk_tree_view_style_updated() to make sure that the row height gets recalculated.  There may be a more optimal fix, but this at least gets the job done.
Comment 1 Benjamin Otte (Company) 2012-11-26 00:26:49 UTC
Should be fixed (with testcase) in master and GTK 3.6.
Comment 2 John Lindgren 2012-11-26 02:00:05 UTC
Fixed for me, thanks!