st: Move StEntry away from clutter_event_get_source()

Ask the stage about the device actor instead. Since leaving the
StEntry also means leaving the contained ClutterText, the checks
on LEAVE can be just removed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2216>
This commit is contained in:
Carlos Garnacho 2022-02-25 16:11:54 +01:00 committed by Marge Bot
parent 7b7e5ac0de
commit 6064a3e020

View File

@ -789,7 +789,13 @@ st_entry_enter_event (ClutterActor *actor,
ClutterCrossingEvent *event) ClutterCrossingEvent *event)
{ {
StEntryPrivate *priv = ST_ENTRY_PRIV (actor); StEntryPrivate *priv = ST_ENTRY_PRIV (actor);
if (event->source == priv->entry && event->related != NULL) ClutterStage *stage;
ClutterActor *target;
stage = clutter_event_get_stage ((ClutterEvent *) event);
target = clutter_stage_get_event_actor (stage, (ClutterEvent *) event);
if (target == priv->entry && event->related != NULL)
st_entry_set_cursor (ST_ENTRY (actor), TRUE); st_entry_set_cursor (ST_ENTRY (actor), TRUE);
return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->enter_event (actor, event); return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->enter_event (actor, event);
@ -799,8 +805,6 @@ static gboolean
st_entry_leave_event (ClutterActor *actor, st_entry_leave_event (ClutterActor *actor,
ClutterCrossingEvent *event) ClutterCrossingEvent *event)
{ {
StEntryPrivate *priv = ST_ENTRY_PRIV (actor);
if (event->source == priv->entry && event->related != NULL)
st_entry_set_cursor (ST_ENTRY (actor), FALSE); st_entry_set_cursor (ST_ENTRY (actor), FALSE);
return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->leave_event (actor, event); return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->leave_event (actor, event);