[StEntry] Consider children when setting hover state

When hovering over the entry's ClutterText, the entry itself
currently receives a leave event and updates the hover state.
Apply the same logic as StWidget itself to treat children as
part of the entry.

https://bugzilla.gnome.org/show_bug.cgi?id=620381
This commit is contained in:
Florian Müllner 2010-05-25 15:45:51 +02:00
parent 4acb082b6e
commit cc163237cc

View File

@ -577,13 +577,23 @@ st_entry_key_focus_in (ClutterActor *actor)
clutter_actor_grab_key_focus (priv->entry);
}
static gboolean
actor_contains (ClutterActor *widget,
ClutterActor *other)
{
while (other != NULL && other != widget)
other = clutter_actor_get_parent (other);
return other != NULL;
}
static gboolean
st_entry_enter_event (ClutterActor *actor,
ClutterCrossingEvent *event)
{
StEntryPrivate *priv = ST_ENTRY_PRIV (actor);
if (priv->hint && priv->hint_visible)
if (actor_contains (actor, event->source)
&& priv->hint && priv->hint_visible)
{
st_widget_set_hover (ST_WIDGET (actor), TRUE);
}
@ -595,6 +605,7 @@ static gboolean
st_entry_leave_event (ClutterActor *actor,
ClutterCrossingEvent *event)
{
if (!actor_contains (actor, event->related))
st_widget_set_hover (ST_WIDGET (actor), FALSE);
return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->leave_event (actor, event);