Re: Gtk2::MozEmbed + DOM



On Thu, 2005-03-24 at 18:40 +0100, Scott Lanning wrote:

erm, that doesn't sound right.  'typemap' should Just Work, but for other 
various reasons, you may want to call it 'dom.typemap' or the like, and add 
it to the "add_typemaps" line in the Makefile.PL.  not sure why the path is 
being mangled.

Ok, I renamed it 'dom.typemap' and added it to Makefile.PL, and now
that part is working for some reason..

I seem to remember that a typemap called "typemap" is treated specially
for whatever reason.

Another thing I'm not sure of is if I have to use
gperl_signal_set_marshaller_for; and, if so, I'm not sure
what to put for the first argument, since I didn't set up
those macros like was done for GTK_TYPE_MOZ_EMBED.
Maybe this is the problem.

gperl_signal_set_marshaller_for() expects the three arguments to be: the
type macro of the object in question (so GTK_TYPE_MOZ_EMBED is correct
in your case); the signal name in question (so you'd have to call
gperl_signal_set_marshaller_for() once for every dom_* signal you want);
and the new marshaller for that signal (that would be
gtk2perl_moz_embed_dom_key_marshal or
gtk2perl_moz_embed_dom_mouse_marshal depending on what kind of argument
the current signal takes).

About the patch:

+static void
+gtk2perl_moz_embed_dom_key_marshal (GClosure *closure,
+                                    GValue *return_value,
+                                    guint n_param_values,
+                                    const GValue *param_values,
+                                    gpointer invocation_hint,
+                                    gpointer marshal_data)
+{
+       dGPERL_CLOSURE_MARSHAL_ARGS;
+
+       GPERL_CLOSURE_MARSHAL_INIT (closure, marshal_data);
+
+       ENTER;
+       SAVETMPS;
+
+       PUSHMARK (SP);
+
+       GPERL_CLOSURE_MARSHAL_PUSH_INSTANCE (param_values);
+
+       /* param_values + 1 is the `pointer dom_event' */
+        XPUSHs (sv_2mortal (newSVnsIDOMKeyEvent ((nsIDOMKeyEvent *)
+                              g_value_get_pointer (param_values + 1))));
+
+
+       GPERL_CLOSURE_MARSHAL_PUSH_DATA;
+
+       PUTBACK;
+
+       GPERL_CLOSURE_MARSHAL_CALL (G_SCALAR);
+
+       SPAGAIN;
+
+       if (count != 1)
+               croak ("signal handlers for `dom_key_*' are supposed to "
+                      "return an integer");

You still need to actually set the return value here:

        gperl_value_from_sv (return_value, POPs);

        PUTBACK;

+       FREETMPS;
+       LEAVE;
+}

The same applies to gtk2perl_moz_embed_dom_mouse_marshal.

-- 
Bye,
-Torsten




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