[cogl/wip/rig: 27/33] Add cogl_poll_renderer_dispatch_fd api



commit 86f93fc91bd59c38831ab813814c1a60ca1ae88a
Author: Robert Bragg <robert bragg intel com>
Date:   Mon May 26 21:16:00 2014 +0100

    Add cogl_poll_renderer_dispatch_fd api
    
    This adds a cogl_poll_renderer_dispatch_fd function for dispatching any
    work associated with just a single fd returned by
    cogl_poll_renderer_get_info().

 cogl/cogl-poll.c |   19 +++++++++++++++++++
 cogl/cogl-poll.h |   27 +++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-poll.c b/cogl/cogl-poll.c
index 1f50673..68c857e 100644
--- a/cogl/cogl-poll.c
+++ b/cogl/cogl-poll.c
@@ -129,6 +129,25 @@ cogl_poll_renderer_dispatch (CoglRenderer *renderer,
     }
 }
 
+void
+cogl_poll_renderer_dispatch_fd (CoglRenderer *renderer,
+                                int fd,
+                                int events)
+{
+  CList *l;
+
+  for (l = renderer->poll_sources; l; l = l->next)
+    {
+      CoglPollSource *source = l->data;
+
+      if (source->fd == fd)
+        {
+          source->dispatch (source->user_data, events);
+          return;
+        }
+    }
+}
+
 static int
 find_pollfd (CoglRenderer *renderer, int fd)
 {
diff --git a/cogl/cogl-poll.h b/cogl/cogl-poll.h
index a7dea00..d4d4610 100644
--- a/cogl/cogl-poll.h
+++ b/cogl/cogl-poll.h
@@ -195,6 +195,33 @@ cogl_poll_renderer_dispatch (CoglRenderer *renderer,
                              const CoglPollFD *poll_fds,
                              int n_poll_fds);
 
+/**
+ * cogl_poll_renderer_dispatch_fd:
+ * @renderer: A #CoglRenderer
+ * @fd: One of the file descriptors returned by
+ *      cogl_poll_renderer_get_info()
+ * @events: The events that have been triggered on @fd
+ *
+ * Dispatches any work associated with a specific file descriptor that
+ * was previosly returned by cogl_poll_renderer_get_info(). Depending
+ * on how file descriptors are being integrated into an application
+ * mainloop it may convenient to handle the dispatching of each file
+ * descriptor separately.
+ *
+ * <note>If this api is used to dispatch work for each file descriptor
+ * separately then the application must still call
+ * cogl_poll_renderer_dispatch() for each iteration of the mainloop
+ * with a %NULL poll_fds array, with %0 length so that Cogl can run any
+ * idle work or other work not associated with a file
+ * descriptor.</note>
+ *
+ * Stability: unstable
+ */
+void
+cogl_poll_renderer_dispatch_fd (CoglRenderer *renderer,
+                                int fd,
+                                int events);
+
 COGL_END_DECLS
 
 #endif /* __COGL_POLL_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]