From 41b97b885a7f54e8f4d4083dc47dacaa651a6ae4 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 28 Jun 2013 12:11:20 +0100 Subject: [PATCH] poll: Always run the prepare callbacks for all sources Eventually the Wayland winsys will want to do useful work in its prepare callback before the main loop goes idle. Previously cogl_poll_renderer_get_info would stop calling any further prepare functions if it found one with a zero timeout. That would mean the Wayland prepare function might not get called before going idle in some cases. This patch changes it so that it continues to call all of the prepare functions regardless of the timeout. Reviewed-by: Robert Bragg (cherry picked from commit 02f7fa538c9d2b383fa0f601177140b571ecf315) --- cogl/cogl-poll.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/cogl/cogl-poll.c b/cogl/cogl-poll.c index c50d64816..10d156068 100644 --- a/cogl/cogl-poll.c +++ b/cogl/cogl-poll.c @@ -58,10 +58,7 @@ cogl_poll_renderer_get_info (CoglRenderer *renderer, *timeout = -1; if (!_cogl_list_empty (&renderer->idle_closures)) - { - *timeout = 0; - return renderer->poll_fds_age; - } + *timeout = 0; for (l = renderer->poll_sources; l; l = l->next) { @@ -69,13 +66,8 @@ cogl_poll_renderer_get_info (CoglRenderer *renderer, if (source->prepare) { int64_t source_timeout = source->prepare (source->user_data); - if (source_timeout == 0) - { - *timeout = 0; - return renderer->poll_fds_age; - } - else if (source_timeout > 0 && - (*timeout == -1 || *timeout > source_timeout)) + if (source_timeout >= 0 && + (*timeout == -1 || *timeout > source_timeout)) *timeout = source_timeout; } }