From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Tell To: Marius Vollmer Cc: Guile-Gtk List Subject: Re: Converting GdkEvent from C to Guile Date: Thu, 18 Nov 1999 15:50:00 -0000 Message-id: References: <87iu2ze792.fsf@zagadka.ping.de> X-SW-Source: 1999-q4/msg00054.html 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