[cogl/wip/rib/cogl-1.12: 105/139] Avoid including the EGL headers from the public Cogl headers



commit bb258c1d425917f13727a46d0ceed031bf8cb1b7
Author: Tomeu Vizoso <tomeu vizoso collabora com>
Date:   Tue Jul 10 15:14:07 2012 +0200

    Avoid including the EGL headers from the public Cogl headers
    
    Otherwise, X11 identifiers may leak and cause havoc in big applications
    
    Reviewed-by: Neil Roberts <neil linux intel com>
    
    (cherry picked from commit ed0cdca0eca815543619fe72fbd42d662d53f92d)

 cogl/Makefile.am                  |   16 +++++++--
 cogl/cogl-context.h               |   18 -----------
 cogl/cogl-defines.h.in            |    6 ----
 cogl/cogl-egl-defines.h.in        |   33 ++++++++++++++++++++
 cogl/cogl-egl.h                   |   60 +++++++++++++++++++++++++++++++++++++
 cogl/winsys/cogl-winsys-private.h |    4 ++
 configure.ac                      |    1 +
 7 files changed, 110 insertions(+), 28 deletions(-)
---
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index 739647c..43a8b60 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -34,9 +34,9 @@ AM_CPPFLAGS = \
 
 AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
 
-BUILT_SOURCES += cogl-defines.h cogl-gl-header.h
-DISTCLEANFILES += cogl-defines.h cogl-gl-header.h
-EXTRA_DIST += cogl-defines.h.in cogl-gl-header.h.in
+BUILT_SOURCES += cogl-defines.h cogl-egl-defines.h cogl-gl-header.h
+DISTCLEANFILES += cogl-defines.h cogl-egl-defines.h cogl-gl-header.h
+EXTRA_DIST += cogl-defines.h.in cogl-egl-defines.h.in cogl-gl-header.h.in
 
 # Note: The cogl-1.0/cogl-gl-1.0 files are essentially for
 # compatability only.  I'm not really sure who could possibly be using
@@ -119,6 +119,9 @@ cogl_experimental_h = \
 	$(srcdir)/cogl-version.h		\
 	$(NULL)
 
+cogl_nodist_experimental_h = \
+	$(NULL)
+
 cogl_gl_prototypes_h = \
 	$(srcdir)/gl-prototypes/cogl-gles2-functions.h		\
 	$(srcdir)/gl-prototypes/cogl-core-functions.h		\
@@ -459,6 +462,11 @@ cogl_sources_c += \
 	$(srcdir)/winsys/cogl-winsys-egl-android-private.h
 endif
 if SUPPORT_EGL
+cogl_experimental_h += \
+       $(srcdir)/cogl-egl.h
+cogl_nodist_experimental_h += \
+       $(builddir)/cogl-egl-defines.h
+
 cogl_sources_c += \
        $(srcdir)/winsys/cogl-winsys-egl.c \
        $(srcdir)/winsys/cogl-winsys-egl-feature-functions.h \
@@ -513,7 +521,7 @@ cogl_headers = \
 
 coglincludedir = $(includedir)/cogl/cogl
 coglinclude_HEADERS = $(cogl_headers) $(cogl_experimental_h)
-nodist_coglinclude_HEADERS = cogl-defines.h cogl-enum-types.h
+nodist_coglinclude_HEADERS = $(cogl_nodist_experimental_h) cogl-defines.h cogl-enum-types.h
 
 cogl_proto_includedir = $(includedir)/cogl2/cogl/gl-prototypes
 cogl_proto_include_HEADERS = $(cogl_gl_prototypes_h)
diff --git a/cogl/cogl-context.h b/cogl/cogl-context.h
index 616cd77..719b6ca 100644
--- a/cogl/cogl-context.h
+++ b/cogl/cogl-context.h
@@ -106,24 +106,6 @@ cogl_context_new (CoglDisplay *display,
 CoglDisplay *
 cogl_context_get_display (CoglContext *context);
 
-#ifdef COGL_HAS_EGL_SUPPORT
-/**
- * cogl_egl_context_get_egl_display:
- * @context: A #CoglContext pointer
- *
- * If you have done a runtime check to determine that Cogl is using
- * EGL internally then this API can be used to retrieve the EGLDisplay
- * handle that was setup internally. The result is undefined if Cogl
- * is not using EGL.
- *
- * Return value: The internally setup EGLDisplay handle.
- * Since: 1.8
- * Stability: unstable
- */
-EGLDisplay
-cogl_egl_context_get_egl_display (CoglContext *context);
-#endif
-
 #ifdef COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT
 /**
  * cogl_android_set_native_window:
diff --git a/cogl/cogl-defines.h.in b/cogl/cogl-defines.h.in
index 7c1c5ae..a8765d8 100644
--- a/cogl/cogl-defines.h.in
+++ b/cogl/cogl-defines.h.in
@@ -34,12 +34,6 @@ G_BEGIN_DECLS
 
 @COGL_DEFINES@
 
-#ifdef COGL_HAS_EGL_SUPPORT
- COGL_EGL_INCLUDES@
-#define NativeDisplayType EGLNativeDisplayType
-#define NativeWindowType EGLNativeWindowType
-#endif
-
 #define COGL_VERSION_MAJOR_INTERNAL @COGL_MAJOR_VERSION@
 #define COGL_VERSION_MINOR_INTERNAL @COGL_MINOR_VERSION@
 #define COGL_VERSION_MICRO_INTERNAL @COGL_MICRO_VERSION@
diff --git a/cogl/cogl-egl-defines.h.in b/cogl/cogl-egl-defines.h.in
new file mode 100644
index 0000000..fee93f5
--- /dev/null
+++ b/cogl/cogl-egl-defines.h.in
@@ -0,0 +1,33 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2007,2008,2009,2010 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 <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifndef __COGL_EGL_DEFINES_H__
+#define __COGL_EGL_DEFINES_H__
+
+#ifdef COGL_HAS_EGL_SUPPORT
+
+ COGL_EGL_INCLUDES@
+
+#endif /* COGL_HAS_EGL_SUPPORT */
+
+#endif
diff --git a/cogl/cogl-egl.h b/cogl/cogl-egl.h
new file mode 100644
index 0000000..c9ca786
--- /dev/null
+++ b/cogl/cogl-egl.h
@@ -0,0 +1,60 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2007,2008,2009,2010 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 <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifndef __COGL_EGL_H__
+#define __COGL_EGL_H__
+
+#ifdef COGL_HAS_EGL_SUPPORT
+
+#include "cogl-egl-defines.h"
+
+G_BEGIN_DECLS
+
+#define NativeDisplayType EGLNativeDisplayType
+#define NativeWindowType EGLNativeWindowType
+
+#ifndef GL_OES_EGL_image
+#define GLeglImageOES void *
+#endif
+
+/**
+ * cogl_egl_context_get_egl_display:
+ * @context: A #CoglContext pointer
+ *
+ * If you have done a runtime check to determine that Cogl is using
+ * EGL internally then this API can be used to retrieve the EGLDisplay
+ * handle that was setup internally. The result is undefined if Cogl
+ * is not using EGL.
+ *
+ * Return value: The internally setup EGLDisplay handle.
+ * Since: 1.8
+ * Stability: unstable
+ */
+EGLDisplay
+cogl_egl_context_get_egl_display (CoglContext *context);
+
+G_END_DECLS
+
+#endif /* COGL_HAS_EGL_SUPPORT */
+
+#endif
diff --git a/cogl/winsys/cogl-winsys-private.h b/cogl/winsys/cogl-winsys-private.h
index dd09a02..3262d2f 100644
--- a/cogl/winsys/cogl-winsys-private.h
+++ b/cogl/winsys/cogl-winsys-private.h
@@ -37,6 +37,10 @@
 #include "cogl-texture-pixmap-x11-private.h"
 #endif
 
+#ifdef COGL_HAS_EGL_SUPPORT
+#include "cogl-egl.h"
+#endif
+
 #include "cogl-poll.h"
 
 GQuark
diff --git a/configure.ac b/configure.ac
index c18e1bf..e6abb86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1195,6 +1195,7 @@ cogl/cogl-defines.h
 cogl/cogl-defines.h.win32
 cogl/cogl-defines.h.win32_SDL
 cogl/cogl-gl-header.h
+cogl/cogl-egl-defines.h
 cogl/cogl.rc
 cogl-pango/Makefile
 cogl-pango/cogl-pango-1.0.pc



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