clutter: Pass source device onto crossing event generation machinery

For motion-induced crossing events, this will be the device that generated
the motion. For code-induced crossing events (e.g. grabs or actors disappearing)
this will be none.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2828>
This commit is contained in:
Carlos Garnacho 2023-02-01 17:37:59 +01:00
parent 8530e471bc
commit e58f716fb1
4 changed files with 18 additions and 3 deletions

View File

@ -696,6 +696,7 @@ update_device_for_event (ClutterStage *stage,
gboolean emit_crossing)
{
ClutterInputDevice *device = clutter_event_get_device (event);
ClutterInputDevice *source_device = clutter_event_get_source_device (event);
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
ClutterDeviceUpdateFlags flags = CLUTTER_DEVICE_UPDATE_NONE;
graphene_point_t point;
@ -710,6 +711,7 @@ update_device_for_event (ClutterStage *stage,
return clutter_stage_pick_and_update_device (stage,
device,
sequence,
source_device,
flags,
point,
time_ms);
@ -743,6 +745,7 @@ maybe_remove_device_for_event (ClutterStage *stage,
clutter_stage_update_device (stage,
device, sequence,
NULL,
point,
time,
NULL,

View File

@ -110,6 +110,7 @@ CLUTTER_EXPORT
void clutter_stage_update_device (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterInputDevice *source_device,
graphene_point_t point,
uint32_t time,
ClutterActor *new_actor,

View File

@ -155,6 +155,7 @@ void clutter_stage_remove_device_entry (ClutterStage *self,
ClutterActor * clutter_stage_pick_and_update_device (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterInputDevice *source_device,
ClutterDeviceUpdateFlags flags,
graphene_point_t point,
uint32_t time_ms);

View File

@ -946,7 +946,7 @@ clutter_stage_update_devices (ClutterStage *stage,
clutter_stage_pick_and_update_device (stage,
device,
NULL,
NULL, NULL,
CLUTTER_DEVICE_UPDATE_IGNORE_CACHE |
CLUTTER_DEVICE_UPDATE_EMIT_CROSSING,
entry->coords,
@ -3199,7 +3199,7 @@ clutter_stage_maybe_invalidate_focus (ClutterStage *self,
clutter_stage_pick_and_update_device (self,
entry->device,
NULL,
NULL, NULL,
CLUTTER_DEVICE_UPDATE_IGNORE_CACHE |
CLUTTER_DEVICE_UPDATE_EMIT_CROSSING,
entry->coords,
@ -3217,6 +3217,7 @@ clutter_stage_maybe_invalidate_focus (ClutterStage *self,
clutter_stage_pick_and_update_device (self,
entry->device,
entry->sequence,
NULL,
CLUTTER_DEVICE_UPDATE_IGNORE_CACHE |
CLUTTER_DEVICE_UPDATE_EMIT_CROSSING,
entry->coords,
@ -3426,6 +3427,7 @@ static ClutterEvent *
create_crossing_event (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterInputDevice *source_device,
ClutterEventType event_type,
ClutterEventFlags flags,
ClutterActor *source,
@ -3445,6 +3447,7 @@ create_crossing_event (ClutterStage *stage,
event->crossing.related = related;
event->crossing.sequence = sequence;
clutter_event_set_device (event, device);
clutter_event_set_source_device (event, source_device);
return event;
}
@ -3640,6 +3643,7 @@ sync_crossings_on_implicit_grab_end (ClutterStage *self,
crossing = create_crossing_event (self,
entry->device,
entry->sequence,
NULL,
CLUTTER_ENTER,
CLUTTER_EVENT_FLAG_GRAB_NOTIFY,
entry->current_actor,
@ -3662,6 +3666,7 @@ void
clutter_stage_update_device (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterInputDevice *source_device,
graphene_point_t point,
uint32_t time_ms,
ClutterActor *new_actor,
@ -3723,6 +3728,7 @@ clutter_stage_update_device (ClutterStage *stage,
{
event = create_crossing_event (stage,
device, sequence,
source_device,
CLUTTER_LEAVE,
CLUTTER_EVENT_NONE,
old_actor, new_actor,
@ -3742,6 +3748,7 @@ clutter_stage_update_device (ClutterStage *stage,
{
event = create_crossing_event (stage,
device, sequence,
source_device,
CLUTTER_ENTER,
CLUTTER_EVENT_NONE,
new_actor, old_actor,
@ -3768,7 +3775,7 @@ clutter_stage_repick_device (ClutterStage *stage,
clutter_stage_get_device_coords (stage, device, NULL, &point);
clutter_stage_pick_and_update_device (stage,
device,
NULL,
NULL, NULL,
CLUTTER_DEVICE_UPDATE_IGNORE_CACHE |
CLUTTER_DEVICE_UPDATE_EMIT_CROSSING,
point,
@ -3805,6 +3812,7 @@ ClutterActor *
clutter_stage_pick_and_update_device (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterInputDevice *source_device,
ClutterDeviceUpdateFlags flags,
graphene_point_t point,
uint32_t time_ms)
@ -3834,6 +3842,7 @@ clutter_stage_pick_and_update_device (ClutterStage *stage,
clutter_stage_update_device (stage,
device, sequence,
source_device,
point,
time_ms,
new_actor,
@ -4007,6 +4016,7 @@ clutter_stage_notify_grab_on_pointer_entry (ClutterStage *stage,
event = create_crossing_event (stage,
entry->device,
entry->sequence,
NULL,
event_type,
CLUTTER_EVENT_FLAG_GRAB_NOTIFY,
entry->current_actor,