summaryrefslogtreecommitdiff
path: root/cogl/cogl-win32-renderer.c
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2013-05-14 15:43:04 +0100
committerNeil Roberts <neil@linux.intel.com>2013-05-17 11:34:45 +0100
commit99a7f84d7149f24f3e86c5d3562f9f2632ff6df8 (patch)
treec33444d6bb02d40eaf099c6819c1a94220dd8ef9 /cogl/cogl-win32-renderer.c
parentd5261ecc3fb9152811d48a516462fede76c4674b (diff)
downloadcogl-99a7f84d7149f24f3e86c5d3562f9f2632ff6df8.tar.gz
win32: Automatically process windows messages when using a GMainLoop
Previously the WGL winsys was expecting the application to send all windows messages to Cogl via the cogl_win32_renderer_handle_event function. When using a GLib main loop we can make this work transparently to the application with a GSource for the magic G_WIN32_MSG_HANDLE file descriptor. That causes the GMainLoop to wake up whenever a message is available. This patch makes the WGL winsys add that magic value as a source fd. This will only have any meaning if the application is using glib, but it shouldn't matter because the cogl_poll_renderer_get_info function is documented to only work on Unix-based winsys's anyway. This patch is an API break because by default Cogl will now start stealing all of the Windows messages. Something like Clutter that wants to handle its own event retrieval would now need to call cogl_win32_renderer_set_event_retrieval_enabled to stop Cogl from stealing the events. Reviewed-by: Robert Bragg <robert@linux.intel.com>
Diffstat (limited to 'cogl/cogl-win32-renderer.c')
-rw-r--r--cogl/cogl-win32-renderer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/cogl/cogl-win32-renderer.c b/cogl/cogl-win32-renderer.c
index ad7e7912..89094cb7 100644
--- a/cogl/cogl-win32-renderer.c
+++ b/cogl/cogl-win32-renderer.c
@@ -56,3 +56,13 @@ cogl_win32_renderer_remove_filter (CoglRenderer *renderer,
(CoglNativeFilterFunc)func, data);
}
+void
+cogl_win32_renderer_set_event_retrieval_enabled (CoglRenderer *renderer,
+ CoglBool enable)
+{
+ _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer));
+ /* NB: Renderers are considered immutable once connected */
+ _COGL_RETURN_IF_FAIL (!renderer->connected);
+
+ renderer->win32_enable_event_retrieval = enable;
+}