clutter: Pass timestamp to clutter_input_device_set_actor()

This function emits crossing events, so needs a (most times truthful)
timestamp. Make it explicit instead of fetching it from the device.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
This commit is contained in:
Carlos Garnacho 2020-06-05 19:12:14 +02:00
parent 8d8c933eb4
commit 849cc3d7f5
5 changed files with 23 additions and 17 deletions

View File

@ -185,15 +185,12 @@ void _clutter_input_device_set_state (ClutterInputDevice *device,
CLUTTER_EXPORT
void _clutter_input_device_set_time (ClutterInputDevice *device,
guint32 time_);
void _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterActor *actor,
gboolean emit_crossing);
CLUTTER_EXPORT
ClutterActor * clutter_input_device_update (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterStage *stage,
gboolean emit_crossing);
gboolean emit_crossing,
uint32_t time_);
CLUTTER_EXPORT
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);

View File

@ -735,11 +735,12 @@ on_cursor_actor_reactive_changed (ClutterActor *actor,
* - set to %TRUE the :has-pointer property of the new pointer
* actor
*/
void
static void
_clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterActor *actor,
gboolean emit_crossing)
gboolean emit_crossing,
uint32_t time_)
{
ClutterActor *old_actor = clutter_input_device_get_actor (device, sequence);
ClutterStage *stage = NULL;
@ -767,7 +768,7 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEvent *event;
event = clutter_event_new (CLUTTER_LEAVE);
event->crossing.time = device->current_time;
event->crossing.time = time_;
event->crossing.flags = 0;
event->crossing.stage = stage;
event->crossing.source = old_actor;
@ -804,7 +805,7 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEvent *event;
event = clutter_event_new (CLUTTER_ENTER);
event->crossing.time = device->current_time;
event->crossing.time = time_;
event->crossing.flags = 0;
event->crossing.stage = stage;
event->crossing.x = device->current_x;
@ -971,7 +972,8 @@ ClutterActor *
clutter_input_device_update (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterStage *stage,
gboolean emit_crossing)
gboolean emit_crossing,
uint32_t time_)
{
ClutterActor *new_cursor_actor;
ClutterActor *old_cursor_actor;
@ -1008,7 +1010,8 @@ clutter_input_device_update (ClutterInputDevice *device,
_clutter_input_device_set_actor (device, sequence,
new_cursor_actor,
emit_crossing);
emit_crossing,
time_);
return new_cursor_actor;
}
@ -1611,7 +1614,8 @@ _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
g_hash_table_replace (device->inv_touch_sequence_actors,
info->actor, sequences);
_clutter_input_device_set_actor (device, sequence, NULL, TRUE);
_clutter_input_device_set_actor (device, sequence, NULL, TRUE,
clutter_event_get_time (event));
}
g_hash_table_remove (device->touch_sequences_info, sequence);

View File

@ -1622,7 +1622,8 @@ _clutter_process_event_details (ClutterActor *stage,
emit_crossing_event (event, device);
actor = clutter_input_device_update (device, NULL,
CLUTTER_STAGE (stage), FALSE);
CLUTTER_STAGE (stage), FALSE,
clutter_event_get_time (event));
if (actor != stage)
{
ClutterEvent *crossing;
@ -1773,7 +1774,8 @@ _clutter_process_event_details (ClutterActor *stage,
actor = clutter_input_device_update (device, NULL,
CLUTTER_STAGE (stage),
TRUE);
TRUE,
clutter_event_get_time (event));
if (actor == NULL)
break;
@ -1883,7 +1885,8 @@ _clutter_process_event_details (ClutterActor *stage,
actor = clutter_input_device_update (device, sequence,
CLUTTER_STAGE (stage),
TRUE);
TRUE,
clutter_event_get_time (event));
if (actor == NULL)
break;

View File

@ -1363,7 +1363,8 @@ clutter_stage_update_devices (ClutterStage *stage,
for (l = devices; l; l = l->next)
{
ClutterInputDevice *device = l->data;
clutter_input_device_update (device, NULL, stage, TRUE);
clutter_input_device_update (device, NULL, stage, TRUE,
CLUTTER_CURRENT_TIME);
}
}

View File

@ -1047,7 +1047,8 @@ meta_wayland_pointer_repick (MetaWaylandPointer *pointer)
MetaBackend *backend = meta_get_backend ();
ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
clutter_input_device_update (pointer->device, NULL, stage, FALSE);
clutter_input_device_update (pointer->device, NULL, stage, FALSE,
CLUTTER_CURRENT_TIME);
repick_for_event (pointer, NULL);
}