diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index cdb342f5d..80b5ae5de 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -83,6 +83,10 @@ cogl_public_h = \
$(NULL)
cogl_experimental_h = \
+ $(srcdir)/cogl-renderer.h \
+ $(srcdir)/cogl-swap-chain.h \
+ $(srcdir)/cogl-onscreen-template.h \
+ $(srcdir)/cogl-display.h \
$(srcdir)/cogl-context.h \
$(srcdir)/cogl2-path.h \
$(srcdir)/cogl2-clip-state.h \
@@ -161,6 +165,18 @@ cogl_sources_c = \
$(srcdir)/cogl-handle.h \
$(srcdir)/cogl-context-private.h \
$(srcdir)/cogl-context.c \
+ $(srcdir)/cogl-renderer-private.h \
+ $(srcdir)/cogl-renderer.h \
+ $(srcdir)/cogl-renderer.c \
+ $(srcdir)/cogl-swap-chain-private.h \
+ $(srcdir)/cogl-swap-chain.h \
+ $(srcdir)/cogl-swap-chain.c \
+ $(srcdir)/cogl-onscreen-template-private.h \
+ $(srcdir)/cogl-onscreen-template.h \
+ $(srcdir)/cogl-onscreen-template.c \
+ $(srcdir)/cogl-display-private.h \
+ $(srcdir)/cogl-display.h \
+ $(srcdir)/cogl-display.c \
$(srcdir)/cogl-internal.h \
$(srcdir)/cogl.c \
$(srcdir)/cogl-object-private.h \
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index 00f4eaf8e..ed950c305 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -86,17 +86,18 @@ _cogl_init_feature_overrides (CoglContext *ctx)
COGL_FEATURE_TEXTURE_NPOT_REPEAT);
}
-/* FIXME: We don't report a GError here should we? With non NULL
- * displays then there should basically be no risk of error I think,
- * but NULL just says "please do the right thing" and we could hit any
- * number of problems that should be reported back to the caller!
- *
- * Also is it acceptable for construction to report an error
- * or should there be a separate cogl_context_check_status()
- * API of some kind?
+/* For reference: There was some deliberation over whether to have a
+ * constructor that could throw an exception but looking at standard
+ * practices with several high level OO languages including python, C++,
+ * C# Java and Ruby they all support exceptions in constructors and the
+ * general consensus appears to be that throwing an exception is neater
+ * than successfully constructing with an internal error status that
+ * would then have to be explicitly checked via some form of ::is_ok()
+ * method.
*/
CoglContext *
-cogl_context_new (CoglDisplay *display)
+cogl_context_new (CoglDisplay *display,
+ GError **error)
{
CoglContext *context;
GLubyte default_texture_data[] = { 0xff, 0xff, 0xff, 0x0 };
@@ -145,6 +146,18 @@ cogl_context_new (CoglDisplay *display)
context->texture_types = NULL;
context->buffer_types = NULL;
+ if (!display)
+ display = cogl_display_new (NULL, NULL);
+ else
+ cogl_object_ref (display);
+
+ if (!cogl_display_setup (display, error))
+ {
+ cogl_object_unref (display);
+ g_free (context);
+ return NULL;
+ }
+
/* Initialise the driver specific state */
_cogl_gl_context_init (context);
_cogl_init_feature_overrides (context);
@@ -411,15 +424,26 @@ _cogl_context_free (CoglContext *context)
g_byte_array_free (context->buffer_map_fallback_array, TRUE);
+ cogl_object_unref (context->display);
+
g_free (context);
}
CoglContext *
_cogl_context_get_default (void)
{
+ GError *error = NULL;
/* Create if doesn't exist yet */
if (_context == NULL)
- _context = cogl_context_new (NULL);
+ {
+ _context = cogl_context_new (NULL, &error);
+ if (!_context)
+ {
+ g_warning ("Failed to create default context: %s",
+ error->message);
+ g_error_free (error);
+ }
+ }
return _context;
}
diff --git a/cogl/cogl-display-private.h b/cogl/cogl-display-private.h
new file mode 100644
index 000000000..1bda21dea
--- /dev/null
+++ b/cogl/cogl-display-private.h
@@ -0,0 +1,43 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ *
+ *
+ */
+
+#ifndef __COGL_DISPLAY_PRIVATE_H
+#define __COGL_DISPLAY_PRIVATE_H
+
+#include "cogl-object-private.h"
+#include "cogl-renderer.h"
+#include "cogl-onscreen-template.h"
+
+struct _CoglDisplay
+{
+ CoglObject _parent;
+
+ gboolean setup;
+ CoglRenderer *renderer;
+ CoglOnscreenTemplate *onscreen_template;
+
+ void *winsys;
+};
+
+#endif /* __COGL_DISPLAY_PRIVATE_H */
diff --git a/cogl/cogl-display.c b/cogl/cogl-display.c
new file mode 100644
index 000000000..ebaaafa91
--- /dev/null
+++ b/cogl/cogl-display.c
@@ -0,0 +1,106 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Robert Bragg
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cogl.h"
+#include "cogl-object.h"
+
+#include "cogl-display-private.h"
+#include "cogl-winsys-private.h"
+
+static void _cogl_display_free (CoglDisplay *display);
+
+COGL_OBJECT_DEFINE (Display, display);
+
+GQuark
+cogl_display_error_quark (void)
+{
+ return g_quark_from_static_string ("cogl-display-error-quark");
+}
+
+static void
+_cogl_display_free (CoglDisplay *display)
+{
+ if (display->renderer)
+ {
+ cogl_object_unref (display->renderer);
+ display->renderer = NULL;
+ }
+
+ if (display->onscreen_template)
+ {
+ cogl_object_unref (display->onscreen_template);
+ display->onscreen_template = NULL;
+ }
+
+ g_slice_free (CoglDisplay, display);
+}
+
+CoglDisplay *
+cogl_display_new (CoglRenderer *renderer,
+ CoglOnscreenTemplate *onscreen_template)
+{
+ CoglDisplay *display = g_slice_new0 (CoglDisplay);
+ GError *error = NULL;
+
+ display->renderer = renderer;
+ if (renderer)
+ cogl_object_ref (renderer);
+ else
+ display->renderer = cogl_renderer_new ();
+
+ if (!cogl_renderer_connect (display->renderer, &error))
+ {
+ g_warning ("Failed to connect renderer: %s\n", error->message);
+ g_error_free (error);
+ g_object_unref (display->renderer);
+ g_slice_free (CoglDisplay, display);
+ return NULL;
+ }
+
+ display->onscreen_template = onscreen_template;
+ if (onscreen_template)
+ cogl_object_ref (onscreen_template);
+
+ display->setup = FALSE;
+
+ return _cogl_display_object_new (display);
+}
+
+gboolean
+cogl_display_setup (CoglDisplay *display,
+ GError **error)
+{
+ if (display->setup)
+ return TRUE;
+
+ display->setup = TRUE;
+
+ return TRUE;
+}
diff --git a/cogl/cogl-onscreen-template-private.h b/cogl/cogl-onscreen-template-private.h
new file mode 100644
index 000000000..0f8d2533b
--- /dev/null
+++ b/cogl/cogl-onscreen-template-private.h
@@ -0,0 +1,37 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see .
+ *
+ *
+ */
+
+#ifndef __COGL_ONSCREEN_TEMPLATE_PRIVATE_H
+#define __COGL_ONSCREEN_TEMPLATE_PRIVATE_H
+
+#include "cogl-object-private.h"
+#include "cogl-swap-chain.h"
+
+struct _CoglOnscreenTemplate
+{
+ CoglObject _parent;
+
+ CoglSwapChain *swap_chain;
+};
+
+#endif /* __COGL_ONSCREEN_TEMPLATE_PRIVATE_H */
diff --git a/cogl/cogl-onscreen-template.c b/cogl/cogl-onscreen-template.c
new file mode 100644
index 000000000..ff400e4e6
--- /dev/null
+++ b/cogl/cogl-onscreen-template.c
@@ -0,0 +1,62 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Robert Bragg
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cogl.h"
+#include "cogl-object.h"
+
+#include "cogl-onscreen-template-private.h"
+
+static void _cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template);
+
+COGL_OBJECT_DEFINE (OnscreenTemplate, onscreen_template);
+
+GQuark
+cogl_onscreen_template_error_quark (void)
+{
+ return g_quark_from_static_string ("cogl-onscreen-template-error-quark");
+}
+
+static void
+_cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template)
+{
+ g_slice_free (CoglOnscreenTemplate, onscreen_template);
+}
+
+CoglOnscreenTemplate *
+cogl_onscreen_template_new (CoglSwapChain *swap_chain)
+{
+ CoglOnscreenTemplate *onscreen_template = g_slice_new0 (CoglOnscreenTemplate);
+
+ onscreen_template->swap_chain = swap_chain;
+ if (swap_chain)
+ cogl_object_ref (swap_chain);
+
+ return _cogl_onscreen_template_object_new (onscreen_template);
+}
diff --git a/cogl/cogl-onscreen-template.h b/cogl/cogl-onscreen-template.h
new file mode 100644
index 000000000..4769f9f1b
--- /dev/null
+++ b/cogl/cogl-onscreen-template.h
@@ -0,0 +1,48 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ *
+ * Authors:
+ * Robert Bragg
+ *
+ */
+
+#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __COGL_ONSCREEN_TEMPLATE_H__
+#define __COGL_ONSCREEN_TEMPLATE_H__
+
+#include
+
+G_BEGIN_DECLS
+
+typedef struct _CoglOnscreenTemplate CoglOnscreenTemplate;
+
+#define COGL_ONSCREEN_TEMPLATE(OBJECT) ((CoglOnscreenTemplate *)OBJECT)
+
+#define cogl_onscreen_template_new cogl_onscreen_template_new_EXP
+CoglOnscreenTemplate *
+cogl_onscreen_template_new (CoglSwapChain *swap_chain);
+
+G_END_DECLS
+
+#endif /* __COGL_ONSCREEN_TEMPLATE_H__ */
diff --git a/cogl/cogl-renderer-private.h b/cogl/cogl-renderer-private.h
new file mode 100644
index 000000000..8668270a2
--- /dev/null
+++ b/cogl/cogl-renderer-private.h
@@ -0,0 +1,43 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see .
+ *
+ *
+ */
+
+#ifndef __COGL_RENDERER_PRIVATE_H
+#define __COGL_RENDERER_PRIVATE_H
+
+#include "cogl-object-private.h"
+
+#ifdef COGL_HAS_XLIB_SUPPORT
+#include
+#endif
+
+struct _CoglRenderer
+{
+ CoglObject _parent;
+ gboolean connected;
+#ifdef COGL_HAS_XLIB_SUPPORT
+ Display *foreign_xdpy;
+#endif
+ void *winsys;
+};
+
+#endif /* __COGL_RENDERER_PRIVATE_H */
diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c
new file mode 100644
index 000000000..9eddc9b45
--- /dev/null
+++ b/cogl/cogl-renderer.c
@@ -0,0 +1,106 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Robert Bragg
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cogl.h"
+#include "cogl-internal.h"
+#include "cogl-object.h"
+
+#include "cogl-renderer.h"
+#include "cogl-renderer-private.h"
+#include "cogl-display-private.h"
+#include "cogl-winsys-private.h"
+
+static void _cogl_renderer_free (CoglRenderer *renderer);
+
+COGL_OBJECT_DEFINE (Renderer, renderer);
+
+GQuark
+cogl_renderer_error_quark (void)
+{
+ return g_quark_from_static_string ("cogl-renderer-error-quark");
+}
+
+static void
+_cogl_renderer_free (CoglRenderer *renderer)
+{
+ g_free (renderer);
+}
+
+CoglRenderer *
+cogl_renderer_new (void)
+{
+ CoglRenderer *renderer = g_new0 (CoglRenderer, 1);
+
+ renderer->connected = FALSE;
+
+ return _cogl_renderer_object_new (renderer);
+}
+
+#if COGL_HAS_XLIB_SUPPORT
+void
+cogl_renderer_xlib_set_foreign_display (CoglRenderer *renderer,
+ Display *xdisplay)
+{
+ g_return_if_fail (cogl_is_renderer (renderer));
+
+ /* NB: Renderers are considered immutable once connected */
+ g_return_if_fail (!renderer->connected);
+
+ renderer->foreign_xdpy = xdisplay;
+}
+
+Display *
+cogl_renderer_xlib_get_foreign_display (CoglRenderer *renderer)
+{
+ g_return_val_if_fail (cogl_is_renderer (renderer), NULL);
+
+ return renderer->foreign_xdpy;
+}
+#endif /* COGL_HAS_XLIB_SUPPORT */
+
+gboolean
+cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
+ CoglOnscreenTemplate *onscreen_template,
+ GError **error)
+{
+ return TRUE;
+}
+
+/* Final connection API */
+
+gboolean
+cogl_renderer_connect (CoglRenderer *renderer, GError **error)
+{
+ if (renderer->connected)
+ return TRUE;
+
+ renderer->connected = TRUE;
+ return TRUE;
+}
diff --git a/cogl/cogl-renderer.h b/cogl/cogl-renderer.h
new file mode 100644
index 000000000..684429988
--- /dev/null
+++ b/cogl/cogl-renderer.h
@@ -0,0 +1,158 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2007,2008,2009 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __COGL_RENDERER_H__
+#define __COGL_RENDERER_H__
+
+#include
+
+#include
+#include
+
+#ifdef COGL_HAS_XLIB
+#include
+#endif
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION:cogl-renderer
+ * @short_description:
+ *
+ */
+
+#define cogl_renderer_error_quark cogl_renderer_error_quark_EXP
+
+#define COGL_RENDERER_ERROR cogl_renderer_error_quark ()
+GQuark
+cogl_renderer_error_quark (void);
+
+typedef struct _CoglRenderer CoglRenderer;
+
+#define cogl_is_renderer cogl_is_renderer_EXP
+gboolean
+cogl_is_renderer (void *object);
+
+#define cogl_renderer_new cogl_renderer_new_EXP
+CoglRenderer *
+cogl_renderer_new (void);
+
+/* optional configuration APIs */
+
+#ifdef COGL_HAS_XLIB
+
+#define cogl_renderer_xlib_handle_event cogl_renderer_xlib_handle_event_EXP
+/*
+ * cogl_renderer_xlib_handle_event:
+ * @xevent: pointer to XEvent structure
+ *
+ * This function processes a single X event; it can be used to hook
+ * into external X event retrieval (for example that done by Clutter
+ * or GDK).
+ *
+ * Return value: #CoglXlibFilterReturn. %COGL_XLIB_FILTER_REMOVE
+ * indicates that Cogl has internally handled the event and the
+ * caller should do no further processing. %COGL_XLIB_FILTER_CONTINUE
+ * indicates that Cogl is either not interested in the event,
+ * or has used the event to update internal state without taking
+ * any exclusive action.
+ */
+CoglXlibFilterReturn
+cogl_renderer_xlib_handle_event (CoglRenderer *renderer,
+ XEvent *xevent);
+
+#define cogl_renderer_xlib_get_foreign_display \
+ cogl_renderer_xlib_get_foreign_display_EXP
+/*
+ * cogl_renderer_xlib_get_foreign_display:
+ *
+ * Return value: the foreign Xlib display that will be used by any Xlib based
+ * winsys backend. The display needs to be set with
+ * cogl_renderer_xlib_set_foreign_display() before this function is called.
+ */
+Display *
+cogl_renderer_xlib_get_foreign_display (CoglRenderer *renderer);
+
+#define cogl_renderer_xlib_set_foreign_display \
+ cogl_renderer_xlib_set_foreign_display_EXP
+/*
+ * cogl_renderer_xlib_set_foreign_display:
+ *
+ * Sets a foreign Xlib display that Cogl will use for and Xlib based winsys
+ * backend.
+ */
+void
+cogl_renderer_xlib_set_foreign_display (CoglRenderer *renderer,
+ Display *display);
+
+#define cogl_renderer_xlib_get_display cogl_renderer_xlib_get_display_EXP
+Display *
+cogl_renderer_xlib_get_display (CoglRenderer *renderer);
+
+#define cogl_renderer_xlib_add_filter cogl_renderer_xlib_add_filter_EXP
+/*
+ * _cogl_xlib_add_filter:
+ *
+ * Adds a callback function that will receive all X11 events. The
+ * function can stop further processing of the event by return
+ * %COGL_XLIB_FILTER_REMOVE.
+ */
+void
+cogl_renderer_xlib_add_filter (CoglRenderer *renderer,
+ CoglXlibFilterFunc func,
+ void *data);
+
+#define cogl_renderer_xlib_remove_filter cogl_renderer_xlib_remove_filter_EXP
+/*
+ * _cogl_xlib_remove_filter:
+ *
+ * Removes a callback that was previously added with
+ * _cogl_xlib_add_filter().
+ */
+void
+cogl_renderer_xlib_remove_filter (CoglRenderer *renderer,
+ CoglXlibFilterFunc func,
+ void *data);
+#endif /* COGL_HAS_XLIB */
+
+#define cogl_renderer_check_onscreen_template \
+ cogl_renderer_check_onscreen_template_EXP
+gboolean
+cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
+ CoglOnscreenTemplate *onscreen_template,
+ GError **error);
+
+/* Final connection API */
+
+#define cogl_renderer_connect cogl_renderer_connect_EXP
+gboolean
+cogl_renderer_connect (CoglRenderer *renderer, GError **error);
+
+G_END_DECLS
+
+#endif /* __COGL_RENDERER_H__ */
+
diff --git a/cogl/cogl-swap-chain-private.h b/cogl/cogl-swap-chain-private.h
new file mode 100644
index 000000000..5edadeb34
--- /dev/null
+++ b/cogl/cogl-swap-chain-private.h
@@ -0,0 +1,37 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see .
+ *
+ *
+ */
+
+#ifndef __COGL_SWAP_CHAIN_PRIVATE_H
+#define __COGL_SWAP_CHAIN_PRIVATE_H
+
+#include "cogl-object-private.h"
+
+struct _CoglSwapChain
+{
+ CoglObject _parent;
+
+ gboolean has_alpha;
+
+};
+
+#endif /* __COGL_SWAP_CHAIN_PRIVATE_H */
diff --git a/cogl/cogl-swap-chain.c b/cogl/cogl-swap-chain.c
new file mode 100644
index 000000000..9622e9ec7
--- /dev/null
+++ b/cogl/cogl-swap-chain.c
@@ -0,0 +1,66 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Robert Bragg
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cogl.h"
+#include "cogl-object.h"
+
+#include "cogl-swap-chain-private.h"
+
+static void _cogl_swap_chain_free (CoglSwapChain *swap_chain);
+
+COGL_OBJECT_DEFINE (SwapChain, swap_chain);
+
+GQuark
+cogl_swap_chain_error_quark (void)
+{
+ return g_quark_from_static_string ("cogl-swap-chain-error-quark");
+}
+
+static void
+_cogl_swap_chain_free (CoglSwapChain *swap_chain)
+{
+ g_slice_free (CoglSwapChain, swap_chain);
+}
+
+CoglSwapChain *
+cogl_swap_chain_new (void)
+{
+ CoglSwapChain *swap_chain = g_slice_new0 (CoglSwapChain);
+
+ return _cogl_swap_chain_object_new (swap_chain);
+}
+
+void
+cogl_swap_chain_set_has_alpha (CoglSwapChain *swap_chain,
+ gboolean has_alpha)
+{
+ swap_chain->has_alpha = has_alpha;
+}
+
diff --git a/cogl/cogl-swap-chain.h b/cogl/cogl-swap-chain.h
new file mode 100644
index 000000000..7791e2348
--- /dev/null
+++ b/cogl/cogl-swap-chain.h
@@ -0,0 +1,46 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __COGL_SWAP_CHAIN_H__
+#define __COGL_SWAP_CHAIN_H__
+
+G_BEGIN_DECLS
+
+typedef struct _CoglSwapChain CoglSwapChain;
+
+#define cogl_swap_chain_new cogl_swap_chain_new_EXP
+CoglSwapChain *
+cogl_swap_chain_new (void);
+
+#define cogl_swap_chain_set_has_alpha cogl_swap_chain_set_has_alpha_EXP
+void
+cogl_swap_chain_set_has_alpha (CoglSwapChain *swap_chain,
+ gboolean has_alpha);
+
+G_END_DECLS
+
+#endif /* __COGL_SWAP_CHAIN_H__ */