[gnome-shell] [StEntry] Consider children when setting hover state



commit cc163237cc4ab5900b331e69e53f2fca56998ac5
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue May 25 15:45:51 2010 +0200

    [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

 src/st/st-entry.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index 1d641b6..42a4687 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -578,12 +578,22 @@ st_entry_key_focus_in (ClutterActor *actor)
 }
 
 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,7 +605,8 @@ static gboolean
 st_entry_leave_event (ClutterActor         *actor,
                       ClutterCrossingEvent *event)
 {
-  st_widget_set_hover (ST_WIDGET (actor), FALSE);
+  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);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]