From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,cf8b802d278af5c9,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 16 Sep 2007 09:01:39 -0500 From: Brian Drummond Newsgroups: comp.lang.ada Subject: Ada newbie + Gtkada + Win2000 = ? Date: Sun, 16 Sep 2007 15:11:06 +0100 Reply-To: brian@shapes.demon.co.uk Message-ID: <6h8qe35tkcunqut5ufvjn299om46ku72uh@4ax.com> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 81.132.214.191 X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-n79ab4uzzEHMw232BuiSJu01UdLDGbZYguHP9Sexe+3sAWrBeaexZSnNZMgV/zSONGgT22pfI7KAdjb!aHcmz4qjpMCvqiu/ZA5rFAqUEl3KYEPvq6ttSw+KOe7A+d42xfjWlf+rRXnxhOPeaWlGZdaN6LwC!YM6Z X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.35 Xref: g2news2.google.com comp.lang.ada:1954 Date: 2007-09-16T15:11:06+01:00 List-Id: Just trying to learn Ada; (it's somewhat familiar after years on VHDL) and interested in making simple cross-platform Win/Linux applications... So I built the "testgtk" example (on Win2000 SP4) with Gnat2007 and GtkAda (2006 as recommended by Adacore) and... well it's unreliable; I've found quite a few ways of breaking it. (The pre-built testgdk.exe is similarly unreliable so it's not just my build). This is good exercise; if I use the tools for my own application, I'll certainly have to face - and fix - problems; the ease of uncovering and fixing problems is part of what I want from Ada. So I have fixed some; but am having trouble with others. I am posting because I am interested in two questions: (a) are these problems repeatable on other systems? (maybe some are Windows-only; maybe only my particular machine) (b) where do I start to fix the ones I'm having trouble with? (Not necessarily a complete solution; but an approach. I'm a total newbie with GTK for example) Fixed: (1) the "Misc/Cursors" demo has a spin control with a list box. Enter an odd number in the list box and watch... I can see no better fix than subtracting 1 if odd in Set_Cursor (and setting the spinner value to match), without an extensive rewrite. (Took the opportunity to replace some magic numbers with Gdk_Cursor_Type'first and 'last too) (2) Composite Widgets/plot_realtime draws "outside the box". Clip_Data(Active_Plot, True) before Add_Plot and Show seems to fix. (3) Without "test.xpm" in the executable's directory, "Containers handle_box" and some other demos fall over (constraint error in "getDrawingSize"). My fix: a new package supplies a new "Create_From_Xpm" function; this checks the file exists and substitutes a default pixmap from a constant using Gdk_Pixmap.Create_From_Xpm_D if necessary. The new package also wraps the Gdk_Pixmap type so all I do is With; Use; it in place of GDK_Pixmap, in Create_Toolbar.adb and Create_Pixmap.adb respectively. Not fixed: (1) Composite Widgets/plot_3d: pressing a rotate button obscures the other buttons. I have no idea how to proceed with this. It may be possible for the "rotate_x/y/z" functions to emit an "expose" signal to the buttons but that looks like the wrong answer. I feel there ought to be a way to alert the canvas to draw the buttons; I'd have hoped "put"ting the buttons there would do it but apparently not... Or is this a bug in GtkAda underneath? (2) Memory leaks in all the "Plot" widgets. (a) alternately selecting "Plot" and "Plot3D" I can get memory usage up to about 45MB before allocation fails; (b) "Plot_Realtime" lasts about a minute before falling over (at about 18MB memory usage) (c) "Plot_3D" leaks about 320K per press of a "Rotate" button. On the 31st press (every time I've counted!) it falls over with: gdkgc-win32.c:846 SaveDC failed: not enough memory available to process this command" and an Exception_Access_Violation. This message is typical of the failures in the other widgets too. There are two mysteries here: - why the memory leaks occur; the GTK documentation claims it manages memory for you, and why it falls over so early (even when there is about 500MB of free memory) - if there is some heap limit imposed on the program, I can't see it. (3) "plot" has a Print button. This writes a 71K Postscript file, then raises an Exception_Access_Violation. I haven't worked on this one at all. The memory leaks are concerning; it doesn't look to me as if there is a solution at the Ada level, and the point of the exercise is to escape from C, if possible. If I need to get the full set of GTK sources, build them and debug, I might, but it'll take a lot longer... Thanks in advance for any help you can offer, - Brian