clutter: Port stage crossing events to new constructors

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
This commit is contained in:
Carlos Garnacho 2023-07-21 19:10:35 +02:00
parent 6aa42d6dad
commit a8c62251f8

View File

@ -3162,35 +3162,6 @@ find_common_root_actor (ClutterStage *stage,
return CLUTTER_ACTOR (stage); return CLUTTER_ACTOR (stage);
} }
static ClutterEvent *
create_crossing_event (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterInputDevice *source_device,
ClutterEventType event_type,
ClutterEventFlags flags,
ClutterActor *source,
ClutterActor *related,
graphene_point_t coords,
uint32_t time_ms)
{
ClutterEvent *event;
event = clutter_event_new (event_type);
event->crossing.time = time_ms;
event->crossing.flags = flags;
event->crossing.stage = stage;
event->crossing.x = coords.x;
event->crossing.y = coords.y;
event->crossing.source = source;
event->crossing.related = related;
event->crossing.sequence = sequence;
clutter_event_set_device (event, device);
clutter_event_set_source_device (event, source_device);
return event;
}
static inline void static inline void
add_actor_to_event_emission_chain (GArray *chain, add_actor_to_event_emission_chain (GArray *chain,
ClutterActor *actor, ClutterActor *actor,
@ -3379,16 +3350,14 @@ sync_crossings_on_implicit_grab_end (ClutterStage *self,
topmost = parent; topmost = parent;
} }
crossing = create_crossing_event (self, crossing = clutter_event_crossing_new (CLUTTER_ENTER,
entry->device, CLUTTER_EVENT_FLAG_GRAB_NOTIFY,
entry->sequence, CLUTTER_CURRENT_TIME,
NULL, entry->device,
CLUTTER_ENTER, entry->sequence,
CLUTTER_EVENT_FLAG_GRAB_NOTIFY, entry->coords,
entry->current_actor, entry->current_actor,
NULL, NULL);
entry->coords,
CLUTTER_CURRENT_TIME);
if (!_clutter_event_process_filters (crossing, deepmost)) if (!_clutter_event_process_filters (crossing, deepmost))
{ {
@ -3465,13 +3434,14 @@ clutter_stage_update_device (ClutterStage *stage,
*/ */
if (old_actor && emit_crossing) if (old_actor && emit_crossing)
{ {
event = create_crossing_event (stage, event = clutter_event_crossing_new (CLUTTER_LEAVE,
device, sequence, CLUTTER_EVENT_NONE,
source_device, ms2us (time_ms),
CLUTTER_LEAVE, device,
CLUTTER_EVENT_NONE, sequence,
old_actor, new_actor, point,
point, time_ms); old_actor,
new_actor);
if (!_clutter_event_process_filters (event, old_actor)) if (!_clutter_event_process_filters (event, old_actor))
{ {
clutter_stage_emit_crossing_event (stage, clutter_stage_emit_crossing_event (stage,
@ -3485,13 +3455,14 @@ clutter_stage_update_device (ClutterStage *stage,
if (new_actor && emit_crossing) if (new_actor && emit_crossing)
{ {
event = create_crossing_event (stage, event = clutter_event_crossing_new (CLUTTER_ENTER,
device, sequence, CLUTTER_EVENT_NONE,
source_device, ms2us (time_ms),
CLUTTER_ENTER, device,
CLUTTER_EVENT_NONE, sequence,
new_actor, old_actor, point,
point, time_ms); new_actor,
old_actor);
if (!_clutter_event_process_filters (event, new_actor)) if (!_clutter_event_process_filters (event, new_actor))
{ {
clutter_stage_emit_crossing_event (stage, clutter_stage_emit_crossing_event (stage,
@ -3751,17 +3722,15 @@ clutter_stage_notify_grab_on_pointer_entry (ClutterStage *stage,
if (entry->implicit_grab_actor) if (entry->implicit_grab_actor)
deepmost = find_common_root_actor (stage, entry->implicit_grab_actor, deepmost); deepmost = find_common_root_actor (stage, entry->implicit_grab_actor, deepmost);
event = create_crossing_event (stage, event = clutter_event_crossing_new (event_type,
entry->device, CLUTTER_EVENT_FLAG_GRAB_NOTIFY,
entry->sequence, CLUTTER_CURRENT_TIME,
NULL, entry->device,
event_type, entry->sequence,
CLUTTER_EVENT_FLAG_GRAB_NOTIFY, entry->coords,
entry->current_actor, entry->current_actor,
event_type == CLUTTER_LEAVE ? event_type == CLUTTER_LEAVE ?
grab_actor : old_grab_actor, grab_actor : old_grab_actor);
entry->coords,
CLUTTER_CURRENT_TIME);
if (!_clutter_event_process_filters (event, entry->current_actor)) if (!_clutter_event_process_filters (event, entry->current_actor))
{ {
clutter_stage_emit_crossing_event (stage, clutter_stage_emit_crossing_event (stage,