mirror of
https://github.com/brl/mutter.git
synced 2025-01-23 18:09:10 +00:00
clutter: Add clutter_stage_get_event_actor() API call
This is a small helper to retrieve the actor that is currently beneath the device/sequence, meant to replace clutter_event_get_source(). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
This commit is contained in:
parent
b644ea1bce
commit
62bd0359a9
@ -3921,3 +3921,70 @@ clutter_stage_get_grab_actor (ClutterStage *stage)
|
|||||||
/* Return active grab */
|
/* Return active grab */
|
||||||
return priv->topmost_grab->actor;
|
return priv->topmost_grab->actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_stage_get_event_actor:
|
||||||
|
* @stage: a #ClutterStage
|
||||||
|
* @event: an event received on the stage
|
||||||
|
*
|
||||||
|
* Retrieves the current focus actor for an event. This is
|
||||||
|
* the key focus for key events and other events directed
|
||||||
|
* to the key focus, or the actor directly under the
|
||||||
|
* coordinates of a device or touch sequence.
|
||||||
|
*
|
||||||
|
* The actor is looked up at the time of calling this function,
|
||||||
|
* and may differ from the actor that the stage originally
|
||||||
|
* delivered the event to.
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): a pointer to the #ClutterActor or %NULL
|
||||||
|
**/
|
||||||
|
ClutterActor *
|
||||||
|
clutter_stage_get_event_actor (ClutterStage *stage,
|
||||||
|
const ClutterEvent *event)
|
||||||
|
{
|
||||||
|
ClutterInputDevice *device;
|
||||||
|
ClutterEventSequence *sequence;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
|
||||||
|
g_return_val_if_fail (event != NULL, NULL);
|
||||||
|
|
||||||
|
switch (event->type)
|
||||||
|
{
|
||||||
|
case CLUTTER_KEY_PRESS:
|
||||||
|
case CLUTTER_KEY_RELEASE:
|
||||||
|
case CLUTTER_PAD_BUTTON_PRESS:
|
||||||
|
case CLUTTER_PAD_BUTTON_RELEASE:
|
||||||
|
case CLUTTER_PAD_RING:
|
||||||
|
case CLUTTER_PAD_STRIP:
|
||||||
|
case CLUTTER_IM_COMMIT:
|
||||||
|
case CLUTTER_IM_DELETE:
|
||||||
|
case CLUTTER_IM_PREEDIT:
|
||||||
|
return clutter_stage_get_key_focus (stage);
|
||||||
|
case CLUTTER_MOTION:
|
||||||
|
case CLUTTER_ENTER:
|
||||||
|
case CLUTTER_LEAVE:
|
||||||
|
case CLUTTER_BUTTON_PRESS:
|
||||||
|
case CLUTTER_BUTTON_RELEASE:
|
||||||
|
case CLUTTER_SCROLL:
|
||||||
|
case CLUTTER_TOUCH_BEGIN:
|
||||||
|
case CLUTTER_TOUCH_UPDATE:
|
||||||
|
case CLUTTER_TOUCH_END:
|
||||||
|
case CLUTTER_TOUCH_CANCEL:
|
||||||
|
case CLUTTER_TOUCHPAD_PINCH:
|
||||||
|
case CLUTTER_TOUCHPAD_SWIPE:
|
||||||
|
case CLUTTER_TOUCHPAD_HOLD:
|
||||||
|
case CLUTTER_PROXIMITY_IN:
|
||||||
|
case CLUTTER_PROXIMITY_OUT:
|
||||||
|
device = clutter_event_get_device (event);
|
||||||
|
sequence = clutter_event_get_event_sequence (event);
|
||||||
|
|
||||||
|
return clutter_stage_get_device_actor (stage, device, sequence);
|
||||||
|
case CLUTTER_DEVICE_ADDED:
|
||||||
|
case CLUTTER_DEVICE_REMOVED:
|
||||||
|
case CLUTTER_NOTHING:
|
||||||
|
case CLUTTER_EVENT_LAST:
|
||||||
|
g_warn_if_reached ();
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@ -250,6 +250,9 @@ CLUTTER_EXPORT
|
|||||||
ClutterActor * clutter_stage_get_device_actor (ClutterStage *stage,
|
ClutterActor * clutter_stage_get_device_actor (ClutterStage *stage,
|
||||||
ClutterInputDevice *device,
|
ClutterInputDevice *device,
|
||||||
ClutterEventSequence *sequence);
|
ClutterEventSequence *sequence);
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterActor * clutter_stage_get_event_actor (ClutterStage *stage,
|
||||||
|
const ClutterEvent *event);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterGrab * clutter_stage_grab (ClutterStage *stage,
|
ClutterGrab * clutter_stage_grab (ClutterStage *stage,
|
||||||
|
@ -338,7 +338,6 @@ if have_tests
|
|||||||
],
|
],
|
||||||
exe_wrapper: [
|
exe_wrapper: [
|
||||||
default_test_wrappers,
|
default_test_wrappers,
|
||||||
find_program('catchsegv'),
|
|
||||||
find_program('xvfb-run'), '-a', '-s', '+iglx -noreset',
|
find_program('xvfb-run'), '-a', '-s', '+iglx -noreset',
|
||||||
],
|
],
|
||||||
timeout_multiplier: 10,
|
timeout_multiplier: 10,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user