Re: Flicker free GtkLabel




raster@redhat.com writes:

> On 16 Oct, Miguel de Icaza scribbled:
> ->  
> ->  Hello guys,
> ->  
> ->     GtkLabels are not flicker free and this can get to be annoying when
> ->  the labels are used to display status information (Gnumeric's
> ->  auto-compute and Midnight Commander mini-status are just a few of the
> ->  places where I have spotted this problem).
> ->  
> ->     I want to write a flicker free label, it would just use a backing
> ->  pixmap to redraw its contents.  The question is where to put it:
> ->  should I extend GtkLabel and add a routine to make a gtk-label flicker
> ->  free, or should I make a new widget GtkFlickerFreeLabel or should I
> ->  just go and make a GnomeLabel that would be flicker free?

> 
> Ummmmmmmmm....... how about getting a faster machine? :)
>
> seriously.. be very carefuly. labels are no-window widgets - making
> them one will have several bad side effects:
> themes.. BOOM unless done very carefully (you'll need to cpy rhe area
> of the drawable you're about to draw on first to a pixmap - then draw
> on it, then put the pixmap back - problem. you'll need to "clear" that
> earea first to get that area free of text .. so we're back to flicker
> again...
> gtk background pixmaps - same story as themes but a little simpler.
> 
> Are you sure you want to do this? Imlpilemtning a "customisation safe"
> (ie somehting that handels somethng other than a default setup of gtk"
> flicker-fre label is not completely trivial. I'm beginning to doubt it
> can be done without giving the labela border like a button, frame etc.
> and have the "no flicker label" be a bit like the progress bar.

To explain a bit more what Raster is saying here, a label is
"transparent" - the text is drawn on top of the contents of the parent
window. This is true even for non-themes GTK+, though it doesn't
always get it right. (Such as the misdrawn labels for notebook tabs
that are sometimes seen.) 

It wouldn't be possible to make the GtkLabel flicker-free without
modifications to the core GTK+ drawing code for flicker free
drawing. (In the future, it will be possible create a global
option "draw everything flicker free").

However, once the theme code gets merged into the main branch, I think
you'll find that flicker for labels is reduced by at least 75%,
due to some changes in the ordering for redraws. You may find
that such a thing isn't really necessary.

Regards,
                                        Owen



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