From b934859dde06f0e01d0089e8ba242e3fedf02028 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Wed, 25 May 2011 01:49:44 +0100 Subject: [PATCH] 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 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c index 07938700f..e4c47c8b9 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;