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
This commit is contained in:
Dan Winship 2011-02-16 12:02:14 -05:00
parent 1bc1a0dbf0
commit 1a639f0b17
2 changed files with 3 additions and 35 deletions

View File

@ -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 = '';

View File

@ -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;