[gtkada] Heap corruption and other problems

Chris Sparks mr_ada at cox.net
Tue Aug 13 05:46:29 CEST 2013


Dmitry A. Kazakov wrote:
> Glib.Main.Timeout_Add + Gtk.Widget.Queue_Draw from there. It should 
> not be tighter than 20ms, human eye cannot see any difference anyway. 
> This is exactly how the refresh engine from AICWL works. It is used 
> for animated widgets like the oscilloscope, clocks etc. 
I'd like to see an example of this.  This new way of dealing with main 
loops is a bit daunting without an example.

I found the error in my small demo!  I was drawing my box demo every 
cycle, because of a variable I used to get the Event_Type which didn't 
change so it called my routine over and over.
> I don't understand this. Your widget must be a descendant of at least 
> Gtk_Widget_Record.
No.  I create my own Widgets using Gdk.Window as a base and my own class 
hierarchy.
> I am waiting for other problems resolved and GtkAda packaged for 
> Linux. I can post code snippets from AICWL if you are interested.
I would appreciate all the help I can get.
> Gdk_Window is unusable, IMO.
That is all I use.  It has become less useful because of Cairo but I 
wouldn't say it is unusable! :-)
> You should *first* do all transformations and only *then* use 
> Show_Layout. 
The way the example was done I'd have to redo it to try as you suggest, 
but what you say does make sense.
> I know it sounds crazy, but this is how Cairo works. Keep in mind 
> doing Translate to the point around which you rotate the text and 
> Move_To to the point where you start drawing the text origin. If you 
> stretch and skew the text you should use Get_Extents before that and 
> take into account gains afterwards, which may become a linear 
> combination of cosine and sine. This is the way AICWL draws its texts. 
> I didn't use Update_Layout because I didn't figure from the 
> documentation what it did exactly and because I am using Cairo toy 
> fonts in the same code. The common denominator for both is get extents 
> + show. 
I just commented out Update_Layout and it had zero effect!  Good catch.

Chris


More information about the gtkada mailing list