Re: [Vala] Rewriting GLib C code in Vala
- From: Al Thomas <astavale yahoo co uk>
- To: list vala <vala-list gnome org>
- Subject: Re: [Vala] Rewriting GLib C code in Vala
- Date: Fri, 24 Jul 2015 11:30:01 +0000 (UTC)
From: Dmitry Golovin <dima golovin in>
Sent: Friday, 24 July 2015, 10:04
Subject: [Vala] Rewriting GLib C code in Vala
I'm now transfering Cogl examples to Vala:
https://github.com/tpimh/vala-cogl
Interesting stuff. I also like the reference you've
found where someone has written an image viewer in
Genie :-) ( http://onagat.hatenablog.com/ )
I'm a GLib newbie, so I need help with rewriting cogl-crate example:
https://github.com/GNOME/cogl/blob/master/examples/cogl-crate.c
I don't fully understand what PollFD is and what function in Vala GLib
binding should be used for g_poll.
It is an event descriptor. From
https://developer.gnome.org/cogl-2.0-experimental/stable/cogl-2.0-experimental-Main-loop-integration.html
it is deliberately the same as the Unix pollfd struct ( http://www.valadoc.org/#!api=posix/Posix.pollfd )
So it may help if you look for Vala examples with that.
I understand you are trying to replicate the example exactly, but as
you progress you may want to read
https://developer.gnome.org/cogl-2.0-experimental/stable/cogl-2.0-experimental-Main-loop-integration.html
if you haven't already. This is suggesting using cogl_glib_source_new()
to get a GSource event source that can then be integrated with GLib.MainLoop
Some references:
https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html
http://valadoc.org/#!api=glib-2.0/GLib.MainLoop
https://wiki.gnome.org/Projects/Vala/AsyncSamples
https://sigquit.wordpress.com/2010/01/05/g_source_unref-and-g_source_destroy-are-your-friends/
http://stackoverflow.com/questions/21434669/creating-a-new-gsource-in-glib
https://tecnocode.co.uk/tag/gsource/
You can find relevant vapi here:
https://github.com/tpimh/vala-cogl/blob/master/vapi/cogl-2.0.vapi
Thanks, I will add this to the list of bindings wiki page
( https://wiki.gnome.org/Projects/Vala/ListOfBindings )
Al
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]