diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c index 37e1715ae..79e748785 100644 --- a/cogl/cogl/cogl-context.c +++ b/cogl/cogl/cogl-context.c @@ -224,6 +224,8 @@ cogl_context_new (CoglDisplay *display, memset (context->winsys_features, 0, sizeof (context->winsys_features)); context->display = g_object_ref (display); + /* Keep a backpointer to the context */ + display->context = context; /* This is duplicated data, but it's much more convenient to have the driver attached to the context and the value is accessed a diff --git a/cogl/cogl/cogl-display-private.h b/cogl/cogl/cogl-display-private.h index d88a0847b..d09c994b1 100644 --- a/cogl/cogl/cogl-display-private.h +++ b/cogl/cogl/cogl-display-private.h @@ -38,6 +38,8 @@ struct _CoglDisplay { GObjectClass parnet_class; + CoglContext *context; + gboolean setup; CoglRenderer *renderer; CoglOnscreenTemplate *onscreen_template; diff --git a/cogl/cogl/cogl-display.c b/cogl/cogl/cogl-display.c index fca1b8e1b..796031db8 100644 --- a/cogl/cogl/cogl-display.c +++ b/cogl/cogl/cogl-display.c @@ -90,6 +90,7 @@ cogl_display_new (CoglRenderer *renderer, CoglDisplay *display = g_object_new (COGL_TYPE_DISPLAY, NULL); display->renderer = g_object_ref (renderer); + renderer->display = display; display->setup = FALSE; cogl_display_set_onscreen_template (display, onscreen_template); diff --git a/cogl/cogl/cogl-renderer-private.h b/cogl/cogl/cogl-renderer-private.h index 1949f5943..d5e832e55 100644 --- a/cogl/cogl/cogl-renderer-private.h +++ b/cogl/cogl/cogl-renderer-private.h @@ -43,6 +43,9 @@ typedef const CoglWinsysVtable *(*CoglCustomWinsysVtableGetter) (CoglRenderer *r struct _CoglRenderer { GObject parent_instance; + + CoglDisplay *display; + gboolean connected; CoglDriver driver_override; const CoglDriverVtable *driver_vtable; diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c index a6851ce53..bed116eff 100644 --- a/cogl/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/cogl/winsys/cogl-winsys-glx.c @@ -261,8 +261,7 @@ static gboolean update_all_outputs (CoglRenderer *renderer) { GList *l; - - _COGL_GET_CONTEXT (context, FALSE); + CoglContext *context = renderer->display->context; if (context->display == NULL) /* during connection */ return FALSE;