[mutter/wip/carlosg/no-event-source: 1/2] clutter: Rewrite clutter_event_[gs]et_source()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/no-event-source: 1/2] clutter: Rewrite clutter_event_[gs]et_source()
- Date: Mon, 28 Feb 2022 16:31:41 +0000 (UTC)
commit f557e127578deeddbcbb929485aa1df6b7eba89f
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Feb 25 16:15:43 2022 +0100
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.
clutter/clutter/clutter-event.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/clutter/clutter/clutter-event.c b/clutter/clutter/clutter-event.c
index 05cd7ba495..72bf04e769 100644
--- a/clutter/clutter/clutter-event.c
+++ b/clutter/clutter/clutter-event.c
@@ -539,9 +539,15 @@ clutter_event_set_coords (ClutterEvent *event,
ClutterActor *
clutter_event_get_source (const ClutterEvent *event)
{
+ ClutterActor *source;
+
g_return_val_if_fail (event != NULL, NULL);
- return event->any.source;
+ source =
+ clutter_stage_get_device_actor (clutter_event_get_stage (event),
+ clutter_event_get_device (event),
+ clutter_event_get_event_sequence (event));
+ return source;
}
/**
@@ -557,10 +563,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;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]