[mutter/wip/carlosg/no-event-source: 23/24] clutter: Rewrite clutter_event_[gs]et_source()
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/no-event-source: 23/24] clutter: Rewrite clutter_event_[gs]et_source()
- Date: Fri, 4 Mar 2022 10:58:32 +0000 (UTC)
commit 2aeaeece7d6e8ed30dfd317f695f0791ac3ee4c7
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.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
clutter/clutter/clutter-event.c | 7 ++-----
clutter/clutter/clutter-event.h | 4 ++--
2 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/clutter/clutter/clutter-event.c b/clutter/clutter/clutter-event.c
index 05cd7ba495..b1a5b6252f 100644
--- a/clutter/clutter/clutter-event.c
+++ b/clutter/clutter/clutter-event.c
@@ -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;
}
/**
diff --git a/clutter/clutter/clutter-event.h b/clutter/clutter/clutter-event.h
index 1378d91e0a..49b86247b7 100644
--- a/clutter/clutter/clutter-event.h
+++ b/clutter/clutter/clutter-event.h
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]