cogl/backend: Remove the ClutterBackendCogl class
authorEmmanuele Bassi <ebassi@linux.intel.com>
Fri, 4 Nov 2011 16:52:44 +0000 (16:52 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Thu, 10 Nov 2011 14:55:03 +0000 (14:55 +0000)
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.

12 files changed:
clutter/Makefile.am
clutter/cogl/clutter-backend-cogl.c [deleted file]
clutter/cogl/clutter-backend-cogl.h [deleted file]
clutter/cogl/clutter-stage-cogl.c
clutter/cogl/clutter-stage-cogl.h
clutter/egl/clutter-backend-eglnative.c
clutter/egl/clutter-backend-eglnative.h
clutter/gdk/clutter-backend-gdk.c
clutter/gdk/clutter-backend-gdk.h
clutter/x11/clutter-backend-x11.c
clutter/x11/clutter-backend-x11.h
clutter/x11/clutter-stage-x11.c

index fb41ac2..69e8e2e 100644 (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)
 
diff --git a/clutter/cogl/clutter-backend-cogl.c b/clutter/cogl/clutter-backend-cogl.c
deleted file mode 100644 (file)
index 31d0552..0000000
+++ /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 <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)
-{
-}
diff --git a/clutter/cogl/clutter-backend-cogl.h b/clutter/cogl/clutter-backend-cogl.h
deleted file mode 100644 (file)
index 483b6ce..0000000
+++ /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 <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__ */
index fe600c0..98af269 100644 (file)
 #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));
 }
 
index d3a9b98..e140824 100644 (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;
 
index e14d8ac..de92761 100644 (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)
index 5156339..87ff7ee 100644 (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;
index dedef89..38f5740 100644 (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;
index 73f8d86..fb54113 100644 (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 */
 };
index 8b5a519..8e8f1a6 100644 (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
index 9398616..2922733 100644 (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;
index edf7b9c..7ceb0d5 100644 (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);
 }