[mutter] Make it possible to include private cogl API from mutter



commit e05f48fc53cbb10fd9c66f8b947cf64881590b42
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri May 6 16:08:30 2016 +0800

    Make it possible to include private cogl API from mutter
    
    If we want to put a cogl winsys backend in mutter, that backend need to
    have access to the internal workings of cogl.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768976

 cogl/.gitignore                        |    1 +
 cogl/cogl-mutter-config.h.in           |   17 +++++++++++++++++
 cogl/cogl/cogl-egl-private.h           |    2 +-
 cogl/cogl/cogl-framebuffer.h           |    2 +-
 cogl/cogl/cogl-gl-header.h.in          |    2 +-
 cogl/cogl/cogl-meta-texture.h          |    2 +-
 cogl/cogl/cogl-mutter.h                |   10 ++++++++--
 cogl/cogl/cogl-texture.h               |    2 +-
 cogl/cogl/cogl-util.h                  |    4 +++-
 cogl/cogl/deprecated/cogl-type-casts.h |    2 ++
 cogl/cogl/winsys/cogl-winsys-private.h |    2 ++
 cogl/configure.ac                      |    1 +
 src/Makefile.am                        |    2 ++
 13 files changed, 41 insertions(+), 8 deletions(-)
---
diff --git a/cogl/.gitignore b/cogl/.gitignore
index 2880808..8449b17 100644
--- a/cogl/.gitignore
+++ b/cogl/.gitignore
@@ -40,6 +40,7 @@ cogl-path-enum-types.c
 cogl-path-enum-types.h
 cogl-config.h
 cogl-config.h.in
+cogl-mutter-config.h
 config.log
 config.lt
 config.status
diff --git a/cogl/cogl-mutter-config.h.in b/cogl/cogl-mutter-config.h.in
new file mode 100644
index 0000000..bc7f146
--- /dev/null
+++ b/cogl/cogl-mutter-config.h.in
@@ -0,0 +1,17 @@
+/* Have GL for rendering */
+#undef HAVE_COGL_GL
+
+/* Have GLES 1.1 for rendering */
+#undef HAVE_COGL_GLES
+
+/* Have GLES 2.0 for rendering */
+#undef HAVE_COGL_GLES2
+
+/* Define to 1 if you have the `ffs' function. */
+#undef HAVE_FFS
+
+/* Define to 1 if you have the `memmem' function. */
+#undef HAVE_MEMMEM
+
+/* Whether _Static_assert can be used or not */
+#undef HAVE_STATIC_ASSERT
diff --git a/cogl/cogl/cogl-egl-private.h b/cogl/cogl/cogl-egl-private.h
index c4b0dfe..0af8518 100644
--- a/cogl/cogl/cogl-egl-private.h
+++ b/cogl/cogl/cogl-egl-private.h
@@ -33,7 +33,7 @@
 
 #include "cogl-egl-defines.h"
 
-#ifndef GL_OES_EGL_image
+#if defined(GL_OES_EGL_image) && !defined(GLeglImageOES)
 #define GLeglImageOES void *
 #endif
 
diff --git a/cogl/cogl/cogl-framebuffer.h b/cogl/cogl/cogl-framebuffer.h
index 56ba4aa..67931f8 100644
--- a/cogl/cogl/cogl-framebuffer.h
+++ b/cogl/cogl/cogl-framebuffer.h
@@ -37,7 +37,7 @@
 /* We forward declare the CoglFramebuffer type here to avoid some circular
  * dependency issues with the following headers.
  */
-#ifdef __COGL_H_INSIDE__
+#if defined(__COGL_H_INSIDE__) && !defined(COGL_ENABLE_MUTTER_API)
 /* For the public C api we typedef interface types as void to avoid needing
  * lots of casting in code and instead we will rely on runtime type checking
  * for these objects. */
diff --git a/cogl/cogl/cogl-gl-header.h.in b/cogl/cogl/cogl-gl-header.h.in
index 0696dcf..a6659e9 100644
--- a/cogl/cogl/cogl-gl-header.h.in
+++ b/cogl/cogl/cogl-gl-header.h.in
@@ -28,7 +28,7 @@
  *
  */
 
-#if !defined(COGL_COMPILATION)
+#if !defined(COGL_COMPILATION) && !defined(COGL_ENABLE_MUTTER_API)
 #error "cogl-gl-header.h should only be included when compiling Cogl"
 #endif
 
diff --git a/cogl/cogl/cogl-meta-texture.h b/cogl/cogl/cogl-meta-texture.h
index 69c8cb0..e5e6893 100644
--- a/cogl/cogl/cogl-meta-texture.h
+++ b/cogl/cogl/cogl-meta-texture.h
@@ -92,7 +92,7 @@ COGL_BEGIN_DECLS
  * meta-textures.</note>
  */
 
-#ifdef __COGL_H_INSIDE__
+#if defined(__COGL_H_INSIDE__) && !defined(COGL_ENABLE_MUTTER_API)
 /* For the public C api we typedef interface types as void to avoid needing
  * lots of casting in code and instead we will rely on runtime type checking
  * for these objects. */
diff --git a/cogl/cogl/cogl-mutter.h b/cogl/cogl/cogl-mutter.h
index 21ef074..672bede 100644
--- a/cogl/cogl/cogl-mutter.h
+++ b/cogl/cogl/cogl-mutter.h
@@ -31,11 +31,17 @@
 #ifndef __COGL_MUTTER_H___
 #define __COGL_MUTTER_H___
 
+#include "cogl-mutter-config.h"
+#include "cogl-defines.h"
+
+#include <cogl/cogl-texture.h>
+#include <cogl/cogl-meta-texture.h>
+#include <cogl/cogl-error-private.h>
+#include <cogl/cogl-renderer-private.h>
 #include <cogl/winsys/cogl-winsys-egl-kms-private.h>
+#include <cogl/winsys/cogl-winsys-egl-private.h>
 #include <cogl/winsys/cogl-winsys-private.h>
 
-typedef const CoglWinsysVtable *(*CoglWinsysVtableGetter) (void);
-
 void cogl_renderer_set_custom_winsys (CoglRenderer          *renderer,
                                       CoglWinsysVtableGetter winsys_vtable_getter);
 
diff --git a/cogl/cogl/cogl-texture.h b/cogl/cogl/cogl-texture.h
index 2718830..3757667 100644
--- a/cogl/cogl/cogl-texture.h
+++ b/cogl/cogl/cogl-texture.h
@@ -38,7 +38,7 @@
 /* We forward declare the CoglTexture type here to avoid some circular
  * dependency issues with the following headers.
  */
-#ifdef __COGL_H_INSIDE__
+#if defined(__COGL_H_INSIDE__) && !defined(COGL_ENABLE_MUTTER_API)
 /* For the public C api we typedef interface types as void to avoid needing
  * lots of casting in code and instead we will rely on runtime type checking
  * for these objects. */
diff --git a/cogl/cogl/cogl-util.h b/cogl/cogl/cogl-util.h
index 60be7db..c244196 100644
--- a/cogl/cogl/cogl-util.h
+++ b/cogl/cogl/cogl-util.h
@@ -42,7 +42,9 @@
 #endif
 
 /* Double check that config.h has been included */
-#if !defined (PACKAGE_NAME) && !defined (_COGL_IN_TEST_BITMASK)
+#if (!defined (PACKAGE_NAME) && \
+     !defined (_COGL_IN_TEST_BITMASK) && \
+     !defined(COGL_ENABLE_MUTTER_API))
 #error "cogl-config.h must be included before including cogl-util.h"
 #endif
 
diff --git a/cogl/cogl/deprecated/cogl-type-casts.h b/cogl/cogl/deprecated/cogl-type-casts.h
index ae716e7..61c6faf 100644
--- a/cogl/cogl/deprecated/cogl-type-casts.h
+++ b/cogl/cogl/deprecated/cogl-type-casts.h
@@ -44,10 +44,12 @@
  * so these macros are only kept for compatibility...
  */
 
+#ifndef COGL_ENABLE_MUTTER_API
 #define COGL_FRAMEBUFFER(X) (X)
 #define COGL_BUFFER(X) (X)
 #define COGL_TEXTURE(X) (X)
 #define COGL_META_TEXTURE(X) (X)
 #define COGL_PRIMITIVE_TEXTURE(X) (X)
+#endif
 
 #endif /* __COGL_TYPE_CASTS_H__ */
diff --git a/cogl/cogl/winsys/cogl-winsys-private.h b/cogl/cogl/winsys/cogl-winsys-private.h
index 85a67c7..a8e07a5 100644
--- a/cogl/cogl/winsys/cogl-winsys-private.h
+++ b/cogl/cogl/winsys/cogl-winsys-private.h
@@ -190,6 +190,8 @@ typedef struct _CoglWinsysVtable
 
 } CoglWinsysVtable;
 
+typedef const CoglWinsysVtable *(*CoglWinsysVtableGetter) (void);
+
 CoglBool
 _cogl_winsys_has_feature (CoglWinsysFeature feature);
 
diff --git a/cogl/configure.ac b/cogl/configure.ac
index c2674fb..586b6e1 100644
--- a/cogl/configure.ac
+++ b/cogl/configure.ac
@@ -80,6 +80,7 @@ AC_CONFIG_SRCDIR(cogl/cogl.h)
 AC_CONFIG_AUX_DIR([build])
 AC_CONFIG_MACRO_DIR([build/autotools])
 AC_CONFIG_HEADERS(cogl-config.h)
+AC_CONFIG_HEADERS(cogl-mutter-config.h)
 AC_GNU_SOURCE
 
 dnl ================================================================
diff --git a/src/Makefile.am b/src/Makefile.am
index f2fae4c..7ab9cae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,6 +24,8 @@ AM_CPPFLAGS = \
        -I$(srcdir)/ui                                                  \
        -I$(srcdir)/compositor                                          \
        -I$(top_srcdir)/cogl                                            \
+       -I$(top_srcdir)/cogl/cogl                                       \
+       -I$(top_srcdir)/cogl/cogl/winsys                                \
        -I$(top_builddir)/cogl                                          \
        -I$(top_srcdir)/clutter                                         \
        -I$(top_builddir)/clutter                                       \


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