diff options
author | Robert Bragg <robert@linux.intel.com> | 2013-04-16 23:46:03 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2013-04-30 16:39:31 +0100 |
commit | ed90c6fed9f5eb924868fae1f0a87e4044a19f89 (patch) | |
tree | 9b2d30b0d02841b6d0582880c4d45ccce319c80c /examples | |
parent | 816a5bc43764a3cbb6eda3a608ba71d528d66eb7 (diff) |
Move event polling into CoglRenderer
This updates the cogl_poll_ apis to allow dispatching events before we
have a CoglContext and to also enables pollfd state to be changed in a
more add-hoc way by different Cogl components by replacing the
winsys->get_poll_info with _cogl_poll_renderer_add/remove_fd functions
and a winsys->get_dispatch_timeout vfunc.
One of the intentions here is that applications should be able to run
their mainloop before creating a CoglContext to potentially get events
relating to CoglOutputs.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 667e58c9cb2662aef5f44e580a9eda42dc8d0176)
Diffstat (limited to 'examples')
-rw-r--r-- | examples/cogl-crate.c | 7 | ||||
-rw-r--r-- | examples/cogl-msaa.c | 6 | ||||
-rw-r--r-- | examples/cogl-x11-foreign.c | 6 |
3 files changed, 13 insertions, 6 deletions
diff --git a/examples/cogl-crate.c b/examples/cogl-crate.c index 47de34d0..cdd6a7cf 100644 --- a/examples/cogl-crate.c +++ b/examples/cogl-crate.c @@ -274,6 +274,7 @@ main (int argc, char **argv) &data, NULL); /* destroy notify */ + while (1) { CoglPollFD *poll_fds; @@ -286,12 +287,14 @@ main (int argc, char **argv) cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb)); } - cogl_poll_get_info (ctx, &poll_fds, &n_poll_fds, &timeout); + cogl_poll_renderer_get_info (cogl_context_get_renderer (ctx), + &poll_fds, &n_poll_fds, &timeout); g_poll ((GPollFD *) poll_fds, n_poll_fds, timeout == -1 ? -1 : timeout / 1000); - cogl_poll_dispatch (ctx, poll_fds, n_poll_fds); + cogl_poll_renderer_dispatch (cogl_context_get_renderer (ctx), + poll_fds, n_poll_fds); } return 0; diff --git a/examples/cogl-msaa.c b/examples/cogl-msaa.c index 4a388bc7..49e395e3 100644 --- a/examples/cogl-msaa.c +++ b/examples/cogl-msaa.c @@ -105,9 +105,11 @@ main (int argc, char **argv) cogl_onscreen_swap_buffers (onscreen); - cogl_poll_get_info (ctx, &poll_fds, &n_poll_fds, &timeout); + cogl_poll_renderer_get_info (cogl_context_get_renderer (ctx), + &poll_fds, &n_poll_fds, &timeout); g_poll ((GPollFD *) poll_fds, n_poll_fds, 0); - cogl_poll_dispatch (ctx, poll_fds, n_poll_fds); + cogl_poll_renderer_dispatch (cogl_context_get_renderer (ctx), + poll_fds, n_poll_fds); } return 0; diff --git a/examples/cogl-x11-foreign.c b/examples/cogl-x11-foreign.c index e9ac93d9..1622266c 100644 --- a/examples/cogl-x11-foreign.c +++ b/examples/cogl-x11-foreign.c @@ -188,9 +188,11 @@ main (int argc, char **argv) * then allow Cogl to dispatch any corresponding event * callbacks, such as resize notification callbacks... */ - cogl_poll_get_info (ctx, &poll_fds, &n_poll_fds, &timeout); + cogl_poll_renderer_get_info (cogl_context_get_renderer (ctx), + &poll_fds, &n_poll_fds, &timeout); g_poll ((GPollFD *) poll_fds, n_poll_fds, 0); - cogl_poll_dispatch (ctx, poll_fds, n_poll_fds); + cogl_poll_renderer_dispatch (cogl_context_get_renderer (ctx), + poll_fds, n_poll_fds); cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); cogl_framebuffer_draw_primitive (fb, pipeline, triangle); |