[cogl/wip/wayland-compositor: 12/18] renderer: set winsys on renderer before ->renderer_connect



commit 4155b97bc6dd9ad2eca682bfa2850827d90234e9
Author: Robert Bragg <robert linux intel com>
Date:   Wed May 25 01:49:44 2011 +0100

    renderer: set winsys on renderer before ->renderer_connect
    
    When iterating through all the possible window systems trying to find
    one we can successfully connect we now associated the current winsys
    vtable with the renderer before calling winsys->renderer_connect in case
    the implementation calls some other Cogl API that expects to be able to
    determine the current winsys. For example calling _cogl_get_proc_address
    when querying winsys extensions as part of a successful connect will
    need to get at the current winsys vtable.

 cogl/cogl-renderer.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c
index 0793870..e4c47c8 100644
--- a/cogl/cogl-renderer.c
+++ b/cogl/cogl-renderer.c
@@ -184,6 +184,11 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
       if (renderer_name && strcmp (winsys->name, renderer_name) != 0)
         continue;
 
+      /* At least temporarily we will associate this winsys with
+       * the renderer in-case ->renderer_connect calls API that
+       * wants to query the current winsys... */
+      renderer->winsys_vtable = winsys;
+
       if (!winsys->renderer_connect (renderer, &tmp_error))
         {
           g_string_append_c (error_message, '\n');
@@ -192,7 +197,6 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
         }
       else
         {
-          renderer->winsys_vtable = winsys;
           renderer->connected = TRUE;
           g_string_free (error_message, TRUE);
           return TRUE;



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