Re: Gtk2::MozEmbed + DOM



On Sat, 2005-03-26 at 18:27 +0100, Scott Lanning wrote:

##  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?

Yeah, sorry, I forgot about that.  I changed the xsub to be:

##  guint32 gtk_moz_embed_get_chrome_mask (GtkMozEmbed *embed)
GtkMozEmbedChromeFlags
gtk_moz_embed_get_chrome_mask (embed)
        GtkMozEmbed *embed
    CODE:
        RETVAL = (GtkMozEmbedChromeFlags) gtk_moz_embed_get_chrome_mask (embed);
    OUTPUT:
        RETVAL

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! :)

Cool.

   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;
   });

Well, if I run that, I get:

  'Gtk2::MozEmbed'
  'Gtk2::MozEmbed::MouseEvent'

Everything looks correct, so I don't know why it doesn't work for you.
Can you verify that the marshaller gets called at all?  (Just inserting
random warn ("ping");'s should suffice.)

The only modification I did to your patch is to include 
<dom/nsIDOMMouseEvent.h> instead of just <nsIDOMMouseEvent.h> as the
latter doesn't exist on my system.

And I created the dom.typemap since your patch didn't include it:

  TYPEMAP

  nsIDOMKeyEvent *      T_GPERL_GENERIC_WRAPPER
  nsIDOMMouseEvent *    T_GPERL_GENERIC_WRAPPER

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).

The methods seem to work for me (I only tried GetButton, though).  Tests
should go into t/GtkMozEmbed.t.  You will have to change the %build_reqs
hash in Makefile.PL to require the next unstable version of Gtk2 for the
CodeGen changes.

Did you consider changing the names of the methods to match the rest of
the API (GetButton => get_button, for example)?  Studly caps don't occur
in any of the Gtk2-Perl modules, and don't look very pretty either,
IMHO.

Oh, and please use tabs for indention in the XS file since this the
quasi-standard here in Gtk2-Perl land.

-- 
Bye,
-Torsten




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