This is the mail archive of the
guile-gtk@sourceware.cygnus.com
mailing list for the Guile project.
Re: Converting GdkEvent from C to Guile
- To: Stephen Tell <tell at cs dot unc dot edu>
- Subject: Re: Converting GdkEvent from C to Guile
- From: Marius Vollmer <mvo at zagadka dot ping dot de>
- Date: 18 Nov 1999 23:59:21 +0100
- Cc: Guile-Gtk List <guile-gtk at sourceware dot cygnus dot com>
- References: <Pine.GHP.4.10.9911181556440.27875-100000@rukbat.cs.unc.edu>
Stephen Tell <tell@cs.unc.edu> writes:
> In guile-gtk 0.17, how do I convert a pointer to a GdkEvent (or
> GdkEventButton) to an SCM so it can be passed to a guile callback?
You use
GdkEvent *ev;
SCM val;
extern sgtk_boxed_info sgtk_gdk_event_info;
val = sgtk_boxed2scm (ev, &sgtk_gdk_event_info, copyp);
COPYP determines whether sgtk_boxed2scm will amke a copy of EV or not.
If you want guile-gtk to become owner of the GdkEvent structure
pointed to by EV (i.e guile-gtk can free it whenever it likes, using
gdk_event_free) you would use FALSE for COPYP. When you want to stay
the owner of EV, say TRUE. You should only say FALSE when EV is the
result of gdk_event_copy, as a rule.
- Marius
--
(let ((p #(78 91 29 77 90 51 71 91 86 24 54 55 119 16 104 62 42 58 121 80 10
124 48 102 79 22 12 116 27 34 37 100 16 83 115 40 126))) (define (x n) (do
((i 0 (1+ i)) (s 0 (+ s (* (vector-ref p i) (expt n i))))) ((= i 37) s)))
(do ((i 1 (1+ i))) ((= i 38)) (display (integer->char (modulo (x i) 127)))))