searchDisplay: Reset the keyboard focus after displaying async results

We hide the content around displaying new search results to prevent
flickering, unfortunately, one side effect of hiding an actor is
losing key focus if it currently is on the that actor or any
child. This could happen in the case of async results showing up after
the user had moved focus to the search results.

This patch works around that issue by saving the key focus and
resetting it back after displaying the new async results.

https://bugzilla.gnome.org/show_bug.cgi?id=675078
This commit is contained in:
Rui Matos 2012-04-30 00:25:59 +02:00
parent 78e894c6f2
commit 54788d750e

View File

@ -395,10 +395,17 @@ const SearchResults = new Lang.Class({
function(metas) {
this._clearDisplayForProvider(provider);
meta.actor.show();
// Hinding drops the key focus if we have it
let focus = global.stage.get_key_focus();
this._content.hide();
meta.resultDisplay.renderResults(metas);
this._maybeSetInitialSelection();
this._content.show();
if (this._content.contains(focus))
global.stage.set_key_focus(focus);
}));
} else {
let metas = provider.getResultMetas(results);