Revert "clutter: Drop Event.get_source"

We'll need this API again when adding ClutterGesture.

This reverts commit 6032be04a0.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2389>
This commit is contained in:
Jonas Dreßler 2023-12-10 15:00:35 +01:00
parent 753156c7f2
commit 7342863b9f
2 changed files with 23 additions and 0 deletions

View File

@ -510,6 +510,27 @@ clutter_event_get_position (const ClutterEvent *event,
} }
/**
* clutter_event_get_source:
* @event: a #ClutterEvent
*
* Retrieves the source #ClutterActor the event originated from, or
* NULL if the event has no source.
*
* Return value: (transfer none): a #ClutterActor
*/
ClutterActor *
clutter_event_get_source (const ClutterEvent *event)
{
g_return_val_if_fail (event != NULL, NULL);
if (event->type == CLUTTER_ENTER ||
event->type == CLUTTER_LEAVE)
return event->crossing.source;
return NULL;
}
/** /**
* clutter_event_get_flags: * clutter_event_get_flags:
* @event: a #ClutterEvent * @event: a #ClutterEvent

View File

@ -170,6 +170,8 @@ ClutterInputDevice * clutter_event_get_source_device (const ClutterEv
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterInputDeviceTool *clutter_event_get_device_tool (const ClutterEvent *event); ClutterInputDeviceTool *clutter_event_get_device_tool (const ClutterEvent *event);
CLUTTER_DEPRECATED
ClutterActor * clutter_event_get_source (const ClutterEvent *event);
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterInputDeviceType clutter_event_get_device_type (const ClutterEvent *event); ClutterInputDeviceType clutter_event_get_device_type (const ClutterEvent *event);
CLUTTER_EXPORT CLUTTER_EXPORT