[cogl] Create standalone public wayland client/server headers
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] Create standalone public wayland client/server headers
- Date: Tue, 20 Mar 2012 14:27:39 +0000 (UTC)
commit 890a75ab06d05522f68779419e4e982d6565b0d0
Author: Robert Bragg <robert linux intel com>
Date: Tue Mar 20 13:21:18 2012 +0000
Create standalone public wayland client/server headers
Because the wayland-client-protocol.h header defines symbols that
collide with the wayland-server-protocol.h header we allow applications
to explicitly ensure that they are only including one at a time by
exposing corresponding <cogl/cogl-wayland-client.h> and
<cogl/cogl-wayland-server.h> headers. This also adds a missing guard to
cogl-texture-2d.h that it isn't included directly.
Reviewed-by: Neil Roberts <neil linux intel com>
cogl/Makefile.am | 7 ++++-
cogl/cogl-framebuffer.h | 4 --
cogl/cogl-texture-2d.c | 2 +-
cogl/cogl-texture-2d.h | 39 ++----------------------
cogl/cogl-wayland-client.h | 32 ++++++++++++++++++++
cogl/cogl-wayland-server.h | 70 ++++++++++++++++++++++++++++++++++++++++++++
cogl/cogl.h | 3 --
examples/cogland.c | 1 +
8 files changed, 114 insertions(+), 44 deletions(-)
---
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index 853e561..538fbf3 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -395,9 +395,14 @@ cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-wgl.c \
$(srcdir)/winsys/cogl-winsys-wgl-feature-functions.h
endif
+if SUPPORT_WAYLAND_EGL_SERVER
+cogl_experimental_h += \
+ $(srcdir)/cogl-wayland-server.h
+endif
if SUPPORT_EGL_PLATFORM_WAYLAND
cogl_experimental_h += \
- $(srcdir)/cogl-wayland-renderer.h
+ $(srcdir)/cogl-wayland-renderer.h \
+ $(srcdir)/cogl-wayland-client.h
cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-egl-wayland.c \
$(srcdir)/winsys/cogl-winsys-egl-wayland-private.h
diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h
index 0e688fa..07886db 100644
--- a/cogl/cogl-framebuffer.h
+++ b/cogl/cogl-framebuffer.h
@@ -34,10 +34,6 @@
#include <windows.h>
#endif /* COGL_HAS_WIN32_SUPPORT */
-#if defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT)
-#include <wayland-client.h>
-#endif /* COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT */
-
#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API
#include <cogl/cogl2-path.h>
#else
diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c
index 93bb07c..dad1eac 100644
--- a/cogl/cogl-texture-2d.c
+++ b/cogl/cogl-texture-2d.c
@@ -46,7 +46,7 @@
#include <math.h>
#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
-#include <wayland-server.h>
+#include "cogl-wayland-server.h"
#endif
static void _cogl_texture_2d_free (CoglTexture2D *tex_2d);
diff --git a/cogl/cogl-texture-2d.h b/cogl/cogl-texture-2d.h
index 8e2e710..f191924 100644
--- a/cogl/cogl-texture-2d.h
+++ b/cogl/cogl-texture-2d.h
@@ -24,15 +24,15 @@
* Robert Bragg <robert linux intel com>
*/
+#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
+#error "Only <cogl/cogl.h> can be included directly."
+#endif
+
#ifndef __COGL_TEXURE_2D_H
#define __COGL_TEXURE_2D_H
#include "cogl-context.h"
-#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
-#include <wayland-server.h>
-#endif
-
#include <glib.h>
G_BEGIN_DECLS
@@ -185,37 +185,6 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
CoglPixelFormat format,
GError **error);
-#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
-#define cogl_wayland_texture_2d_new_from_buffer \
- cogl_wayland_texture_2d_new_from_buffer_EXP
-/**
- * cogl_wayland_texture_2d_new_from_buffer:
- * @ctx: A #CoglContext
- * @buffer: A Wayland buffer
- * @error: A #GError for exceptions
- *
- * Uploads the given Wayland @buffer to a #CoglTexture2D.
- *
- * <note>The results are undefined for passing an invalid @buffer
- * pointer</note>
- * <note>It is undefined if future updates to @buffer outside the
- * control of Cogl will affect the allocated #CoglTexture2D. In some
- * cases the contents of the buffer are copied (such as shm buffers),
- * and in other cases the underlying storage is re-used directly (such
- * as drm buffers)</note>
- *
- * Returns: A newly allocated #CoglTexture2D, or if Cogl could not
- * validate the @buffer in some way (perhaps because of
- * an unsupported format) it will return %NULL and set
- * @error.
- * Since: 2.0
- */
-CoglTexture2D *
-cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
- struct wl_buffer *buffer,
- GError **error);
-#endif /* COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT */
-
G_END_DECLS
#endif /* __COGL_TEXURE_2D_H */
diff --git a/cogl/cogl-wayland-client.h b/cogl/cogl-wayland-client.h
new file mode 100644
index 0000000..3f290dc
--- /dev/null
+++ b/cogl/cogl-wayland-client.h
@@ -0,0 +1,32 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2012 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_WAYLAND_CLIENT_H
+#define __COGL_WAYLAND_CLIENT_H
+
+#include <glib.h>
+
+#define __COGL_H_INSIDE__
+#include <cogl/cogl-wayland-renderer.h>
+
+#endif /* __COGL_WAYLAND_CLIENT_H */
diff --git a/cogl/cogl-wayland-server.h b/cogl/cogl-wayland-server.h
new file mode 100644
index 0000000..9c2cb46
--- /dev/null
+++ b/cogl/cogl-wayland-server.h
@@ -0,0 +1,70 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2012 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_WAYLAND_SERVER_H
+#define __COGL_WAYLAND_SERVER_H
+
+#include <glib.h>
+
+#include <wayland-server.h>
+
+#define __COGL_H_INSIDE__
+#include <cogl/cogl-context.h>
+#include <cogl/cogl-texture-2d.h>
+
+G_BEGIN_DECLS
+
+#define cogl_wayland_texture_2d_new_from_buffer \
+ cogl_wayland_texture_2d_new_from_buffer_EXP
+/**
+ * cogl_wayland_texture_2d_new_from_buffer:
+ * @ctx: A #CoglContext
+ * @buffer: A Wayland buffer
+ * @error: A #GError for exceptions
+ *
+ * Uploads the given Wayland @buffer to a #CoglTexture2D.
+ *
+ * <note>The results are undefined for passing an invalid @buffer
+ * pointer</note>
+ * <note>It is undefined if future updates to @buffer outside the
+ * control of Cogl will affect the allocated #CoglTexture2D. In some
+ * cases the contents of the buffer are copied (such as shm buffers),
+ * and in other cases the underlying storage is re-used directly (such
+ * as drm buffers)</note>
+ *
+ * Returns: A newly allocated #CoglTexture2D, or if Cogl could not
+ * validate the @buffer in some way (perhaps because of
+ * an unsupported format) it will return %NULL and set
+ * @error.
+ *
+ * Since: 1.10
+ * Stability: unstable
+ */
+CoglTexture2D *
+cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
+ struct wl_buffer *buffer,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __COGL_WAYLAND_SERVER_H */
diff --git a/cogl/cogl.h b/cogl/cogl.h
index d2e0bc0..b27b759 100644
--- a/cogl/cogl.h
+++ b/cogl/cogl.h
@@ -105,9 +105,6 @@
#if defined (COGL_HAS_EGL_PLATFORM_KMS_SUPPORT)
#include <cogl/cogl-kms-renderer.h>
#endif
-#if defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT)
-#include <cogl/cogl-wayland-renderer.h>
-#endif
#if COGL_HAS_WIN32_SUPPORT
#include <cogl/cogl-win32-renderer.h>
#endif
diff --git a/examples/cogland.c b/examples/cogland.c
index 766657e..6b79160 100644
--- a/examples/cogland.c
+++ b/examples/cogland.c
@@ -1,4 +1,5 @@
#include <cogl/cogl.h>
+#include <cogl/cogl-wayland-server.h>
#include <glib.h>
#include <stdio.h>
#include <sys/time.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]