[clutter] stage: Maintain the motion event delivery invariants
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] stage: Maintain the motion event delivery invariants
- Date: Mon, 20 Jun 2011 13:27:24 +0000 (UTC)
commit d5ea422c8fcf0fb3422f42f79b9d278b14d6dec5
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Mon Jun 20 13:53:09 2011 +0100
stage: Maintain the motion event delivery invariants
It is possible, by calling clutter_set_motion_events_enabled() prior to
the creation of any stage, to control the per-actor motion event
delivery flag on each newly created stage. Since we deprecated the
global accessor functions in favour of the per-Stage ones, we need to
remove the call to clutter_get_motion_events_enabled() inside the
ClutterStage instance initialization, and replace it with an internal
function.
This code will go away when we can finally break API and remove the
deprecated functions.
clutter/clutter-main.c | 12 +++++++++---
clutter/clutter-private.h | 21 +++++++++++----------
clutter/clutter-stage.c | 9 ++++++++-
3 files changed, 28 insertions(+), 14 deletions(-)
---
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index 972d41d..22bb22f 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -303,9 +303,7 @@ clutter_set_motion_events_enabled (gboolean enable)
gboolean
clutter_get_motion_events_enabled (void)
{
- ClutterMainContext *context = _clutter_context_get_default ();
-
- return context->motion_events_per_actor;
+ return _clutter_context_get_motion_events_enabled ();
}
ClutterActor *
@@ -3099,3 +3097,11 @@ _clutter_context_pop_shader_stack (ClutterActor *actor)
return _clutter_context_peek_shader_stack ();
}
+
+gboolean
+_clutter_context_get_motion_events_enabled (void)
+{
+ ClutterMainContext *context = _clutter_context_get_default ();
+
+ return context->motion_events_per_actor;
+}
diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h
index b75953e..2c3dd6e 100644
--- a/clutter/clutter-private.h
+++ b/clutter/clutter-private.h
@@ -178,16 +178,17 @@ typedef struct
gboolean _clutter_threads_dispatch (gpointer data);
void _clutter_threads_dispatch_free (gpointer data);
-ClutterMainContext * _clutter_context_get_default (void);
-gboolean _clutter_context_is_initialized (void);
-PangoContext * _clutter_context_create_pango_context (void);
-PangoContext * _clutter_context_get_pango_context (void);
-ClutterPickMode _clutter_context_get_pick_mode (void);
-void _clutter_context_push_shader_stack (ClutterActor *actor);
-ClutterActor * _clutter_context_pop_shader_stack (ClutterActor *actor);
-ClutterActor * _clutter_context_peek_shader_stack (void);
-guint32 _clutter_context_acquire_id (gpointer key);
-void _clutter_context_release_id (guint32 id_);
+ClutterMainContext * _clutter_context_get_default (void);
+gboolean _clutter_context_is_initialized (void);
+PangoContext * _clutter_context_create_pango_context (void);
+PangoContext * _clutter_context_get_pango_context (void);
+ClutterPickMode _clutter_context_get_pick_mode (void);
+void _clutter_context_push_shader_stack (ClutterActor *actor);
+ClutterActor * _clutter_context_pop_shader_stack (ClutterActor *actor);
+ClutterActor * _clutter_context_peek_shader_stack (void);
+guint32 _clutter_context_acquire_id (gpointer key);
+void _clutter_context_release_id (guint32 id_);
+gboolean _clutter_context_get_motion_events_enabled (void);
const gchar *_clutter_gettext (const gchar *str);
diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c
index 6c5cf57..10190a9 100644
--- a/clutter/clutter-stage.c
+++ b/clutter/clutter-stage.c
@@ -1998,7 +1998,14 @@ clutter_stage_init (ClutterStage *self)
priv->use_fog = FALSE;
priv->throttle_motion_events = TRUE;
priv->min_size_changed = FALSE;
- priv->motion_events_enabled = clutter_get_motion_events_enabled ();
+
+ /* XXX - we need to keep the invariant that calling
+ * clutter_set_motion_event_enabled() before the stage creation
+ * will cause motion event delivery to be disabled on any newly
+ * created stage. this can go away when we break API and remove
+ * deprecated functions.
+ */
+ priv->motion_events_enabled = _clutter_context_get_motion_events_enabled ();
priv->color = default_stage_color;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]