2008-04-04 Emmanuele Bassi <ebassi@openedhand.com>

Bug #864 - Allow instantiating and subclassing of ClutterStage

	* clutter/Makefile.am: Add clutter-stage-window.[ch]

	* clutter/clutter-stage-manager.c:
	(_clutter_stage_manager_remove_stage): Do not warn if removing
	a stage we don't manage, as we might be invoked multiple times
	during a ClutterState dispose sequence.

	* clutter/clutter-actor.c:
	* clutter/clutter-backend.[ch]:
	* clutter/clutter-main.c:
	* clutter/clutter-private.h:
	* clutter/clutter-stage.[ch]: Make ClutterStage a proxy actor,
	with a private actor implementing the ClutterStageWindow
	interface for handling the per-backend realization, painting
	and unrealization, plus all the windowing system abstraction.

	* clutter/x11/clutter-event-x11.c:
	* clutter/x11/clutter-stage-x11.[ch]: Port the X11 backend
	to the new backend and stage API and semantics.

	* clutter/glx/clutter-backend-glx.c:
	* clutter/glx/clutter-stage-glx.c: Port the GLX backend to
	the new backend and stage API and semantics.

	* clutter/eglx/clutter-backend-egl.[ch]:
	* clutter/eglx/clutter-stage-egl.[ch]: Port the EGLX backend
	to the new backend and stage API and semantics (untested).

	* tests/test-multistage.c (on_button_press): Rename
	clutter_stage_create_new() to clutter_stage_new().
This commit is contained in:
Emmanuele Bassi
2008-04-04 15:02:11 +00:00
parent beb03b9750
commit f859135082
22 changed files with 1037 additions and 510 deletions

View File

@ -44,6 +44,7 @@
#include "clutter-fixed.h"
#include "clutter-backend.h"
#include "clutter-private.h"
#include "clutter-debug.h"
G_DEFINE_ABSTRACT_TYPE (ClutterBackend, clutter_backend, G_TYPE_OBJECT);
@ -138,8 +139,9 @@ _clutter_backend_post_parse (ClutterBackend *backend,
return TRUE;
}
ClutterActor*
ClutterActor *
_clutter_backend_create_stage (ClutterBackend *backend,
ClutterStage *wrapper,
GError **error)
{
ClutterMainContext *context;
@ -147,6 +149,7 @@ _clutter_backend_create_stage (ClutterBackend *backend,
ClutterActor *stage = NULL;
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), FALSE);
g_return_val_if_fail (CLUTTER_IS_STAGE (wrapper), FALSE);
context = clutter_context_get_default ();
@ -155,28 +158,30 @@ _clutter_backend_create_stage (ClutterBackend *backend,
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->create_stage)
stage = klass->create_stage (backend, error);
stage = klass->create_stage (backend, wrapper, error);
if (!stage)
return NULL;
_clutter_stage_manager_add_stage (context->stage_manager,
CLUTTER_STAGE(stage));
_clutter_stage_manager_add_stage (context->stage_manager, wrapper);
return stage;
}
void
_clutter_backend_redraw (ClutterBackend *backend, ClutterStage *stage)
_clutter_backend_redraw (ClutterBackend *backend,
ClutterStage *stage)
{
ClutterBackendClass *klass;
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (G_LIKELY(klass->redraw))
if (G_LIKELY (klass->redraw))
klass->redraw (backend, stage);
}
void
_clutter_backend_ensure_context (ClutterBackend *backend, ClutterStage *stage)
_clutter_backend_ensure_context (ClutterBackend *backend,
ClutterStage *stage)
{
ClutterBackendClass *klass;
static ClutterStage *current_context_stage = NULL;
@ -184,13 +189,16 @@ _clutter_backend_ensure_context (ClutterBackend *backend, ClutterStage *stage)
g_return_if_fail (CLUTTER_IS_BACKEND (backend));
g_return_if_fail (CLUTTER_IS_STAGE (stage));
if (stage != current_context_stage || !CLUTTER_ACTOR_IS_REALIZED(stage))
if (stage != current_context_stage || !CLUTTER_ACTOR_IS_REALIZED (stage))
{
if (!CLUTTER_ACTOR_IS_REALIZED(stage))
stage = NULL;
if (!CLUTTER_ACTOR_IS_REALIZED (stage))
{
CLUTTER_NOTE (MULTISTAGE, "Stage is not realized");
stage = NULL;
}
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (G_LIKELY(klass->ensure_context))
if (G_LIKELY (klass->ensure_context))
klass->ensure_context (backend, stage);
/* FIXME: With a NULL stage and thus no active context it may make more