clutter/main: Add clutter_stage_repick_device() call

This is the very same code than meta_wayland_pointer_repick(),
made part of Clutter, so triggering repicks on the same pointer
coordinates is made easy.

The intention is to remove meta_wayland_pointer_repick() in favor
of this call.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1654>
This commit is contained in:
Carlos Garnacho 2020-12-22 18:22:41 +01:00
parent 717e5d969a
commit b04e326572
2 changed files with 23 additions and 0 deletions

View File

@ -1642,6 +1642,26 @@ clutter_stage_update_device (ClutterStage *stage,
} }
} }
void
clutter_stage_repick_device (ClutterStage *stage,
ClutterInputDevice *device)
{
graphene_point_t point;
ClutterActor *new_actor;
clutter_stage_get_device_coords (stage, device, NULL, &point);
new_actor =
clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_REACTIVE,
point.x, point.y);
clutter_stage_update_device (stage,
device, NULL,
point,
CLUTTER_CURRENT_TIME,
new_actor,
TRUE);
}
static ClutterActor * static ClutterActor *
update_device_for_event (ClutterStage *stage, update_device_for_event (ClutterStage *stage,
ClutterEvent *event, ClutterEvent *event,

View File

@ -89,6 +89,9 @@ void clutter_stage_get_device_coords (ClutterStage *stage,
ClutterInputDevice *device, ClutterInputDevice *device,
ClutterEventSequence *sequence, ClutterEventSequence *sequence,
graphene_point_t *coords); graphene_point_t *coords);
CLUTTER_EXPORT
void clutter_stage_repick_device (ClutterStage *stage,
ClutterInputDevice *device);
#undef __CLUTTER_H_INSIDE__ #undef __CLUTTER_H_INSIDE__