diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c index 854778686..cac52249f 100644 --- a/clutter/clutter/clutter-main.c +++ b/clutter/clutter/clutter-main.c @@ -757,7 +757,8 @@ maybe_remove_device_for_event (ClutterStage *stage, } /** - * clutter_do_event: + * clutter_stage_handle_event: + * @stage: a #ClutterStage. * @event: a #ClutterEvent. * * Processes an event. @@ -769,21 +770,20 @@ maybe_remove_device_for_event (ClutterStage *stage, * toolkit, and it should never be called by applications. */ void -clutter_do_event (ClutterEvent *event) +clutter_stage_handle_event (ClutterStage *stage, + ClutterEvent *event) { ClutterContext *context = _clutter_context_get_default(); ClutterActor *event_actor = NULL; gboolean filtered; - /* we need the stage for the event */ - if (event->any.stage == NULL) - { - g_warning ("%s: Event does not have a stage: discarding.", G_STRFUNC); - return; - } + g_return_if_fail (CLUTTER_IS_STAGE (stage)); + g_return_if_fail (event != NULL); + + clutter_event_set_stage (event, stage); /* stages in destruction do not process events */ - if (CLUTTER_ACTOR_IN_DESTRUCTION (event->any.stage)) + if (CLUTTER_ACTOR_IN_DESTRUCTION (stage)) return; switch (event->any.type) @@ -793,7 +793,7 @@ clutter_do_event (ClutterEvent *event) case CLUTTER_BUTTON_PRESS: case CLUTTER_TOUCH_BEGIN: case CLUTTER_TOUCH_UPDATE: - update_device_for_event (event->any.stage, event, TRUE); + update_device_for_event (stage, event, TRUE); break; default: break; @@ -804,7 +804,7 @@ clutter_do_event (ClutterEvent *event) event->any.type != CLUTTER_NOTHING && event->any.type != CLUTTER_EVENT_LAST) { - event_actor = clutter_stage_get_event_actor (event->any.stage, event); + event_actor = clutter_stage_get_event_actor (stage, event); } context->current_event = g_slist_prepend (context->current_event, event); @@ -825,20 +825,20 @@ clutter_do_event (ClutterEvent *event) ClutterInputDevice *device = clutter_event_get_device (event); ClutterEventSequence *sequence = clutter_event_get_event_sequence (event); - clutter_stage_maybe_lost_implicit_grab (event->any.stage, device, sequence); + clutter_stage_maybe_lost_implicit_grab (stage, device, sequence); } } else { - _clutter_stage_queue_event (event->any.stage, event, TRUE); + _clutter_stage_queue_event (stage, event, TRUE); } if (event->type == CLUTTER_TOUCH_END || event->type == CLUTTER_TOUCH_CANCEL || event->type == CLUTTER_DEVICE_REMOVED) { - _clutter_stage_process_queued_events (event->any.stage); - maybe_remove_device_for_event (event->any.stage, event, TRUE); + _clutter_stage_process_queued_events (stage); + maybe_remove_device_for_event (stage, event, TRUE); } } @@ -891,7 +891,7 @@ _clutter_process_event_details (ClutterActor *stage, * @event: a #ClutterEvent. * * Does the actual work of processing an event that was queued earlier - * out of clutter_do_event(). + * out of clutter_stage_handle_event(). */ void _clutter_process_event (ClutterEvent *event) diff --git a/clutter/clutter/clutter-main.h b/clutter/clutter/clutter-main.h index 5e1e71f43..8b84b1819 100644 --- a/clutter/clutter/clutter-main.h +++ b/clutter/clutter/clutter-main.h @@ -90,7 +90,8 @@ typedef enum #define CLUTTER_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 50) CLUTTER_EXPORT -void clutter_do_event (ClutterEvent *event); +void clutter_stage_handle_event (ClutterStage *stage, + ClutterEvent *event); /* Debug utility functions */ CLUTTER_EXPORT diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index 28317db97..51e1e590c 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -1090,6 +1090,7 @@ static gboolean dispatch_clutter_event (MetaBackend *backend) { MetaBackendPrivate *priv = meta_backend_get_instance_private (backend); + ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend)); ClutterEvent *event; event = clutter_event_get (); @@ -1098,8 +1099,7 @@ dispatch_clutter_event (MetaBackend *backend) g_warn_if_fail (!priv->in_init || event->type == CLUTTER_DEVICE_ADDED); - event->any.stage = CLUTTER_STAGE (meta_backend_get_stage (backend)); - clutter_do_event (event); + clutter_stage_handle_event (stage, event); meta_backend_update_from_event (backend, event); clutter_event_free (event); return TRUE; diff --git a/src/backends/x11/meta-event-x11.c b/src/backends/x11/meta-event-x11.c index d42b33aee..e1ac17c4a 100644 --- a/src/backends/x11/meta-event-x11.c +++ b/src/backends/x11/meta-event-x11.c @@ -101,7 +101,8 @@ meta_x11_handle_event (MetaBackend *backend, while (spin > 0 && (event = clutter_event_get ())) { /* forward the event into clutter for emission etc. */ - clutter_do_event (event); + clutter_stage_handle_event (CLUTTER_STAGE (meta_backend_get_stage (backend)), + event); meta_backend_update_from_event (backend, event); clutter_event_free (event); --spin;