chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Callback nightmare


From: Pupeno
Subject: [Chicken-users] Callback nightmare
Date: Sat, 29 Oct 2005 01:03:48 -0300
User-agent: KMail/1.8.3

Hello.
I am tring to make some clean bindings for Gtk+ and I don't know how to handle 
the callbacks.
I have this procedure:

(define g-signal-connect-raw
  (foreign-lambda integer "g_signal_connect" c-pointer c-string c-pointer 
c-pointer))

which can connect a widget's signal to another procedure, but that other 
procedure has to be created like this:

(define-external 
  (hello (gtk-widget widget)
         (gpointer data))
  void
  (print "Hello, world"))

so, I though about making a g-signal-connect which would take any procedure 
and wrap it around the callback-safe lambda. But for that I have to know the 
parameters to code them and I do not. This is another valid Gtk callback:

(define-external 
  (delete_event (gtk-widget widget)
                (gdk-event event)
                (gpointer data) )
  bool
  (print "delete event occurred")
  #t)

According to the manual, they are of the form

void callback_func( GtkWidget *widget,
                    ... /* other signal arguments */
                    gpointer   callback_data );

So, I can't make a dynamic callback generator around a standard Scheme 
procedure, can I ?

For the curious I am attaching what I have so far.

Thank you.
-- 
Pupeno <address@hidden> (http://pupeno.com)

Attachment: gtkhello.scm
Description: Text Data

Attachment: pgpi2FCdpnvvp.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]