poll_renderer_get_info


Description:

public int poll_renderer_get_info (Renderer renderer, out PollFD[] poll_fds, out int64 timeout)

Is used to integrate Cogl with an application mainloop that is based on the unix poll(2) api (or select or something equivalent).

This api should be called whenever an application is about to go idle so that Cogl has a chance to describe what file descriptor events it needs to be woken up for.

<note>If your application is using the Glib mainloop then you should jump to the glib_source_new api as a more convenient way of integrating Cogl with the mainloop. </note>

After the function is called *poll_fds will contain a pointer to an array of PollFD structs describing the file descriptors that Cogl expects. The fd and events members will be updated accordingly. After the application has completed its idle it is expected to either update the revents members directly in this array or to create a copy of the array and update them there.

When the application mainloop returns from calling poll(2) (or its equivalent) then it should call poll_renderer_dispatch passing a pointer the array of CoglPollFD<!-- -- >s with updated revent values.

When using the cogl_winsys_id_wgl winsys (where file descriptors don't make any sense) or cogl_winsys_id_sdl (where the event handling functions of SDL don't allow blocking on a file descriptor) *n_poll_fds is guaranteed to be zero.

timeout will contain a maximum amount of time to wait in microseconds before the application should wake up or -1 if the application should wait indefinitely. This can also be 0 if Cogl needs to be woken up immediately.

Parameters:

renderer

A Renderer

poll_fds

A return location for a pointer to an array of PollFD<!-- -->s

timeout

A return location for the maximum length of time to wait in microseconds, or -1 to wait indefinitely.

n_poll_fds

A return location for the number of entries in *poll_fds

Returns:

A "poll fd state age" that changes whenever the set of poll_fds has changed. If this API is being used to integrate with another system mainloop api then knowing if the set of file descriptors and events has really changed can help avoid redundant work depending the api. The age isn't guaranteed to change when the timeout changes.


Namespace: Cogl
Package: doc