mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
clutter: Send touch crossing events only to grab actor
When the pointer is grabbed, we send the crossing events that are initiated by this pointer only to the actor that has the grab. For grabbed touch sequences, we always capture and bubble the crossing events right now. Fix this and make grabbed pointers and touch sequences behave the same by sending touch crossing events only to the grab actor. https://gitlab.gnome.org/GNOME/mutter/merge_requests/422
This commit is contained in:
parent
9e0e35d2a7
commit
24b3467584
@ -1021,6 +1021,9 @@ clutter_event_get_event_sequence (const ClutterEvent *event)
|
||||
event->type == CLUTTER_TOUCH_END ||
|
||||
event->type == CLUTTER_TOUCH_CANCEL)
|
||||
return event->touch.sequence;
|
||||
else if (event->type == CLUTTER_ENTER ||
|
||||
event->type == CLUTTER_LEAVE)
|
||||
return event->crossing.sequence;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -269,6 +269,7 @@ struct _ClutterCrossingEvent
|
||||
gfloat x;
|
||||
gfloat y;
|
||||
ClutterInputDevice *device;
|
||||
ClutterEventSequence *sequence;
|
||||
ClutterActor *related;
|
||||
};
|
||||
|
||||
|
@ -834,6 +834,7 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
event->crossing.x = device->current_x;
|
||||
event->crossing.y = device->current_y;
|
||||
event->crossing.related = actor;
|
||||
event->crossing.sequence = sequence;
|
||||
clutter_event_set_device (event, device);
|
||||
|
||||
/* we need to make sure that this event is processed
|
||||
@ -870,6 +871,7 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
event->crossing.y = device->current_y;
|
||||
event->crossing.source = actor;
|
||||
event->crossing.related = old_actor;
|
||||
event->crossing.sequence = sequence;
|
||||
clutter_event_set_device (event, device);
|
||||
|
||||
/* see above */
|
||||
|
@ -2004,6 +2004,36 @@ emit_pointer_event (ClutterEvent *event,
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emit_crossing_event (ClutterEvent *event,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
|
||||
ClutterActor *grab_actor = NULL;
|
||||
|
||||
if (_clutter_event_process_filters (event))
|
||||
return;
|
||||
|
||||
if (sequence)
|
||||
{
|
||||
if (device->sequence_grab_actors != NULL)
|
||||
grab_actor = g_hash_table_lookup (device->sequence_grab_actors, sequence);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (context->pointer_grab_actor != NULL)
|
||||
grab_actor = context->pointer_grab_actor;
|
||||
else if (device != NULL && device->pointer_grab_actor != NULL)
|
||||
grab_actor = device->pointer_grab_actor;
|
||||
}
|
||||
|
||||
if (grab_actor != NULL)
|
||||
clutter_actor_event (grab_actor, event, FALSE);
|
||||
else
|
||||
emit_event_chain (event);
|
||||
}
|
||||
|
||||
static inline void
|
||||
emit_touch_event (ClutterEvent *event,
|
||||
ClutterInputDevice *device)
|
||||
@ -2177,7 +2207,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
{
|
||||
ClutterActor *actor = NULL;
|
||||
|
||||
emit_pointer_event (event, device);
|
||||
emit_crossing_event (event, device);
|
||||
|
||||
actor = _clutter_input_device_update (device, NULL, FALSE);
|
||||
if (actor != stage)
|
||||
@ -2189,12 +2219,12 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
crossing->crossing.related = stage;
|
||||
crossing->crossing.source = actor;
|
||||
|
||||
emit_pointer_event (crossing, device);
|
||||
emit_crossing_event (crossing, device);
|
||||
clutter_event_free (crossing);
|
||||
}
|
||||
}
|
||||
else
|
||||
emit_pointer_event (event, device);
|
||||
emit_crossing_event (event, device);
|
||||
break;
|
||||
|
||||
case CLUTTER_LEAVE:
|
||||
@ -2213,10 +2243,10 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
crossing->crossing.related = stage;
|
||||
crossing->crossing.source = device->cursor_actor;
|
||||
|
||||
emit_pointer_event (crossing, device);
|
||||
emit_crossing_event (crossing, device);
|
||||
clutter_event_free (crossing);
|
||||
}
|
||||
emit_pointer_event (event, device);
|
||||
emit_crossing_event (event, device);
|
||||
break;
|
||||
|
||||
case CLUTTER_DESTROY_NOTIFY:
|
||||
|
Loading…
Reference in New Issue
Block a user