1
0
Fork 0

egl/backend: Clean up

The "EGL native" backend is just a short-hand for a pure Cogl backend,
using whatever input mechanism was enabled at run-time.
This commit is contained in:
Emmanuele Bassi 2011-11-04 17:49:25 +00:00
parent 89e26497de
commit 04a2b5f42b
2 changed files with 2 additions and 139 deletions

View file

@ -44,10 +44,6 @@
#include "clutter-device-manager-evdev.h"
#endif
#ifdef HAVE_TSLIB
#include "clutter-event-tslib.h"
#endif
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-main.h"
@ -57,15 +53,6 @@
#include "clutter-egl.h"
#endif
#ifdef CLUTTER_EGL_BACKEND_CEX100
#include "clutter-cex100.h"
#endif
#ifdef CLUTTER_EGL_BACKEND_CEX100
static gdl_plane_id_t gdl_plane = GDL_PLANE_ID_UPP_C;
static guint gdl_n_buffers = CLUTTER_CEX100_TRIPLE_BUFFERING;
#endif
#define clutter_backend_egl_native_get_type _clutter_backend_egl_native_get_type
G_DEFINE_TYPE (ClutterBackendEglNative, clutter_backend_egl_native, CLUTTER_TYPE_BACKEND);
@ -75,15 +62,15 @@ clutter_backend_egl_native_get_device_manager (ClutterBackend *backend)
{
ClutterBackendEglNative *backend_egl_native = CLUTTER_BACKEND_EGL_NATIVE (backend);
#ifdef HAVE_EVDEV
if (G_UNLIKELY (backend_egl_native->device_manager == NULL))
{
#ifdef HAVE_EVDEV
backend_egl_native->device_manager =
g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_EVDEV,
"backend", backend_egl_native,
NULL);
#endif
}
#endif
return backend_egl_native->device_manager;
}
@ -99,19 +86,11 @@ clutter_backend_egl_native_dispose (GObject *gobject)
backend_egl_native->event_timer = NULL;
}
#ifdef HAVE_TSLIB
_clutter_events_tslib_uninit (CLUTTER_BACKEND (gobject));
#endif
#ifdef HAVE_EVDEV
_clutter_events_evdev_uninit (CLUTTER_BACKEND (gobject));
if (backend_egl_native->device_manager != NULL)
{
g_object_unref (backend_egl_native->device_manager);
backend_egl_native->device_manager = NULL;
}
#endif
G_OBJECT_CLASS (clutter_backend_egl_native_parent_class)->dispose (gobject);
}
@ -142,79 +121,6 @@ clutter_backend_egl_native_create_stage (ClutterBackend *backend,
return stage;
}
static gboolean
clutter_backend_egl_native_create_context (ClutterBackend *backend,
GError **error)
{
CoglSwapChain *swap_chain = NULL;
CoglOnscreenTemplate *onscreen_template = NULL;
if (backend->cogl_context != NULL)
return TRUE;
backend->cogl_renderer = cogl_renderer_new ();
if (!cogl_renderer_connect (backend->cogl_renderer, error))
goto error;
swap_chain = cogl_swap_chain_new ();
#if defined(CLUTTER_EGL_BACKEND_CEX100) && defined(COGL_HAS_GDL_SUPPORT)
cogl_swap_chain_set_length (swap_chain, gdl_n_buffers);
#endif
onscreen_template = cogl_onscreen_template_new (swap_chain);
cogl_object_unref (swap_chain);
/* XXX: I have some doubts that this is a good design.
* Conceptually should we be able to check an onscreen_template
* without more details about the CoglDisplay configuration?
*/
if (!cogl_renderer_check_onscreen_template (backend->cogl_renderer,
onscreen_template,
error))
goto error;
backend->cogl_display = cogl_display_new (backend->cogl_renderer,
onscreen_template);
#if defined(CLUTTER_EGL_BACKEND_CEX100) && defined(COGL_HAS_GDL_SUPPORT)
cogl_gdl_display_set_plane (backend->cogl_display, gdl_plane);
#endif /* CLUTTER_EGL_BACKEND_CEX100 */
cogl_object_unref (backend->cogl_renderer);
cogl_object_unref (onscreen_template);
if (!cogl_display_setup (backend->cogl_display, error))
goto error;
backend->cogl_context = cogl_context_new (backend->cogl_display, error);
if (backend->cogl_context == NULL)
goto error;
return TRUE;
error:
if (backend->cogl_display != NULL)
{
cogl_object_unref (backend->cogl_display);
backend->cogl_display = NULL;
}
if (onscreen_template != NULL)
cogl_object_unref (onscreen_template);
if (swap_chain != NULL)
cogl_object_unref (swap_chain);
if (backend->cogl_renderer != NULL)
{
cogl_object_unref (backend->cogl_renderer);
backend->cogl_renderer = NULL;
}
return FALSE;
}
static void
clutter_backend_egl_native_class_init (ClutterBackendEglNativeClass *klass)
{
@ -225,7 +131,6 @@ clutter_backend_egl_native_class_init (ClutterBackendEglNativeClass *klass)
backend_class->get_device_manager = clutter_backend_egl_native_get_device_manager;
backend_class->create_stage = clutter_backend_egl_native_create_stage;
backend_class->create_context = clutter_backend_egl_native_create_context;
}
static void
@ -234,43 +139,6 @@ clutter_backend_egl_native_init (ClutterBackendEglNative *backend_egl_native)
backend_egl_native->event_timer = g_timer_new ();
}
#ifdef CLUTTER_EGL_BACKEND_CEX100
/**
* clutter_cex100_set_plane:
* @plane: FIXME
*
* FIXME
*
* Since:
*/
void
clutter_cex100_set_plane (gdl_plane_id_t plane)
{
g_return_if_fail (plane >= GDL_PLANE_ID_UPP_A && plane <= GDL_PLANE_ID_UPP_E);
gdl_plane = plane;
}
#endif
#ifdef CLUTTER_EGL_BACKEND_CEX100
/**
* clutter_cex100_set_plane:
* @mode: FIXME
*
* FIXME
*
* Since:
*/
void
clutter_cex100_set_buffering_mode (ClutterCex100BufferingMode mode)
{
g_return_if_fail (mode == CLUTTER_CEX100_DOUBLE_BUFFERING ||
mode == CLUTTER_CEX100_TRIPLE_BUFFERING);
gdl_n_buffers = mode;
}
#endif
/**
* clutter_eglx_display:
*

View file

@ -49,10 +49,6 @@
G_BEGIN_DECLS
#define CLUTTER_TSLIB_INPUT_BACKEND "tslib"
#define CLUTTER_EVDEV_INPUT_BACKEND "evdev"
#ifndef CLUTTER_DISABLE_DEPRECATED
/**
* clutter_eglx_display:
*
@ -79,7 +75,6 @@ EGLDisplay clutter_eglx_display (void);
*/
CLUTTER_DEPRECATED_FOR(clutter_egl_get_egl_display)
EGLDisplay clutter_egl_display (void);
#endif /* CLUTTER_DISABLE_DEPRECATED */
/**
* clutter_egl_get_egl_display: