Re: GtkProgressBar ignoring gtk_widget_queue_draw()

Richard Stellingwerff wrote:

I am new to this list, so please bear with me :)

Currently I'm working on a gtk engine called Clearlooks. Based on a
nice idea from jimmac, I tried to implement an animated progressbar.

Unfortunately, it seems that no matter how often I call
gtk_widget_queue_draw() on a GtkProgressBar, it will not get redrawn.
Apparently there's some double-double buffering going on or something.
I added printf() to the draw_box method, but it never gets drawn on a
GtkProgressBar's expose event. It only gets called after a resize
event. So somewhere the contents are kept offscreen and then just
blitted onto the screen. This is not the case for other widgets like
buttons. An expose event will cause a redraw event.

The great thing about an open source toolkit is that you don't
have to speculate, you can just go and look.

I am not sure why GtkProgressBar is different in this regard.

History probably ... prior to GTK+-2.0, a widget that was animating
like GtkProgressBar would flash if it didn't have its own double

Can a
redraw somehow be forced? I need to do this, because a timeout will
periodically call a repaint to all visible progressbars.

Well, you are looking to do something awful anyways (call
gtk_widget_queue_draw() out of a theme engine), so given that, you
could investigate the further awfulness of doing:

 GTK_PROGRESS_GET_CLASS(progressbar)->paint (GTK_PROGRESS(progressbar));
 gtk_widget_queue_draw (progressbar);

Jimmac's animated scrollbar mockup can be found here:

It appears that a GtkButton has a NO_WINDOW and MAPPED widget flag,
while GtkProgressBar has not. I'm not sure if either one has something
to do with it, since I can't really find any straight answers in the

I think you are going to run into the problem that apps frequently
put up a progress bar and only run the main loop occasioanlly to
update the progress bar when the application changes the value ...
that is, you aren't going to get a nice smooth animation.


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