Re: visible white flash when redrawing a drawingarea



I had this problem a while ago. While the details are a little foggy (wasn't documenting changes as well as I should have, I've gotten better). Instead of calling the on_expose_event, try just invalidating that area.

void myDrawingAreaClass::invalidate()
{
    Glib::RefPtr<Gdk::Window> window = get_window();
    if ( window )
    {
        Gdk::Rectangle r ( 0, 0, get_allocation().get_width(), get_allocation().get_height() );
        window->invalidate_rect ( r, false );
    }
}

I think that's what worked for me.

Sorry if anyone gets this twice.
On Sun, Jun 29, 2008 at 10:00 AM, Chris Dams <chris.dams.nl@gmail.com> wrote:
Dear all,

I have a class that inherits from DrawingArea of which the visible
contents should change a bit after a certain signal occurs. I do this
by connecting this signal to a method that modifies the data
representation of the drawingarea and thereafter calls
on_expose_event(NULL) to redraw the drawing area. This on_expose_event
is my own method that overrides the virtual function on_expose_event
of the class DrawingArea. This seems to work just fine in principle,
but I do notice that sometimes (not always) the redrawing causes a
clearly visible white flash of the DrawingArea. It also happens
sometimes that the white flash only occurs in the upper or lower part
of the DrawingArea. A bit of experimentation with the code leads to
the conclusion that the drawing is at first done invisibly to the user
and that, after the drawing is finished, the visible DrawingArea is
updated to show the new picture. My question is if there is anything I
can do to avoid seeing the white flash, which, I think, is very ugly.
Is this a bug in libgtk?

I use gtkmm version 2.4 that came with my ubuntu installation and
version 7.2.0 of the Xorg X-server.

All the best,
Chris
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list



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