GNOME Bugzilla – Bug 136496
setting fixed_height_mode property breaks gtk_tree_model_row_changed() and related.
Last modified: 2011-02-04 16:16:53 UTC
When "fixed_height_mode" property (which is very useful, BTW) is set, gtk_tree_model_row_changed() does not update the view any more. A short program demonstrating the problem is attached to the report. Compiling it with cc `pkg-config --cflags --libs gtk+-2.0` gtktreedemo2.c will generate program that does not set fixed_height_mode and flips a cell every 0.5 seconds. Compiling it with -DBUG option enables fixed_height_mode but the program does not automatically update the modified cell any more.
Created attachment 25303 [details] gtktreedemo2.c
Mass changing gtk+ bugs with target milestone of 2.4.2 to target 2.4.4, as Matthias said he was trying to do himself on IRC and was asking for help with. If you see this message, it means I was successful at fixing the borken-ness in bugzilla :) Sorry for the spam; just query on this message and delete all emails you get with this message, since there will probably be a lot.
Here's a proposed fix. I haven't tried to compile it yet, but it should be right.
Created attachment 29280 [details] [review] Fixed height patch
Fix doesn't compile, but otherwise works fine :-)
Checked out 2.4.4: It seems that the coordinates of the invalidated rectangle are computed incorrectly: the problem still appears under certain conditions but replacing gtk_widget_queue_draw_area() with gtk_widget_queue_draw() make them disappear.
Created attachment 30483 [details] [review] Proposed fix Found it: y was computed in widget coordinates instead of window coordinates. Attached patch is to be applied against current CVS. I am not entirely convinced about TREE_VIEW_HEADER_HEIGHT() part but that is what the rest of the code does as far as I can tell.
I can't see any problems with your testcase above and the current code. Can you give a testcase demonstrating the remaining problems ?
Created attachment 30506 [details] Improved testcase The bug is simply demonstrated by flipping the bottom cell instead the top cell so that vadjustment->offset can be non-zero). Compile attached modification of the previous test with same options and scroll down to the bottom.
Works fine for me... I see the last line being updated.
Matthias: Is it the test case works fine for you? Have you compiled the test case *with* -DBUG to enable fixed-height mode? Have you *scrolled* down so that vadjustment->offset is non-zero? Which version of GTK2 have you tested with? Have you looked at the definition of gtk_tree_view_get_visible_rect(), gtk_tree_view_adjustment_changed(), gtk_tree_view_tree_to_widget_coords() (the latter two suggest that we could alternatively use tree_view->priv->dy because the adjustment is set to this value). Please be more specific.
The testcase fails to demonstrate the alleged problem for me on an unpatched gtk HEAD - I haven't tesed 2.4.x yet though
I have reproduced the problem with current CVS HEAD gtk by compiling the improved test case (id=30506) with cc `pkg-config --cflags --libs gtk+-2.0` -DBUG gtktreedemo2a.c and scrolling down without resizing the window. I have got also a confirmation that the problem is present in a following configuration: * Gnome 2.6.1, with gtk+ and glib upgraded to $ pkg-config --modversion gtk+-2.0 glib-2.0 2.4.4 2.4.5 * PowerMac running YellowDog Linux 3.01: kernel 2.4.25, gcc 3.2.2, glibc 2.3.1
Ok, I missed the -DBUG part. Can reproduce it now.
2004-08-24 Matthias Clasen <mclasen@redhat.com> * gtk/gtktreeview.c (gtk_tree_view_node_queue_redraw): Take header height and adjustment into account. (#136496, Pawek Salek)
Created attachment 30991 [details] Testcase for fixed_height_mode TreeView update problem. I'm still having trouble with the view updating in 2.4.9. I'll attach a simple test case with 2 views, one with fixed-height-mode FALSE and the other TRUE (it's in Python; sorry, my C is very rusty). Just enter some text into the entry and click the button. The fixed-height-mode view won't update until you wave your mouse over the cell.
Ah, you have to set_fix_width as well as set_sizing to TREEVIEW_COLUMN_FIXED. Then the update works. viewcol.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) viewcol.set_fixed_width(200);