Re: GObject introspection for cairo

2015-01-23 Thread Nicola Fontana
Il Thu, 22 Jan 2015 09:50:00 -0800 "Jasper St. Pierre"  
scrisse:

> Cairo-GObject provides access to enums, but it won't automatically get you
> great cairo bindings. It might actually get you 90% of the way there,
> though, and I'd be interested seeing how far you can run with just that,
> and be happy to merge patches that make it easier.

Hi Jasper,

I'm not arguing against developing glue code for cairo. In fact my
specific problem is exactly a missing access to an enum type.

My knowledge on bindings internals is limited, but I think exposing
the GBoxed wrappers can also help the lifetime management of the
underlying types, and I bet memory leaks are the n.1 problems in
language bindings.

Ciao.
-- 
Nicola
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: GObject introspection for cairo

2015-01-22 Thread Nicola Fontana
Il Thu, 22 Jan 2015 16:28:19 + Emmanuele Bassi  scrisse:

> if you have patches, please attach them on Bugzilla.

Patches attached to bug #743364:
https://bugzilla.gnome.org/show_bug.cgi?id=743364

Ciao.
-- 
Nicola
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: GObject introspection for cairo

2015-01-22 Thread Jasper St. Pierre
Cairo-GObject provides access to enums, but it won't automatically get you
great cairo bindings. It might actually get you 90% of the way there,
though, and I'd be interested seeing how far you can run with just that,
and be happy to merge patches that make it easier.

Why? cairo has a subtype system where you have subtypes of cairo_surface_t
(e.g. cairo_image_surface_t) or cairo_pattern_t (e.g.
cairo_gradient_pattern_t) where some objects have special methods. You
determine which type this is by calling cairo_surface_get_type(); and
matching it against a closed enum (cairo_surface_type_t).

It might be enough to do 90% of the work with GObject-Introspection and
write some small by-hand functions when you need to "cast" to a specific
type in your binding, but you do always need some small native glue code
that calls cairo_surface_get_type();

On Thu, Jan 22, 2015 at 9:39 AM, Nicola Fontana  wrote:

> Il Thu, 22 Jan 2015 16:28:19 + Emmanuele Bassi 
> scrisse:
>
> > Cairo is not a GObject library, so introspection is fairly useless.
>
> Hi Emmanuele,
>
> the cairo source tree includes cairo-gobject [1] that already wraps
> enums and structs in GObject style. I just browsed the code and added
> the missing types to the gir file.
>
> > for Cairo, you should always prefer native bindings — like pycairo, or
> > the cairo GJS module.
>
> I'm using LGI [2] which provides automatic bindings based on GObject
> introspection. This gives me the ability to access all the libraries I
> need (cairo is only one of them) through the same interface.
>
> One of my API needs the cairo_surface_type_t enum, so adding a new
> dependency only for that is not an option. If the patches are rejected
> I'll wrap the enum on my side instead (or drop that particular feature).
>
> > if you have patches, please attach them on Bugzilla.
>
> Sorry, my bad. I had really hard time trying to figure out how to submit
> bugs to gobject-introspection. I just discovered (10 mins ago) I need to
> select GLib as product first.
>
> Ciao.
> --
> Nicola
>
> [1] http://cgit.freedesktop.org/cairo/tree/util/cairo-gobject
> [2] https://github.com/pavouk/lgi
> ___
> gtk-devel-list mailing list
> gtk-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-devel-list
>



-- 
  Jasper
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: GObject introspection for cairo

2015-01-22 Thread Nicola Fontana
Il Thu, 22 Jan 2015 16:28:19 + Emmanuele Bassi  scrisse:

> Cairo is not a GObject library, so introspection is fairly useless.

Hi Emmanuele,

the cairo source tree includes cairo-gobject [1] that already wraps
enums and structs in GObject style. I just browsed the code and added
the missing types to the gir file.

> for Cairo, you should always prefer native bindings — like pycairo, or
> the cairo GJS module.

I'm using LGI [2] which provides automatic bindings based on GObject
introspection. This gives me the ability to access all the libraries I
need (cairo is only one of them) through the same interface.

One of my API needs the cairo_surface_type_t enum, so adding a new
dependency only for that is not an option. If the patches are rejected
I'll wrap the enum on my side instead (or drop that particular feature).

> if you have patches, please attach them on Bugzilla.

Sorry, my bad. I had really hard time trying to figure out how to submit
bugs to gobject-introspection. I just discovered (10 mins ago) I need to
select GLib as product first.

Ciao.
-- 
Nicola

[1] http://cgit.freedesktop.org/cairo/tree/util/cairo-gobject
[2] https://github.com/pavouk/lgi
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: GObject introspection for cairo

2015-01-22 Thread Emmanuele Bassi
hi;

On 22 January 2015 at 16:13, Nicola Fontana  wrote:

> I need introspection access to a type actually not exported in
> cairo-1.0.gir, and in fact that gir file exports only a fraction of the
> types available.

Cairo is not a GObject library, so introspection is fairly useless.
the only reason why Cairo has introspection data is for GObject
properties and signal marshallers, as well as Cairo types in exposed
in public API in other libraries; the Cairo type system is not mapped
to the GObject type system, so introspection cannot do much to
differentiate calls on, say, an image surface and an xlib surface.

for Cairo, you should always prefer native bindings — like pycairo, or
the cairo GJS module.

> The patches [1] and [2] addresses this issue: any chance to get them
> merged before the next release?

> [1] https://bugzilla.gnome.org/show_bug.cgi?id=686107
> [2] https://github.com/GNOME/gobject-introspection/pull/1

please, do not use pull requests on the Github mirror: nobody looks at
them, and cannot be merged from there anyway (it's a read-only
mirror).

if you have patches, please attach them on Bugzilla.

ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


GObject introspection for cairo

2015-01-22 Thread Nicola Fontana
Hi all,

I need introspection access to a type actually not exported in
cairo-1.0.gir, and in fact that gir file exports only a fraction of the
types available.

The patches [1] and [2] addresses this issue: any chance to get them
merged before the next release?

Ciao.
-- 
Nicola

[1] https://bugzilla.gnome.org/show_bug.cgi?id=686107
[2] https://github.com/GNOME/gobject-introspection/pull/1
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list