On 17/12/2007, Torsten Schoenfeld <[EMAIL PROTECTED]> wrote: > Sounds like a good idea. Can you take a stab at it? The formulations > might make more sense to newcomers if they're written by someone who > just recently learned about them.
Your explanations were excellent, so I'll copy them almost verbatim. In the "MORE COOL CODE TRICKS" section, I would have: GdkEvent gtk2-perl does not have separate typemaps for every event type. There is just one for GdkEvent which looks at the event's type at run-time to decide how to represent it. So, when binding a new widget, use GdkEvent* for the type of the argument and insert casts to the specific event required by the widget (e.g. GdkEventButton*) where needed. The xsub for gtk_window_activate_key in Gtk2/xs/GtkWindow.xs might serve as an example. Structs Unfortunately, there's no automatic way to convert raw structs to Perl land. These are, however, best represented as hash references with a key for each member. For an example of this kind of thing, take a look at the way GtkStockItem is handled in Gtk2/xs/GtkStock.xs. Once you have the converters newSVStructName and SVStructName, you can take this one step further by installing a custom typemap for them: "StructName * T_GPERL_GENERIC_WRAPPER" in a typemap file installed via ExtUtils::Depends->add_typemaps in Makefile.PL -- like Gtk2 does for gtk.typemap, for example. > You're trying to use a GdkRectangle where a GdkRectangle* is wanted. I > think this should work: Thanks, Torsten and Muppet. I briefly had the same but discarded it when I got the error message: IImageTool.xs: In function `SvDrawSettings': IImageTool.xs:62: warning: dereferencing `void *' pointer IImageTool.xs:62: error: void value not ignored as it ought to be if (svp) settings->zoom_rect = *SvGdkRectangle (*svp); Which leaves me pretty much in the dark. > By the way, why 'DrawSettings' instead of 'GdkPixbufDrawOpts'? The most recent release has 'DrawSettings', but this has been replaced in SVN with 'GdkPixbufDrawOpts'. This had me confused for a bit. Sorry I don't seem to be quite as quick on the uptake as I should... Jeff _______________________________________________ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list