cogl/backend: Remove the ClutterBackendCogl class

All the functionality that ClutterBackendCogl provided has been moved
into ClutterBackend itself, so there is no need to have this class
around in the source.

Cogl-based backends can derive directly from ClutterBackend.
This commit is contained in:
Emmanuele Bassi 2011-11-04 16:52:44 +00:00
parent 5ac0cf1c28
commit 5c9cafb411
12 changed files with 19 additions and 206 deletions

View File

@ -388,12 +388,10 @@ endif # SUPPORT_X11
cogl_source_h =
cogl_source_c = \
$(srcdir)/cogl/clutter-backend-cogl.c \
$(srcdir)/cogl/clutter-stage-cogl.c \
$(NULL)
cogl_source_h_priv = \
$(srcdir)/cogl/clutter-backend-cogl.h \
$(srcdir)/cogl/clutter-stage-cogl.h \
$(NULL)

View File

@ -1,111 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010,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 <http://www.gnu.org/licenses/>.
* Authors:
* Matthew Allum
* Emmanuele Bassi
* Robert Bragg
* Neil Roberts
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include "clutter-backend-cogl.h"
#include "clutter-stage-cogl.h"
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-main.h"
#include "clutter-stage-private.h"
static ClutterBackendCogl *backend_singleton = NULL;
G_DEFINE_TYPE (ClutterBackendCogl, _clutter_backend_cogl, CLUTTER_TYPE_BACKEND);
static void
clutter_backend_cogl_finalize (GObject *gobject)
{
if (backend_singleton)
backend_singleton = NULL;
G_OBJECT_CLASS (_clutter_backend_cogl_parent_class)->finalize (gobject);
}
static void
clutter_backend_cogl_dispose (GObject *gobject)
{
ClutterBackend *backend = CLUTTER_BACKEND (gobject);
if (backend->cogl_context)
{
cogl_object_unref (backend->cogl_context);
backend->cogl_context = NULL;
}
G_OBJECT_CLASS (_clutter_backend_cogl_parent_class)->dispose (gobject);
}
static GObject *
clutter_backend_cogl_constructor (GType gtype,
guint n_params,
GObjectConstructParam *params)
{
GObjectClass *parent_class;
GObject *retval;
if (backend_singleton == NULL)
{
parent_class = G_OBJECT_CLASS (_clutter_backend_cogl_parent_class);
retval = parent_class->constructor (gtype, n_params, params);
backend_singleton = CLUTTER_BACKEND_COGL (retval);
return retval;
}
g_warning ("Attempting to create a new backend object. This should "
"never happen, so we return the singleton instance.");
return g_object_ref (backend_singleton);
}
static void
_clutter_backend_cogl_class_init (ClutterBackendCoglClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->constructor = clutter_backend_cogl_constructor;
gobject_class->dispose = clutter_backend_cogl_dispose;
gobject_class->finalize = clutter_backend_cogl_finalize;
}
static void
_clutter_backend_cogl_init (ClutterBackendCogl *backend_cogl)
{
}

View File

@ -1,68 +0,0 @@
/* Clutter.
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2006, 2007 OpenedHand
* Copyright (C) 2010 Intel Corp
*
* 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/>.
*
* Authors:
* Matthew Allum
* Robert Bragg
*/
#ifndef __CLUTTER_BACKEND_COGL_H__
#define __CLUTTER_BACKEND_COGL_H__
#include <glib-object.h>
#include <clutter/clutter-event.h>
#include <clutter/clutter-backend.h>
#include <clutter/clutter-device-manager.h>
#ifdef COGL_HAS_XLIB_SUPPORT
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#endif
#include "clutter-backend-private.h"
G_BEGIN_DECLS
#define CLUTTER_TYPE_BACKEND_COGL (_clutter_backend_cogl_get_type ())
#define CLUTTER_BACKEND_COGL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND_COGL, ClutterBackendCogl))
#define CLUTTER_IS_BACKEND_COGL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BACKEND_COGL))
#define CLUTTER_BACKEND_COGL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND_COGL, ClutterBackendCoglClass))
#define CLUTTER_IS_BACKEND_COGL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND_COGL))
#define CLUTTER_BACKEND_COGL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND_COGL, ClutterBackendCoglClass))
typedef struct _ClutterBackendCogl ClutterBackendCogl;
typedef struct _ClutterBackendCoglClass ClutterBackendCoglClass;
struct _ClutterBackendCogl
{
ClutterBackend parent_instance;
gboolean can_blit_sub_buffer;
};
struct _ClutterBackendCoglClass
{
ClutterBackendClass parent_class;
};
GType _clutter_backend_cogl_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __CLUTTER_BACKEND_COGL_H__ */

View File

@ -33,15 +33,15 @@
#include "clutter-config.h"
#include "clutter-stage-cogl.h"
#include "clutter-backend-cogl.h"
#include "clutter-actor-private.h"
#include "clutter-backend-private.h"
#include "clutter-debug.h"
#include "clutter-event.h"
#include "clutter-enum-types.h"
#include "clutter-feature.h"
#include "clutter-main.h"
#include "clutter-private.h"
#include "clutter-actor-private.h"
#include "clutter-stage-private.h"
#include "clutter-util.h"
@ -545,11 +545,11 @@ clutter_stage_cogl_set_property (GObject *gobject,
switch (prop_id)
{
case PROP_WRAPPER:
self->wrapper = CLUTTER_STAGE (g_value_get_object (value));
self->wrapper = g_value_get_object (value);
break;
case PROP_BACKEND:
self->backend = CLUTTER_BACKEND_COGL (g_value_get_object (value));
self->backend = g_value_get_object (value);
break;
default:
@ -576,7 +576,7 @@ _clutter_stage_cogl_class_init (ClutterStageCoglClass *klass)
g_param_spec_object ("backend",
"ClutterBackend",
"The Clutter backend singleton",
CLUTTER_TYPE_BACKEND_COGL,
CLUTTER_TYPE_BACKEND,
CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

View File

@ -1,8 +1,8 @@
#ifndef __CLUTTER_STAGE_COGL_H__
#define __CLUTTER_STAGE_COGL_H__
#include <glib-object.h>
#include <cairo.h>
#include <clutter/clutter-backend.h>
#include <clutter/clutter-stage.h>
#ifdef COGL_HAS_X11_SUPPORT
@ -11,8 +11,6 @@
#include <X11/Xutil.h>
#endif
#include "clutter-backend-cogl.h"
G_BEGIN_DECLS
#define CLUTTER_TYPE_STAGE_COGL (_clutter_stage_cogl_get_type ())
@ -30,10 +28,10 @@ struct _ClutterStageCogl
GObject parent_instance;
/* the stage wrapper */
ClutterStage *wrapper;
ClutterStage *wrapper;
/* back pointer to the backend */
ClutterBackendCogl *backend;
ClutterBackend *backend;
CoglOnscreen *onscreen;

View File

@ -68,7 +68,7 @@ static guint gdl_n_buffers = CLUTTER_CEX100_TRIPLE_BUFFERING;
#define clutter_backend_egl_native_get_type _clutter_backend_egl_native_get_type
G_DEFINE_TYPE (ClutterBackendEglNative, clutter_backend_egl_native, CLUTTER_TYPE_BACKEND_COGL);
G_DEFINE_TYPE (ClutterBackendEglNative, clutter_backend_egl_native, CLUTTER_TYPE_BACKEND);
static ClutterDeviceManager *
clutter_backend_egl_native_get_device_manager (ClutterBackend *backend)

View File

@ -32,7 +32,6 @@
#include <clutter/clutter-device-manager.h>
#include "clutter-backend-private.h"
#include "cogl/clutter-backend-cogl.h"
G_BEGIN_DECLS
@ -48,7 +47,7 @@ typedef struct _ClutterBackendEglNativeClass ClutterBackendEglNativeClass;
struct _ClutterBackendEglNative
{
ClutterBackendCogl parent_instance;
ClutterBackend parent_instance;
/* main stage singleton */
ClutterStageWindow *stage;
@ -65,7 +64,7 @@ struct _ClutterBackendEglNative
struct _ClutterBackendEglNativeClass
{
ClutterBackendCoglClass parent_class;
ClutterBackendClass parent_class;
};
GType _clutter_backend_egl_native_get_type (void) G_GNUC_CONST;

View File

@ -60,7 +60,7 @@
#include "clutter-private.h"
#define clutter_backend_gdk_get_type _clutter_backend_gdk_get_type
G_DEFINE_TYPE (ClutterBackendGdk, clutter_backend_gdk, CLUTTER_TYPE_BACKEND_COGL);
G_DEFINE_TYPE (ClutterBackendGdk, clutter_backend_gdk, CLUTTER_TYPE_BACKEND);
/* global for pre init setup calls */
static GdkDisplay *_foreign_dpy = NULL;

View File

@ -30,7 +30,6 @@
#include "clutter-gdk.h"
#include "clutter-backend-private.h"
#include "cogl/clutter-backend-cogl.h"
G_BEGIN_DECLS
@ -46,7 +45,7 @@ typedef struct _ClutterBackendGdkClass ClutterBackendGdkClass;
struct _ClutterBackendGdk
{
ClutterBackendCogl parent_instance;
ClutterBackend parent_instance;
GdkDisplay *display;
GdkScreen *screen;
@ -56,7 +55,7 @@ struct _ClutterBackendGdk
struct _ClutterBackendGdkClass
{
ClutterBackendCoglClass parent_class;
ClutterBackendClass parent_class;
/* nothing here, for now */
};

View File

@ -70,7 +70,7 @@
#define clutter_backend_x11_get_type _clutter_backend_x11_get_type
G_DEFINE_TYPE (ClutterBackendX11, clutter_backend_x11, CLUTTER_TYPE_BACKEND_COGL);
G_DEFINE_TYPE (ClutterBackendX11, clutter_backend_x11, CLUTTER_TYPE_BACKEND);
/* atoms; remember to add the code that assigns the atom value to
* the member of the ClutterBackendX11 structure if you add an

View File

@ -31,7 +31,6 @@
#include "clutter-backend-private.h"
#include "clutter-keymap-x11.h"
#include "cogl/clutter-backend-cogl.h"
#include "xsettings/xsettings-client.h"
@ -68,7 +67,7 @@ struct _ClutterEventX11
struct _ClutterBackendX11
{
ClutterBackendCogl parent_instance;
ClutterBackend parent_instance;
Display *xdpy;
gchar *display_name;
@ -113,7 +112,7 @@ struct _ClutterBackendX11
struct _ClutterBackendX11Class
{
ClutterBackendCoglClass parent_class;
ClutterBackendClass parent_class;
};
GType _clutter_backend_x11_get_type (void) G_GNUC_CONST;

View File

@ -787,10 +787,9 @@ static void
clutter_stage_x11_dispose (GObject *gobject)
{
ClutterEventTranslator *translator = CLUTTER_EVENT_TRANSLATOR (gobject);
ClutterBackendCogl *backend = CLUTTER_STAGE_COGL (gobject)->backend;
ClutterBackend *backend = CLUTTER_STAGE_COGL (gobject)->backend;
_clutter_backend_remove_event_translator (CLUTTER_BACKEND (backend),
translator);
_clutter_backend_remove_event_translator (backend, translator);
G_OBJECT_CLASS (clutter_stage_x11_parent_class)->dispose (gobject);
}