mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
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)
This commit is contained in:
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user