2007-03-23 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-private.h:
	* clutter/clutter-backend.h: Move the backend functions
	into the private header.

	* clutter/glx/clutter-stage-glx.c:
	* clutter/glx/clutter-event-glx.c:
	* clutter/clutter-main.c:
	* clutter/clutter-stage.c: Update the calls to the private
	backend functions.

	* clutter/clutter-backend.[ch]: Add an ::init_features
	vfunc to ClutterBackend.
This commit is contained in:
Emmanuele Bassi 2007-03-23 17:55:13 +00:00
parent 0a112d5912
commit d0f1186e1d
8 changed files with 128 additions and 45 deletions

View File

@ -1,3 +1,18 @@
2007-03-23 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-private.h:
* clutter/clutter-backend.h: Move the backend functions
into the private header.
* clutter/glx/clutter-stage-glx.c:
* clutter/glx/clutter-event-glx.c:
* clutter/clutter-main.c:
* clutter/clutter-stage.c: Update the calls to the private
backend functions.
* clutter/clutter-backend.[ch]: Add an ::init_features
vfunc to ClutterBackend.
2007-03-23 Emmanuele Bassi <ebassi@openedhand.com> 2007-03-23 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/glx/clutter-stage-glx.c: * clutter/glx/clutter-stage-glx.c:

View File

@ -55,7 +55,7 @@ clutter_backend_init (ClutterBackend *backend)
} }
ClutterActor * ClutterActor *
clutter_backend_get_stage (ClutterBackend *backend) _clutter_backend_get_stage (ClutterBackend *backend)
{ {
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), NULL); g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), NULL);
@ -63,8 +63,8 @@ clutter_backend_get_stage (ClutterBackend *backend)
} }
void void
clutter_backend_add_options (ClutterBackend *backend, _clutter_backend_add_options (ClutterBackend *backend,
GOptionGroup *group) GOptionGroup *group)
{ {
g_return_if_fail (CLUTTER_IS_BACKEND (backend)); g_return_if_fail (CLUTTER_IS_BACKEND (backend));
@ -72,8 +72,8 @@ clutter_backend_add_options (ClutterBackend *backend,
} }
gboolean gboolean
clutter_backend_pre_parse (ClutterBackend *backend, _clutter_backend_pre_parse (ClutterBackend *backend,
GError **error) GError **error)
{ {
ClutterBackendClass *klass; ClutterBackendClass *klass;
@ -87,8 +87,8 @@ clutter_backend_pre_parse (ClutterBackend *backend,
} }
gboolean gboolean
clutter_backend_post_parse (ClutterBackend *backend, _clutter_backend_post_parse (ClutterBackend *backend,
GError **error) GError **error)
{ {
ClutterBackendClass *klass; ClutterBackendClass *klass;
@ -102,8 +102,8 @@ clutter_backend_post_parse (ClutterBackend *backend,
} }
gboolean gboolean
clutter_backend_init_stage (ClutterBackend *backend, _clutter_backend_init_stage (ClutterBackend *backend,
GError **error) GError **error)
{ {
ClutterBackendClass *klass; ClutterBackendClass *klass;
@ -117,7 +117,7 @@ clutter_backend_init_stage (ClutterBackend *backend,
} }
void void
clutter_backend_init_events (ClutterBackend *backend) _clutter_backend_init_events (ClutterBackend *backend)
{ {
ClutterBackendClass *klass; ClutterBackendClass *klass;
@ -128,6 +128,48 @@ clutter_backend_init_events (ClutterBackend *backend)
klass->init_events (backend); klass->init_events (backend);
} }
void
_clutter_backend_init_features (ClutterBackend *backend)
{
ClutterBackendClass *klass;
g_return_if_fail (CLUTTER_IS_BACKEND (backend));
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->init_features)
klass->init_features (backend);
}
/**
* clutter_get_default_backend:
*
* FIXME
*
* Return value: the default backend. You should not ref or
* unref the returned object
*
* Since: 0.4
*/
ClutterBackend *
clutter_get_default_backend (void)
{
ClutterMainContext *clutter_context;
clutter_context = clutter_context_get_default ();
return clutter_context->backend;
}
/**
* clutter_backend_get_event:
* @backend: a #ClutterBackend
*
* FIXME
*
* Return value: the #ClutterEvent removed from the queue
*
* Since: 0.4
*/
ClutterEvent * ClutterEvent *
clutter_backend_get_event (ClutterBackend *backend) clutter_backend_get_event (ClutterBackend *backend)
{ {
@ -137,6 +179,16 @@ clutter_backend_get_event (ClutterBackend *backend)
return _clutter_event_queue_pop (backend); return _clutter_event_queue_pop (backend);
} }
/**
* clutter_backend_peek_event:
* @backend: a #ClutterBackend
*
* FIXME
*
* Return value: a copy of the first #ClutterEvent in the queue
*
* Since: 0.4
*/
ClutterEvent * ClutterEvent *
clutter_backend_peek_event (ClutterBackend *backend) clutter_backend_peek_event (ClutterBackend *backend)
{ {
@ -145,6 +197,15 @@ clutter_backend_peek_event (ClutterBackend *backend)
return _clutter_event_queue_peek (backend); return _clutter_event_queue_peek (backend);
} }
/**
* clutter_backend_put_event:
* @backend: a #ClutterBackend
* @event: a #ClutterEvent
*
* FIXME
*
* Since: 0.4
*/
void void
clutter_backend_put_event (ClutterBackend *backend, clutter_backend_put_event (ClutterBackend *backend,
ClutterEvent *event) ClutterEvent *event)

View File

@ -47,6 +47,7 @@ struct _ClutterBackend
GObject parent_instance; GObject parent_instance;
/*< private >*/ /*< private >*/
/* events queue: every backend must implement one */ /* events queue: every backend must implement one */
GQueue *events_queue; GQueue *events_queue;
gpointer queue_head; gpointer queue_head;
@ -67,34 +68,27 @@ struct _ClutterBackendClass
GObjectClass parent_class; GObjectClass parent_class;
/* vfuncs */ /* vfuncs */
gboolean (* pre_parse) (ClutterBackend *backend, gboolean (* pre_parse) (ClutterBackend *backend,
GError **error); GError **error);
gboolean (* post_parse) (ClutterBackend *backend, gboolean (* post_parse) (ClutterBackend *backend,
GError **error); GError **error);
gboolean (* init_stage) (ClutterBackend *backend, gboolean (* init_stage) (ClutterBackend *backend,
GError **error); GError **error);
void (* init_events) (ClutterBackend *backend); void (* init_events) (ClutterBackend *backend);
ClutterActor *(* get_stage) (ClutterBackend *backend); void (* init_features) (ClutterBackend *backend);
void (* add_options) (ClutterBackend *backend, ClutterActor *(* get_stage) (ClutterBackend *backend);
GOptionGroup *group); void (* add_options) (ClutterBackend *backend,
GOptionGroup *group);
}; };
GType clutter_backend_get_type (void) G_GNUC_CONST; GType clutter_backend_get_type (void) G_GNUC_CONST;
ClutterActor *clutter_backend_get_stage (ClutterBackend *backend);
void clutter_backend_add_options (ClutterBackend *backend,
GOptionGroup *group);
gboolean clutter_backend_pre_parse (ClutterBackend *backend,
GError **error);
gboolean clutter_backend_post_parse (ClutterBackend *backend,
GError **error);
gboolean clutter_backend_init_stage (ClutterBackend *backend,
GError **error);
void clutter_backend_init_events (ClutterBackend *backend);
ClutterEvent *clutter_backend_get_event (ClutterBackend *backend); ClutterBackend *clutter_get_default_backend (void);
ClutterEvent *clutter_backend_peek_event (ClutterBackend *backend);
void clutter_backend_put_event (ClutterBackend *backend, ClutterEvent * clutter_backend_get_event (ClutterBackend *backend);
ClutterEvent *event); ClutterEvent * clutter_backend_peek_event (ClutterBackend *backend);
void clutter_backend_put_event (ClutterBackend *backend,
ClutterEvent *event);
G_END_DECLS G_END_DECLS

View File

@ -112,7 +112,7 @@ clutter_redraw (void)
ctx = clutter_context_get_default (); ctx = clutter_context_get_default ();
if (ctx->backend) if (ctx->backend)
clutter_actor_paint (clutter_backend_get_stage (ctx->backend)); clutter_actor_paint (_clutter_backend_get_stage (ctx->backend));
} }
static void static void
@ -125,7 +125,7 @@ clutter_main_do_event (ClutterEvent *event,
context = clutter_context_get_default (); context = clutter_context_get_default ();
backend = context->backend; backend = context->backend;
stage = clutter_backend_get_stage (backend); stage = _clutter_backend_get_stage (backend);
if (!stage) if (!stage)
return; return;
@ -469,7 +469,7 @@ clutter_get_option_group (void)
g_option_group_add_entries (group, clutter_args); g_option_group_add_entries (group, clutter_args);
/* add backend-specific options */ /* add backend-specific options */
clutter_backend_add_options (context->backend, group); _clutter_backend_add_options (context->backend, group);
return group; return group;
} }
@ -547,13 +547,13 @@ clutter_init_with_args (int *argc,
clutter_context = clutter_context_get_default (); clutter_context = clutter_context_get_default ();
stage_error = NULL; stage_error = NULL;
if (!clutter_backend_init_stage (clutter_context->backend, &stage_error)) if (!_clutter_backend_init_stage (clutter_context->backend, &stage_error))
{ {
g_propagate_error (error, stage_error); g_propagate_error (error, stage_error);
return CLUTTER_INIT_ERROR_INTERNAL; return CLUTTER_INIT_ERROR_INTERNAL;
} }
clutter_backend_init_events (clutter_context->backend); _clutter_backend_init_events (clutter_context->backend);
return CLUTTER_INIT_SUCCESS; return CLUTTER_INIT_SUCCESS;
} }
@ -621,7 +621,7 @@ clutter_init (int *argc,
context = clutter_context_get_default (); context = clutter_context_get_default ();
stage_error = NULL; stage_error = NULL;
if (!clutter_backend_init_stage (context->backend, &stage_error)) if (!_clutter_backend_init_stage (context->backend, &stage_error))
{ {
g_critical (stage_error->message); g_critical (stage_error->message);
g_error_free (stage_error); g_error_free (stage_error);

View File

@ -96,6 +96,19 @@ ClutterEvent *_clutter_event_queue_pop (ClutterBackend *backend);
ClutterEvent *_clutter_event_queue_peek (ClutterBackend *backend); ClutterEvent *_clutter_event_queue_peek (ClutterBackend *backend);
gboolean _clutter_event_queue_check_pending (ClutterBackend *backend); gboolean _clutter_event_queue_check_pending (ClutterBackend *backend);
ClutterActor *_clutter_backend_get_stage (ClutterBackend *backend);
void _clutter_backend_add_options (ClutterBackend *backend,
GOptionGroup *group);
gboolean _clutter_backend_pre_parse (ClutterBackend *backend,
GError **error);
gboolean _clutter_backend_post_parse (ClutterBackend *backend,
GError **error);
gboolean _clutter_backend_init_stage (ClutterBackend *backend,
GError **error);
void _clutter_backend_init_events (ClutterBackend *backend);
void _clutter_backend_init_features (ClutterBackend *backend);
/* signal accumulators */ /* signal accumulators */
gboolean _clutter_boolean_accumulator (GSignalInvocationHint *ihint, gboolean _clutter_boolean_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu, GValue *return_accu,

View File

@ -419,7 +419,7 @@ clutter_stage_get_default (void)
context = clutter_context_get_default (); context = clutter_context_get_default ();
g_assert (context != NULL); g_assert (context != NULL);
return clutter_backend_get_stage (context->backend); return _clutter_backend_get_stage (context->backend);
} }
/** /**

View File

@ -211,7 +211,7 @@ clutter_event_translate (ClutterBackend *backend,
Window xwindow, stage_xwindow; Window xwindow, stage_xwindow;
backend_glx = CLUTTER_BACKEND_GLX (backend); backend_glx = CLUTTER_BACKEND_GLX (backend);
stage = CLUTTER_STAGE (clutter_backend_get_stage (backend)); stage = CLUTTER_STAGE (_clutter_backend_get_stage (backend));
stage_xwindow = clutter_glx_get_stage_window (stage); stage_xwindow = clutter_glx_get_stage_window (stage);
xwindow = xevent->xany.window; xwindow = xevent->xany.window;

View File

@ -515,7 +515,7 @@ clutter_stage_glx_set_cursor_visible (ClutterStage *stage,
XFixesShowCursor (stage_glx->xdpy, stage_glx->xwin); XFixesShowCursor (stage_glx->xdpy, stage_glx->xwin);
#else #else
XUndefineCursor (stage_glx->xdpy, stage_glx->xwin); XUndefineCursor (stage_glx->xdpy, stage_glx->xwin);
#endif #endif /* HAVE_XFIXES */
} }
else else
{ {
@ -534,7 +534,7 @@ clutter_stage_glx_set_cursor_visible (ClutterStage *stage,
1, 1); 1, 1);
XFreePixmap (stage_glx->xdpy, pix); XFreePixmap (stage_glx->xdpy, pix);
XDefineCursor (stage_glx->xdpy, stage_glx->xwin, curs); XDefineCursor (stage_glx->xdpy, stage_glx->xwin, curs);
#endif #endif /* HAVE_XFIXES */
} }
sync_viewport (stage_glx); sync_viewport (stage_glx);