TreeView flickers inside ScrolledWindow



A few months ago I described a problem with my GtkTreeView-based clock
(gworldclock, http://www.debian.org/packages/unstable/gworldclock), where it
flickers as the clock is updated each second.  A suggestion was made to
freeze it with something like gtk_widget_freeze_child_notify(..) while it is
being updated.

That suggestion did not seem to help, I could still see the flickering.
However, I think I have now isolated the flickering, it seems to come from
the GtkScrolledWindow that I placed my GtkTreeView inside (this is the only
way to get scrollbars controlling the view of a GtkTreeView, right?).  I've
got the GtkScrolledWindow set to GTK_POLICY_AUTOMATIC on the horizontal
scrollbar, so it only appears if the window is too small to fit the
displayed contents. When the window is large enough (horizontally) so that
no scrollbar is needed, then the flickering appears - a blue flash along the
bottom of the window, where the horizontal scrollbar would have been.  If I
resize the window, making it smaller, then scrollbar appears and there is no
flickering.

If I set the horizontal scrollbar policy to GTK_POLICY_NEVER, then no
scrollbar appears, but no flickering occurs either.  The drawback is the
window can not be made smaller.

Likewise setting the policy to GTK_POLICY_ALWAYS means the scrollbar is
always present, and there is no flickering.  But I think this looks ugly
when the window is wide enough to not need the scrollbar.


I've attached a pared down version of the clock, showing the essential
features demonstrating the problem.  The window is manually set too large in
line 175 and the horizontal scrollbar policy is set to GTK_POLICY_AUTOMATIC
in line 121 so that the flickering can be easily seen.  You'll see the
flickering stop when the scrollbar appears if you make the window size
smaller with your mouse.

If you comment out l.121 in favour of l.123 or l.125, you can see the other
policies at work.

The test program also shows what I tried to do with
gtk_widget_freeze_child_notify, around line 40.

The test program compiles with 
    gcc `pkg-config --cflags --libs "gtk+-2.0"` test.c -o test
Press Ctrl-C on the command line to quit.

Am I doing something wrong, or does this flickering mean there's a bug in
the interaction between GtkScrolledWindow and GtkTreeView?

I'm using GTK+ 2.0.9, haven't yet upgraded to 2.2.

Drew

-- 
PGP public key available at http://people.debian.org/~dparsons/drewskey.txt
Fingerprint: A110 EAE1 D7D2 8076 5FE0  EC0A B6CE 7041 6412 4E4A

Attachment: test.c
Description: Text Data

Attachment: pgp5H9y5bhbmg.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]