keyboard: Ignore focus changes caused by tray showing/hiding

The keyboard is shown/hidden automatically when (un)focusing a
ClutterText actor. This behavior breaks with the message tray now
grabbing/releasing key focus when toggled. Fix this by ignoring
all focus changes to or from the message tray.

https://bugzilla.gnome.org/show_bug.cgi?id=683546
This commit is contained in:
Florian Müllner 2012-09-24 17:02:13 +02:00
parent 2ed7ee8f71
commit 6c1bd95643

View File

@ -200,6 +200,7 @@ const Keyboard = new Lang.Class({
this._impl.export(Gio.DBus.session, '/org/gnome/Caribou/Keyboard');
this.actor = null;
this._focusInTray = false;
this._timestamp = global.display.get_current_time_roundtrip();
Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._redraw));
@ -291,6 +292,12 @@ const Keyboard = new Lang.Class({
if (focus && (focus._extended_keys || (focus._key && focus._key.extended_key)))
return;
// Ignore focus changes caused by message tray showing/hiding
let trayWasFocused = this._focusInTray;
this._focusInTray = (focus && Main.messageTray.actor.contains(focus));
if (this._focusInTray || trayWasFocused)
return;
let time = global.get_current_time();
if (focus instanceof Clutter.Text)
this.Show(time);