[gtkada] Problem with drawing
Michael Gonzalez
mgh at unican.es
Fri Nov 30 09:45:46 CET 2001
Emmanuel:
> One more thing you might want to try:
>
> Try writting the loop somewhat like:
>
> declare
> Event : Gdk_Event;
> begin
> while Events_Pending loop
> Gdk.Event.Get (Event);
> if Event /= null then
> Do_Event (Event);
> end if;
> end loop;
> end;
>
> It might help.
This made things worse because now the window blocks and is not drawn.
However, it gave me some clues. I found that the infinite sequence of
events is made of null events. These null events are somehow processed
by Main_Iteration or Main_Loop and that causes the window to be drawn.
I then tried using Peek(Event) to read the events without processing
them and I found a workaround. If I get a few consecutive null events I
exit the loop. It is something like:
last_null : integer:=0;
...
while Gtk.Main.Events_Pending loop
Gdk.Event.Peek(Event);
if event/= null then
last_null:=0;
else
last_null:=last_null+1;
end if;
Dead := Gtk.Main.Main_Iteration(False);
exit when last_null>5;
end loop;
This workaround seems to work fine. I still don't understand the reason
for the infinite sequence of null events in windows (but not in linux).
Thanks for your help.
Best regards,
Michael.
-----------------------------------------------------------------------
Michael Gonzalez Harbour E-mail: mgh at unican.es
Dpto. de Electronica y Computadores
Universidad de Cantabria Phone : +34-942-201483
Avda. de los Castros s/n
E-39005 Santander Fax : +34-942-201402
SPAIN
-----------------------------------------------------------------------
More information about the gtkada
mailing list