1
0
Fork 0

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>
This commit is contained in:
Robert Bragg 2012-03-20 13:21:18 +00:00
parent 2d1623313c
commit 890a75ab06
8 changed files with 114 additions and 44 deletions

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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

View file

@ -1,4 +1,5 @@
#include <cogl/cogl.h>
#include <cogl/cogl-wayland-server.h>
#include <glib.h>
#include <stdio.h>
#include <sys/time.h>