* Ada OpenGL question
@ 2009-09-15 17:18 Olivier Scalbert
2009-09-15 18:19 ` Ludovic Brenta
0 siblings, 1 reply; 5+ messages in thread
From: Olivier Scalbert @ 2009-09-15 17:18 UTC (permalink / raw)
Hi all,
I have found some OpenGL code there:
http://adaopengl.sourceforge.net/downloads.php
I manage to get it compiled on my linux box but when I run it, I have:
raised SYSTEM.ASSERTIONS.ASSERT_FAILURE : Handlers for "expose_event" on
a GtkGLArea should be functions
So it looks I have problem with callbacks somewhere around:
Destroy_CB.Connect(MyGL, "destroy", Destroy_CB.To_Marshaller( Quit'Access));
Expose_CB.Connect(MyGL, "expose_event", Expose_CB.To_Marshaller(
Expose'Access));
Resize_CB.Connect(MyGL, "configure_event", Resize_CB.To_Marshaller(
Reshape'Access));
All the files are located there:
http://scalbert.dyndns.org/ada/adagtkgl/
If somebody can help me, I would appreciate !
Thanks,
Olivier
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Ada OpenGL question
2009-09-15 17:18 Ada OpenGL question Olivier Scalbert
@ 2009-09-15 18:19 ` Ludovic Brenta
2009-09-16 6:43 ` Olivier Scalbert
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Brenta @ 2009-09-15 18:19 UTC (permalink / raw)
On Sep 15, 7:18 pm, Olivier Scalbert <olivier.scalb...@algosyn.com>
wrote:
> Hi all,
>
> I have found some OpenGL code there:http://adaopengl.sourceforge.net/downloads.php
>
> I manage to get it compiled on my linux box but when I run it, I have:
>
> raised SYSTEM.ASSERTIONS.ASSERT_FAILURE : Handlers for "expose_event" on
> a GtkGLArea should be functions
>
> So it looks I have problem with callbacks somewhere around:
> Destroy_CB.Connect(MyGL, "destroy", Destroy_CB.To_Marshaller( Quit'Access));
>
> Expose_CB.Connect(MyGL, "expose_event", Expose_CB.To_Marshaller(
> Expose'Access));
>
> Resize_CB.Connect(MyGL, "configure_event", Resize_CB.To_Marshaller(
> Reshape'Access));
>
> All the files are located there:http://scalbert.dyndns.org/ada/adagtkgl/
>
> If somebody can help me, I would appreciate !
>
> Thanks,
>
> Olivier
In your example, Expose'Access presumably designates a procedure.
This is wrong. Expose should be a function returning Boolean. The
return value means:
False: pass the signal to any other signal handlers attached to it
True: abort processing of the signal.
The same holds for delete_event and a few other signals as documented
in the GTK+ reference at http://www.gtk.org.
The GtkAda signal handler infrastructure makes it impossible to detect
the type mismatch at compile time, so it has run-time checks instead.
This is the source of the error message.
HTH
--
Ludovic Brenta.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Ada OpenGL question
2009-09-15 18:19 ` Ludovic Brenta
@ 2009-09-16 6:43 ` Olivier Scalbert
2009-09-16 7:34 ` Ludovic Brenta
0 siblings, 1 reply; 5+ messages in thread
From: Olivier Scalbert @ 2009-09-16 6:43 UTC (permalink / raw)
Ludovic Brenta wrote:
> In your example, Expose'Access presumably designates a procedure.
> This is wrong. Expose should be a function returning Boolean. The
> return value means:
>
> False: pass the signal to any other signal handlers attached to it
> True: abort processing of the signal.
>
> The same holds for delete_event and a few other signals as documented
> in the GTK+ reference at http://www.gtk.org.
>
> The GtkAda signal handler infrastructure makes it impossible to detect
> the type mismatch at compile time, so it has run-time checks instead.
> This is the source of the error message.
>
> HTH
>
> --
> Ludovic Brenta.
Thanks for your help Ludovic!
I do not know how to solve it.
I have tried to change the Expose procedure into a function returning a
Boolean, but then it does not compile anymore:
gtkgl.adb:89:66: no candidate interpretations match the actuals:
gtkgl.adb:89:87: expected type "Handler" defined at
gtk-marshallers.ads:355, instance at gtk-handlers.ads:915, instance at
line 68
gtkgl.adb:89:87: found type access to function "Expose" defined at line 89
gtkgl.adb:89:87: ==> in call to "To_Marshaller" at
gtk-handlers.ads:939, instance at line 68
gtkgl.adb:89:87: ==> in call to "To_Marshaller" at
gtk-handlers.ads:934, instance at line 68
gtkgl.adb:89:87: ==> in call to "To_Marshaller" at
gtk-handlers.ads:930, instance at line 68
gtkgl.adb:89:87: ==> in call to "To_Marshaller" at
gtk-handlers.ads:926, instance at line 68
gtkgl.adb:89:87: ==> in call to "To_Marshaller" at
gtk-handlers.ads:922, instance at line 68
gtkgl.adb:89:87: ==> in call to "To_Marshaller" at
gtk-handlers.ads:918, instance at line 68
Olivier
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Ada OpenGL question
2009-09-16 6:43 ` Olivier Scalbert
@ 2009-09-16 7:34 ` Ludovic Brenta
2009-09-16 11:51 ` Olivier Scalbert
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Brenta @ 2009-09-16 7:34 UTC (permalink / raw)
Olivier Scalbert wrote:
> Ludovic Brenta wrote:
>> In your example, Expose'Access presumably designates a procedure.
>> This is wrong. Expose should be a function returning Boolean. The
>> return value means:
>>
>> False: pass the signal to any other signal handlers attached to it
>> True: abort processing of the signal.
>>
>> The same holds for delete_event and a few other signals as documented
>> in the GTK+ reference athttp://www.gtk.org.
>>
>> The GtkAda signal handler infrastructure makes it impossible to detect
>> the type mismatch at compile time, so it has run-time checks instead.
>> This is the source of the error message.
>>
>> HTH
>
> Thanks for your help Ludovic!
>
> I do not know how to solve it.
> I have tried to change the Expose procedure into a function returning a
> Boolean, but then it does not compile anymore:
>
> gtkgl.adb:89:66: no candidate interpretations match the actuals:
> gtkgl.adb:89:87: expected type "Handler" defined at
> gtk-marshallers.ads:355, instance at gtk-handlers.ads:915, instance at
> line 68
> gtkgl.adb:89:87: found type access to function "Expose" defined at line 89
> gtkgl.adb:89:87: ==> in call to "To_Marshaller" at
> gtk-handlers.ads:939, instance at line 68
> gtkgl.adb:89:87: ==> in call to "To_Marshaller" at
> gtk-handlers.ads:934, instance at line 68
> gtkgl.adb:89:87: ==> in call to "To_Marshaller" at
> gtk-handlers.ads:930, instance at line 68
> gtkgl.adb:89:87: ==> in call to "To_Marshaller" at
> gtk-handlers.ads:926, instance at line 68
> gtkgl.adb:89:87: ==> in call to "To_Marshaller" at
> gtk-handlers.ads:922, instance at line 68
> gtkgl.adb:89:87: ==> in call to "To_Marshaller" at
> gtk-handlers.ads:918, instance at line 68
You must call GtkAda.Handlers.Return_Callback.Connect as opposed to
GtkAda.Handlers.Widget_Callback.Connect. (If you use some other
instances of Gtk.Handlers, the same holds: Return_Callback instead of
Callback).
--
Ludovic Brenta.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Ada OpenGL question
2009-09-16 7:34 ` Ludovic Brenta
@ 2009-09-16 11:51 ` Olivier Scalbert
0 siblings, 0 replies; 5+ messages in thread
From: Olivier Scalbert @ 2009-09-16 11:51 UTC (permalink / raw)
Ludovic Brenta wrote:
> You must call GtkAda.Handlers.Return_Callback.Connect as opposed to
> GtkAda.Handlers.Widget_Callback.Connect. (If you use some other
> instances of Gtk.Handlers, the same holds: Return_Callback instead of
> Callback).
>
> --
> Ludovic Brenta.
Thanks Ludovic, it works now !
Olivier
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-09-16 11:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-15 17:18 Ada OpenGL question Olivier Scalbert
2009-09-15 18:19 ` Ludovic Brenta
2009-09-16 6:43 ` Olivier Scalbert
2009-09-16 7:34 ` Ludovic Brenta
2009-09-16 11:51 ` Olivier Scalbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox