Re: 'synchronous redraw' with a DrawingArea
- From: Pascal Ognibene <pascal ognibene libertysurf fr>
- To: Sven Neumann <sven gimp org>
- Cc: gtk-list gnome org
- Subject: Re: 'synchronous redraw' with a DrawingArea
- Date: Sat, 17 Apr 2004 09:48:15 +0200
Sven Neumann wrote:
Pascal Ognibene <pascal ognibene libertysurf fr> writes:
I've an application with one main window where I draw some
diagrams, and a collection of dialog boxes, always transient for
the main window (that is, they're always on the top).
When I do modifications in a dialog box and close it it should refresh
the diagram immediately then close the box.
But it looks like the redraw of the drawing area is only made
in parts not previously covered by the dialog box. As a result,
some parts of the diagram are correct, while other
are not redrawn until I scroll the window for example.
Is there any way to force the redraw 'synchronously' to be sure
that the view is correct when the transient dialog box is closed?
(note that I use the default double buffering of gtk2 for the
X11 does enforce some restrictions on what you can do. The content of
a window obscured by another other windows needs be redrawn when it
becomes visible. There's basically no way around this. For this reason
your application window has to be able to redraw itself whenever a
part of it is exposed. You also must only draw in the expose_event
handler. If you follow that simple rule, things will just work.
Well, I do redraw in the expose_event handler... But I've realized that
my description of the problem was not accurate :-(
-I do stuff in my dialog box
-I close my dialog
-the expose_event of the drawing area is called. Only parts
that were *hidden* by the dialog box are redrawn. So 'old' parts
remain the same.
I could of course post another expose event to the drawing area but:
1) I'm not sure it would work if X11 or GTK try to merge the expose events
for optimization. This mostly depends on the timing I guess
2) if it works there would be one useless redraw...
Again, any help is welcome :-)
] [Thread Prev