On Fri, 25 Mar 2005, Torsten Schoenfeld wrote:
So, compilation now works.
I've got it mostly working, but.. after patching Gtk2::CodeGen, I still get an error, though the `gint' error is gone now:g++ -c -I/usr/include/mozilla/gtkembedmoz -I/usr/include/mozilla -I/usr/include/mozilla/xpcom -I/usr/include/mozilla/string -I/usr/include/mozilla/nspr -I/usr/local/lib/perl/5.8.4/Glib/Install -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -pthread -I. -I/usr/local/lib/perl/5.8.4/Gtk2/Install -DXTHREADS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I./build -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"0.03\" -DXS_VERSION=\"0.03\" -o xs/GtkMozEmbed.o -fPIC "-I/usr/lib/perl/5.8/CORE" xs/GtkMozEmbed.c
GtkMozEmbed.c: In function `void XS_Gtk2__MozEmbed_get_chrome_mask(PerlInterpreter*, CV*)': GtkMozEmbed.c:603: error: invalid conversion from `guint32' to ` GtkMozEmbedChromeFlags' make: *** [xs/GtkMozEmbed.o] Error 1 The relevant code generated in xs/GtkMozEmbed.c is: XS(XS_Gtk2__MozEmbed_get_chrome_mask) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Gtk2::MozEmbed::get_chrome_mask(embed)"); { GtkMozEmbed * embed = SvGtkMozEmbed (ST(0)); GtkMozEmbedChromeFlags RETVAL; /* * * line 603 follows * * */ RETVAL = gtk_moz_embed_get_chrome_mask(embed); ST(0) = newSVGtkMozEmbedChromeFlags (RETVAL); sv_2mortal(ST(0)); } XSRETURN(1); } In xs/GtkMozEmbed.xs it has: ## guint32 gtk_moz_embed_get_chrome_mask (GtkMozEmbed *embed) GtkMozEmbedChromeFlags gtk_moz_embed_get_chrome_mask (embed) GtkMozEmbed *embed As the comment indicates, gtk_moz_embed_get_chrome_mask returns `guint32', which seems to cause the error since RETVAL is now of type guint32 instead of the expected GtkMozEmbedChromeFlags'. How did you make it compile? Is it necessary to also add a CODE section to cast the return value to GtkMozEmbedChromeFlags? I cheated and added this cast to the .c file itself, RETVAL = (GtkMozEmbedChromeFlags)gtk_moz_embed_get_chrome_mask(embed); and indeed it compiled. And I added $embed->signal_connect(dom_mouse_click => sub {print "click!\n";return 1;}); to pumzilla and it printed click! when I clicked the mouse. I can't believe it works! Thanks, Torsten and muppet! :) I attached a new patch. I wrapped the key and mouse event methods, but I'm having a problem calling them on the event object from pumzilla. $embed->signal_connect(dom_mouse_click => sub { foreach my $arg (@_) { print "'", ref($arg), "'\n"; } return 1; }); This will print 'Gtk2::MozEmbed' '' because the second argument isn't an object, apparently (if I print with Data::Dumper, it's just an integer). I don't understand what's wrong, because I thought the marshaller took care of making the second argument be blessed as a Gtk2::MozEmbed::MouseEvent object. SV * newSVnsIDOMMouseEvent (nsIDOMMouseEvent *event) { SV *sv = newSV (0); return sv_setref_pv (sv, "Gtk2::MozEmbed::MouseEvent", event); } ... /* param_values + 1 is the `gpointer dom_event' */ XPUSHs (sv_2mortal (newSVnsIDOMMouseEvent ((nsIDOMMouseEvent *) g_value_get_pointer (param_values + 1)))); Then when that's solved, I have to test that the event methods work, then add the documentation, and the Makefile.PL probably needs cleaned up (at least the new version of Gtk2::CodeGen will be required; I'm not sure if extra things need to be done to check for C++ stuff).
Attachment:
gtk2mozembed.diff
Description: patch for Gtk2::MozEmbed 0.03