Re: GtkImageView



On 15/02/2008, muppet <scott asofyet org> wrote:
It's a struct (data structure), not an enum (enumeration of constant
 values).

Yes, of course it is. Fingers getting ahead of the brain.

 You've marked your newSVGdkPixbufDrawOpts() and SvGdkPixbufDrawOpts()
 functions with the C storage class keyword "static", which means that
 the function is visible only within that C file.  Since you need to
 share the functions between two files, remove the static keyword from
 those functions in one file, and remove the definitions altogether
 from the other file.

Ah. Thanks.

 Still another option, more correct but more work, is to register a
 GBoxed wrapper for the structure.  Then everything will Just Wonk.

OK. I think I have got the GBoxed wrappers working.

 Torsten recently added to Glib some useful functions for this purpose,
 including gperl_sv_is_hash_ref():

That would be excellent, apart from it being too new to be in any
current distribution.

 Blessing the hash would help you do even more validation, but is not
 strictly necessary.  If your user is allowed to supply a plain old
 hash of his own making, then requiring a blessed hash will be
 breakage, but if the user is supposed to use one of your methods to
 create one of these things, then blessing the hash is A Very Good Idea.

If I wanted to bless the hash, I assume I would have to do it in the

SV *
newSVGdkPixbufDrawOpts

function, and therefore above the MODULE, which is pure C, and

ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Gtk2::Gdk::Pixbuf::Draw::Opts", (void*)RETVAL);

isn't going to work. How do I do it?

Lastly, I am getting

IImageTool.c: In function 'XS_Gtk2__ImageView__Tool_paint_image':
IImageTool.c:96: warning: initialization makes pointer from integer
without a cast

which is

GdkPixbufDrawOpts *     opts = SvGdkPixbufDrawOpts (ST(1));

as SvGdkPixbufDrawOpts is defined as a GdkPixbufDrawOpts * in
DrawCache.xs, I assume it is saying that ST(1) isn't SV *. But I don't
see how to fix it.

Regards

Jeff



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