clutter: Rewrite clutter_event_[gs]et_source()

It does not make sense that the event "source" (aka the target) is
both content and recipient of a message. Not doing so, events become
largely independent of the actor that is receiving/handling an
event. This is small step toward making events opaque and immutable.

Every user of these API calls in our code have ported away from
them, but other users may remain in extensions, so make these
functions work on top of the alternative API without accessing the
soon to be removed event field.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
This commit is contained in:
Carlos Garnacho 2022-02-25 16:15:43 +01:00 committed by Marge Bot
parent 62bd0359a9
commit 2aeaeece7d
2 changed files with 4 additions and 7 deletions

View File

@ -541,7 +541,8 @@ clutter_event_get_source (const ClutterEvent *event)
{
g_return_val_if_fail (event != NULL, NULL);
return event->any.source;
return clutter_stage_get_event_actor (clutter_event_get_stage (event),
event);
}
/**
@ -557,10 +558,6 @@ void
clutter_event_set_source (ClutterEvent *event,
ClutterActor *actor)
{
g_return_if_fail (event != NULL);
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
event->any.source = actor;
}
/**

View File

@ -716,10 +716,10 @@ void clutter_event_set_device_tool (ClutterEvent
CLUTTER_EXPORT
ClutterInputDeviceTool *clutter_event_get_device_tool (const ClutterEvent *event);
CLUTTER_EXPORT
CLUTTER_DEPRECATED_FOR(clutter_stage_get_event_actor)
void clutter_event_set_source (ClutterEvent *event,
ClutterActor *actor);
CLUTTER_EXPORT
CLUTTER_DEPRECATED
ClutterActor * clutter_event_get_source (const ClutterEvent *event);
CLUTTER_EXPORT
void clutter_event_set_stage (ClutterEvent *event,