From 1a639f0b17416cbb90dba81899c423508db041f7 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 16 Feb 2011 12:02:14 -0500 Subject: [PATCH] StEntry: remove special redundant hover tracking For historical reasons, StEntry always did hover tracking when you had visible hint_text, even if track_hover was FALSE. Remove that special case, and make entries track hover just like all other widgets do. If we actually needed to distinguish hovered-with-hint-text from hovered-without-hint-text (which, at the moment, we don't), we could do that by setting separate CSS for :hover and :hover:indeterminate. https://bugzilla.gnome.org/show_bug.cgi?id=642483 --- js/ui/viewSelector.js | 11 +++-------- src/st/st-entry.c | 27 --------------------------- 2 files changed, 3 insertions(+), 35 deletions(-) diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index 3e1f21034..f59dccb87 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/viewSelector.js @@ -23,7 +23,8 @@ function SearchEntry(focusBase) { SearchEntry.prototype = { _init : function(focusBase) { this.actor = new St.Entry({ name: 'searchEntry', - hint_text: _("Search your computer") }); + hint_text: _("Search your computer"), + track_hover: true }); this.entry = this.actor.clutter_text; this.actor.clutter_text.connect('text-changed', Lang.bind(this, @@ -73,13 +74,7 @@ SearchEntry.prototype = { }, reset: function () { - let [x, y, mask] = global.get_pointer(); - let actor = global.stage.get_actor_at_pos (Clutter.PickMode.REACTIVE, - x, y); - // this.actor is never hovered directly, only its clutter_text and icon - let hovered = this.actor == actor.get_parent(); - - this.actor.set_hover(hovered); + this.actor.sync_hover(); this.entry.text = ''; diff --git a/src/st/st-entry.c b/src/st/st-entry.c index fe0fe34bb..0cded5a49 100644 --- a/src/st/st-entry.c +++ b/src/st/st-entry.c @@ -599,31 +599,6 @@ st_entry_key_focus_in (ClutterActor *actor) clutter_actor_grab_key_focus (priv->entry); } -static gboolean -st_entry_enter_event (ClutterActor *actor, - ClutterCrossingEvent *event) -{ - StEntryPrivate *priv = ST_ENTRY_PRIV (actor); - - if (clutter_actor_contains (actor, event->source) - && priv->hint && priv->hint_visible) - { - st_widget_set_hover (ST_WIDGET (actor), TRUE); - } - - return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->enter_event (actor, event); -} - -static gboolean -st_entry_leave_event (ClutterActor *actor, - ClutterCrossingEvent *event) -{ - if (!clutter_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); -} - static void st_entry_class_init (StEntryClass *klass) { @@ -649,8 +624,6 @@ st_entry_class_init (StEntryClass *klass) actor_class->key_press_event = st_entry_key_press_event; actor_class->key_focus_in = st_entry_key_focus_in; - actor_class->enter_event = st_entry_enter_event; - actor_class->leave_event = st_entry_leave_event; widget_class->style_changed = st_entry_style_changed; widget_class->navigate_focus = st_entry_navigate_focus;