Re: visible white flash when redrawing a drawingarea



Well, there is the example clock program located at http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-drawing-clock-example.html
This has the on_expose_event() and then updates the clock every second by invalidating the drawing area's space on the screen.

Replacing that invalidate block with a call to on_expose_even(NULL) results in the flashing. As I understand it, and someone please correct me if I'm wrong, calling the on_expose_event directly results in two actual calls to the function.

The invalidate simply tells Gtk to redraw the window when it does all the redrawing stuff, typically in the idle handler. Now, you can force it to redraw immediately by calling Gtk::Window::process_all_updates() if you cannot wait for the idle handler.

--Chris

On Mon, Jun 30, 2008 at 2:46 AM, Chris Dams <chris.dams.nl@gmail.com> wrote:
Dear Chris,

2008/6/30 Chris Wilson <christopher dot g dot wilson at gmail dot com>:
> 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.

Thank you for the hint. This indeed solves the problem for me.

It still puzzles me that such a solution is necessary for such a
simple problem. How could a gtk-newbie ever find this solution on his
own..... very strange really.... makes me wonder if something like Qt
would be more usable.

All the best,
Chris



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