From: Emmanuele Bassi Date: Fri, 4 Nov 2011 16:52:44 +0000 (+0000) Subject: cogl/backend: Remove the ClutterBackendCogl class X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5c9cafb411961fbd9117e86c6e8ca636f91fb158;p=profile%2Fivi%2Fclutter.git 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. --- diff --git a/clutter/Makefile.am b/clutter/Makefile.am index fb41ac2..69e8e2e 100644 --- a/clutter/Makefile.am +++ b/clutter/Makefile.am @@ -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) diff --git a/clutter/cogl/clutter-backend-cogl.c b/clutter/cogl/clutter-backend-cogl.c deleted file mode 100644 index 31d0552..0000000 --- a/clutter/cogl/clutter-backend-cogl.c +++ /dev/null @@ -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 . - - * Authors: - * Matthew Allum - * Emmanuele Bassi - * Robert Bragg - * Neil Roberts - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include - -#include - -#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) -{ -} diff --git a/clutter/cogl/clutter-backend-cogl.h b/clutter/cogl/clutter-backend-cogl.h deleted file mode 100644 index 483b6ce..0000000 --- a/clutter/cogl/clutter-backend-cogl.h +++ /dev/null @@ -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 . - * - * Authors: - * Matthew Allum - * Robert Bragg - */ - -#ifndef __CLUTTER_BACKEND_COGL_H__ -#define __CLUTTER_BACKEND_COGL_H__ - -#include -#include -#include -#include - -#ifdef COGL_HAS_XLIB_SUPPORT -#include -#include -#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__ */ diff --git a/clutter/cogl/clutter-stage-cogl.c b/clutter/cogl/clutter-stage-cogl.c index fe600c0..98af269 100644 --- a/clutter/cogl/clutter-stage-cogl.c +++ b/clutter/cogl/clutter-stage-cogl.c @@ -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)); } diff --git a/clutter/cogl/clutter-stage-cogl.h b/clutter/cogl/clutter-stage-cogl.h index d3a9b98..e140824 100644 --- a/clutter/cogl/clutter-stage-cogl.h +++ b/clutter/cogl/clutter-stage-cogl.h @@ -1,8 +1,8 @@ #ifndef __CLUTTER_STAGE_COGL_H__ #define __CLUTTER_STAGE_COGL_H__ -#include #include +#include #include #ifdef COGL_HAS_X11_SUPPORT @@ -11,8 +11,6 @@ #include #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; diff --git a/clutter/egl/clutter-backend-eglnative.c b/clutter/egl/clutter-backend-eglnative.c index e14d8ac..de92761 100644 --- a/clutter/egl/clutter-backend-eglnative.c +++ b/clutter/egl/clutter-backend-eglnative.c @@ -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) diff --git a/clutter/egl/clutter-backend-eglnative.h b/clutter/egl/clutter-backend-eglnative.h index 5156339..87ff7ee 100644 --- a/clutter/egl/clutter-backend-eglnative.h +++ b/clutter/egl/clutter-backend-eglnative.h @@ -32,7 +32,6 @@ #include #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; diff --git a/clutter/gdk/clutter-backend-gdk.c b/clutter/gdk/clutter-backend-gdk.c index dedef89..38f5740 100644 --- a/clutter/gdk/clutter-backend-gdk.c +++ b/clutter/gdk/clutter-backend-gdk.c @@ -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; diff --git a/clutter/gdk/clutter-backend-gdk.h b/clutter/gdk/clutter-backend-gdk.h index 73f8d86..fb54113 100644 --- a/clutter/gdk/clutter-backend-gdk.h +++ b/clutter/gdk/clutter-backend-gdk.h @@ -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 */ }; diff --git a/clutter/x11/clutter-backend-x11.c b/clutter/x11/clutter-backend-x11.c index 8b5a519..8e8f1a6 100644 --- a/clutter/x11/clutter-backend-x11.c +++ b/clutter/x11/clutter-backend-x11.c @@ -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 diff --git a/clutter/x11/clutter-backend-x11.h b/clutter/x11/clutter-backend-x11.h index 9398616..2922733 100644 --- a/clutter/x11/clutter-backend-x11.h +++ b/clutter/x11/clutter-backend-x11.h @@ -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; diff --git a/clutter/x11/clutter-stage-x11.c b/clutter/x11/clutter-stage-x11.c index edf7b9c..7ceb0d5 100644 --- a/clutter/x11/clutter-stage-x11.c +++ b/clutter/x11/clutter-stage-x11.c @@ -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); }