www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Clutter GObject bindings

reply Sparse Push <in val.id> writes:
What is the best way to generate GObject bindings?
I ask this because I would like to use Clutter
(http://www.clutter-project.org/) in my D program and I don't think it has D
bindings already.
Thanks
Jan 27 2012
next sibling parent reply Artur Skawina <art.08.09 gmail.com> writes:
On 01/28/12 03:02, Sparse Push wrote:
 What is the best way to generate GObject bindings?
 I ask this because I would like to use Clutter
 (http://www.clutter-project.org/) in my D program and I don't think it has D
 bindings already.
From the website, http://www.clutter-project.org/about :
 [...]

Ruby. Clutter also generates introspection data during build, for dynamic
language binding using the GObject introspection API. Learn more about GObject
introspection...
so, in theory, it should be possible to use girtod to create the bindings. http://repo.or.cz/w/girtod.git/shortlog/refs/heads/master In practice, it will likely require tweaks for some data types and errors in the introspection files (for GTK, this took me way more time than writing the xml parser and code generator; maybe much of the work is already done so this will be less painful). Also, right now, girtod does not handle certain things (eg gobject interfaces). so if clutter is using them, support will have to be added (it wasn't immediately obvious to me how to expose the parts of the API that i haven't used myself; once i figure that out, adding the support will be easy, as most of the work is already done). artur
Jan 28 2012
parent Sparse Pop <in val.id> writes:
== Quote from Artur Skawina (art.08.09 gmail.com)'s article
 On 01/28/12 03:02, Sparse Push wrote:
 What is the best way to generate GObject bindings?
 I ask this because I would like to use Clutter
 (http://www.clutter-project.org/) in my D program and I don't think it has D
 bindings already.
From the website, http://www.clutter-project.org/about :
 [...]

Ruby. Clutter also generates introspection data during build, for dynamic language binding using the GObject introspection API. Learn more about GObject introspection...
 so, in theory, it should be possible to use girtod to create the bindings.
 http://repo.or.cz/w/girtod.git/shortlog/refs/heads/master
 In practice, it will likely require tweaks for some data types and errors
 in the introspection files (for GTK, this took me way more time than writing
 the xml parser and code generator; maybe much of the work is already done so
 this will be less painful). Also, right now, girtod does not handle certain
 things (eg gobject interfaces). so if clutter is using them, support will have
 to be added (it wasn't immediately obvious to me how to expose the parts
 of the API that i haven't used myself; once i figure that out, adding the
 support will be easy, as most of the work is already done).
 artur
Thanks, I'll see how far I'll get on my own :)
Jan 28 2012
prev sibling next sibling parent Artur Skawina <art.08.09 gmail.com> writes:
On 01/28/12 17:08, Artur Skawina wrote:
 On 01/28/12 03:02, Sparse Push wrote:
 What is the best way to generate GObject bindings?
 I ask this because I would like to use Clutter
 (http://www.clutter-project.org/) in my D program and I don't think it has D
 bindings already.
From the website, http://www.clutter-project.org/about :
 [...]

Ruby. Clutter also generates introspection data during build, for dynamic
language binding using the GObject introspection API. Learn more about GObject
introspection...
so, in theory, it should be possible to use girtod to create the bindings. http://repo.or.cz/w/girtod.git/shortlog/refs/heads/master In practice, it will likely require tweaks for some data types and errors in the introspection files (for GTK, this took me way more time than writing the xml parser and code generator; maybe much of the work is already done so this will be less painful). Also, right now, girtod does not handle certain things (eg gobject interfaces). so if clutter is using them, support will have to be added (it wasn't immediately obvious to me how to expose the parts of the API that i haven't used myself; once i figure that out, adding the support will be easy, as most of the work is already done).
Started to look at this myself, but had to handle all the deps first, that took some time. As a side effect the gtk bindings improved. girtod can now generate bindings for Cogl. Not even compile tested yet, but should already give an idea how the thing will look like. If somebody familiar with Cogl would check it out and see if exposing the API this way makes sense, that would be great. http://repo.or.cz/w/girtod.git/blob/refs/heads/gtk2:/gtk2/cogl.d I'll try to get clutter done first, and will fill in the missing cogl/gl pieces then. artur
Jan 29 2012
prev sibling parent reply Artur Skawina <art.08.09 gmail.com> writes:
On 01/29/12 17:27, Artur Skawina wrote:
 On 01/28/12 17:08, Artur Skawina wrote:
 On 01/28/12 03:02, Sparse Push wrote:
 What is the best way to generate GObject bindings?
 I ask this because I would like to use Clutter
 (http://www.clutter-project.org/) in my D program and I don't think it has D
 bindings already.
From the website, http://www.clutter-project.org/about :
 [...]

Ruby. Clutter also generates introspection data during build, for dynamic
language binding using the GObject introspection API. Learn more about GObject
introspection...
so, in theory, it should be possible to use girtod to create the bindings. http://repo.or.cz/w/girtod.git/shortlog/refs/heads/master In practice, it will likely require tweaks for some data types and errors in the introspection files (for GTK, this took me way more time than writing the xml parser and code generator; maybe much of the work is already done so this will be less painful). Also, right now, girtod does not handle certain things (eg gobject interfaces). so if clutter is using them, support will have to be added (it wasn't immediately obvious to me how to expose the parts of the API that i haven't used myself; once i figure that out, adding the support will be easy, as most of the work is already done).
Started to look at this myself, but had to handle all the deps first, that took some time. As a side effect the gtk bindings improved. girtod can now generate bindings for Cogl. Not even compile tested yet, but should already give an idea how the thing will look like. If somebody familiar with Cogl would check it out and see if exposing the API this way makes sense, that would be great. http://repo.or.cz/w/girtod.git/blob/refs/heads/gtk2:/gtk2/cogl.d I'll try to get clutter done first, and will fill in the missing cogl/gl pieces then.
Done. Does the resulting clutter API look usable? http://repo.or.cz/w/girtod.git/blob/refs/heads/gtk2:/gtk2/clutter.d None of the new modules were tested - i still need code samples to port and time to fix any bugs. artur
Jan 29 2012
parent reply Sparse Push <in val.id> writes:
 Done. Does the resulting clutter API look usable?
 http://repo.or.cz/w/girtod.git/blob/refs/heads/gtk2:/gtk2/clutter.d
 None of the new modules were tested - i still need code samples to port and
time
to fix any bugs.
 artur
Now I am going to feel bad if I don't create something awesome with it just as quickly. The API looks fine to me, should be enough to play around with it. btw. You should definitely post this to the clutter website.
Jan 29 2012
next sibling parent Artur Skawina <art.08.09 gmail.com> writes:
On 01/29/12 23:51, Sparse Push wrote:
 
 Done. Does the resulting clutter API look usable?
 http://repo.or.cz/w/girtod.git/blob/refs/heads/gtk2:/gtk2/clutter.d
 None of the new modules were tested - i still need code samples to port and
time
to fix any bugs.
 artur
Now I am going to feel bad if I don't create something awesome with it just as quickly. The API looks fine to me, should be enough to play around with it. btw. You should definitely post this to the clutter website.
I wouldn't be surprised - in fact i'd expect - that at this point the new modules don't even compile. This is the first time i looked at clutter; i wanted to port some toy app and use that for testing, but the ones i found were either very unspectacular, didn't build at all, or were GPLed, which is a very bad idea for an example. Even the C example from http://wiki.clutter-project.org/wiki/Cogl/CoglBasicsExample does not work here (there's no cube, just the "Hello Cogl" line), so i'm still looking for something that will let me show off how much nicer the D version is (compared to all the C clutter code i saw so far, this is not exactly hard). Until the bindings are tested and shown to actually work, announcing them would be a bit premature. I'll try make them work in the next couple of days; there's also a "mob" girtod git branch, that anybody can push to... ;) artur
Jan 29 2012
prev sibling parent Artur Skawina <art.08.09 gmail.com> writes:
On 01/30/12 00:30, Artur Skawina wrote:
 On 01/29/12 23:51, Sparse Push wrote:
 Done. Does the resulting clutter API look usable?
 http://repo.or.cz/w/girtod.git/blob/refs/heads/gtk2:/gtk2/clutter.d
 None of the new modules were tested - i still need code samples to port and
time
to fix any bugs.
 artur
Now I am going to feel bad if I don't create something awesome with it just as quickly. The API looks fine to me, should be enough to play around with it. btw. You should definitely post this to the clutter website.
I wouldn't be surprised - in fact i'd expect - that at this point the new modules don't even compile.
Clutter should be working now. There's a trivial example ported from C at http://repo.or.cz/w/girtod.git/blob/refs/heads/master:/example_clutter1.d . That, and the comments in the D module, is the only documentation there is, but hopefully this will be enough. artur
Jan 31 2012