[cogl/wip/rig: 32/33] sdl2: return a CoglError instead of calling c_error



commit df37bfe4bcd74d1f20a8b9eb86c02de1718b8f2b
Author: Robert Bragg <robert bragg intel com>
Date:   Wed Jun 11 23:35:44 2014 +0100

    sdl2: return a CoglError instead of calling c_error
    
    This avoids calling c_error while initializing the sdl2 winsys when
    no user-event number has been allocated for cogl. This error isn't
    fatal so the code now throws a CoglError instead.

 cogl/winsys/cogl-winsys-sdl2.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/cogl/winsys/cogl-winsys-sdl2.c b/cogl/winsys/cogl-winsys-sdl2.c
index 59cfa6e..852961a 100644
--- a/cogl/winsys/cogl-winsys-sdl2.c
+++ b/cogl/winsys/cogl-winsys-sdl2.c
@@ -384,8 +384,16 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
   context->winsys = c_new0 (CoglContextSdl2, 1);
 
   if (C_UNLIKELY (renderer->sdl_event_type_set == FALSE))
-    c_error ("cogl_sdl_renderer_set_event_type() or cogl_sdl_context_new() "
-             "must be called during initialization");
+    {
+      _cogl_set_error (error, COGL_WINSYS_ERROR,
+                       COGL_WINSYS_ERROR_INIT,
+                       "The SDL2 winsys backend requires "
+                       "cogl_sdl_context_new() to be used to "
+                       "create a context, or "
+                       "cogl_sdl_renderer_set_event_type() to be "
+                       "called before cogl_context_new()");
+      return FALSE;
+    }
 
   if (!_cogl_context_update_features (context, error))
     return FALSE;


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