diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2011-02-09 12:38:10 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2011-02-09 13:34:25 +0000 |
commit | ef4688fd0eb1bd915c6f924bbe03399855ae85ef (patch) | |
tree | 3e598d5e95117dbab579af9e5c567a4d4e16967d /clutter/clutter-event.c | |
parent | 56d133f9080281ad9dbdda2af0f57f3fe3a0775c (diff) | |
download | clutter-ef4688fd0eb1bd915c6f924bbe03399855ae85ef.tar.gz |
Avoid direct access to the main context events queue
The GQueue that stores the global events queue is handled all over the
place:
• the structure is created in _clutter_backend_init_events();
• the queue is handled in clutter-event.c, clutter-stage.c and
clutter-backend.c;
• ClutterStage::dispose cleans up the events associated with
the stage being destroyed;
• the queue is destroyed in ClutterBackend::dispose.
Since we need to have access to it in different places we cannot put it
inside ClutterBackendPrivate, hence it should stay in ClutterMainContext;
but we should still manage it from just one place - preferably by the
ClutterEvent API only.
Diffstat (limited to 'clutter/clutter-event.c')
-rw-r--r-- | clutter/clutter-event.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clutter/clutter-event.c b/clutter/clutter-event.c index 18992b729..23c39707e 100644 --- a/clutter/clutter-event.c +++ b/clutter/clutter-event.c @@ -793,7 +793,7 @@ clutter_event_get (void) { ClutterMainContext *context = _clutter_context_get_default (); - if (!context->events_queue) + if (context->events_queue == NULL) return NULL; if (g_queue_is_empty (context->events_queue)) @@ -835,9 +835,11 @@ _clutter_event_push (const ClutterEvent *event, ClutterMainContext *context = _clutter_context_get_default (); ClutterInputDevice *device; - /* FIXME: check queue is valid */ g_assert (context != NULL); + if (context->events_queue == NULL) + context->events_queue = g_queue_new (); + /* disabled devices don't propagate events */ device = clutter_event_get_device (event); if (device != NULL) @@ -893,7 +895,7 @@ clutter_events_pending (void) g_return_val_if_fail (context != NULL, FALSE); - if (!context->events_queue) + if (context->events_queue == NULL) return FALSE; return g_queue_is_empty (context->events_queue) == FALSE; |