In-Reply-To: <20031006155810.GC17693 at redhat.com> References: <16257.23215.301128.102559 at tyminouch.dyndns.org> <20031006145738.GA17693@redhat.com> <20031006155810.GC17693@redhat.com> Subject: Re: Embedding Mozilla / Gecko To: rich at annexia.org Cc: lablgtk at kaba.or.jp Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20031007102338O.garrigue at kurims.kyoto-u.ac.jp> Date: Tue, 07 Oct 2003 10:23:38 +0900 From: Jacques Garrigue Lines: 51 From: Richard Jones > There is actually one problem with the above tarball. It wraps the > new_window signal up incorrectly. > > The new_window signal is defined as: > > void (* new_window) (GtkMozEmbed *embed, GtkMozEmbed **newEmbed, > guint chromemask); > > The signal is supposed to create a new window and return it through the > second argument. > > The original (lablgtk1 code) is: > > let new_window : ([>`mozembed], chrome_flags list -> mozembed obj) t = > (* since chromemask is 32bit flags, we cannot use > parsed gtkArgv.data. We get nativeint from GtkArgv.t directly *) > let marshal f argv _ = > let chromemask = get_nativeint argv 1 in > let res = f (vallist_flags chromemask) in > GtkArgv.Arg.set_retloc (GtkArgv.nth argv 0) (`OBJECT(Some res)) > in > { name = "new_window"; marshaller = marshal } > > I'm not sure how to rewrite this code to use Gobject.Closures, because > they don't see to support anything like the set_retloc function. You might be right, I don't see any such thing either. A function poke_nativeint : boxed -> nativeint -> unit is missing in the Gpointer module. I will add it. With such a function, it's just a change in function names, following changes in Gtk. There are also changes in offsets, as the first argument is the object itself. So I would expect the following to work (module some debugging): open Gobject let new_window : ([>`mozembed], chrome_flags list -> mozembed obj) t = (* since chromemask is 32bit flags, we cannot use parsed gtkArgv.data. We get nativeint from GtkArgv.t directly *) let marshal f argv _ = let chromemask = Closure.get_nativeint argv 2 in let res = f (vallist_flags chromemask) in let ptr = Closure.get_pointer argv 1 in Gpointer.poke_nativeint ptr (Obj.magic (res : [>`mozembed] obj) : nativeint) in { name = "new_window"; classe=`mozembed; marshaller = marshal } Jacques