mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
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:
parent
62bd0359a9
commit
2aeaeece7d
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user