Grab focus in expanded notifications on hover

In addition to already grabbing focus in the summary notifications,
we also want to grab focus in the new notifications when the user
hovers over them and expands them.

The notifications that expand automatically will only get focus once
the user hovers over them. The notifications that don't expand will
never grab focus because they don't need it.

Make sure that we toggle the way we grab focus when switching between
the overview and the main mode. This is necessary because, unlike
summary notifications that pop down when the user moves between the two
modes, new notifications keep being shown as long as the user hovers
over them or until they time out.

https://bugzilla.gnome.org/show_bug.cgi?id=617224
This commit is contained in:
Marina Zhurakhinskaya
2010-07-21 01:19:25 -04:00
parent 46906eef43
commit 95d438b86d
2 changed files with 50 additions and 9 deletions

View File

@ -579,7 +579,6 @@ Notification.prototype = {
MessageTray.Notification.prototype._init.call(this, id, source, source.title);
this._responseEntry = new St.Entry({ style_class: 'chat-response' });
this._responseEntry.clutter_text.connect('key-focus-in', Lang.bind(this, this.grabFocus));
this._responseEntry.clutter_text.connect('activate', Lang.bind(this, this._onEntryActivated));
this.setActionArea(this._responseEntry);
@ -620,10 +619,10 @@ Notification.prototype = {
}
},
grabFocus: function() {
grabFocus: function(lockTray) {
// Need to call the base class function first so that
// it saves where the key focus was before.
MessageTray.Notification.prototype.grabFocus.call(this);
MessageTray.Notification.prototype.grabFocus.call(this, lockTray);
global.stage.set_key_focus(this._responseEntry.clutter_text);
},