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: Marius Vollmer <mvo at zagadka dot ping dot de>
- Subject: Re: Converting GdkEvent from C to Guile
- From: Stephen Tell <tell at cs dot unc dot edu>
- Date: Thu, 18 Nov 1999 18:49:59 -0500 (EST)
- cc: Guile-Gtk List <guile-gtk at sourceware dot cygnus dot com>
On 18 Nov 1999, Marius Vollmer wrote:
> GdkEvent *ev;
> SCM val;
> extern sgtk_boxed_info sgtk_gdk_event_info;
> val = sgtk_boxed2scm (ev, &sgtk_gdk_event_info, copyp);
Thanks, this works.
> 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.
Just to make sure I understand Gdk's (undocumented) rules: when I get the
GdkEvent as an argument to a handler set with gtk_signal_connect(),
Gdk/Gtk is going to free the event when the handler returns. So if I let
it escape to the guile-gtk world, I set COPYP to TRUE, so guile frees its
copy when it is done with it.
(Actually, I'd rather not pass the event up at all, but if the guile side
wants to pop up a menu on the event, gtk-menu-popup needs the event's time
for some reason.)
Steve
--
Steve Tell | tell@cs.unc.edu | http://www.cs.unc.edu/~tell | KF4ZPF
Research Associate, Microelectronic Systems Laboratory
Computer Science Department, UNC@Chapel Hill. W:919-962-1845