From 54788d750eb2b5a103440802e2ac7caf9d7801dd Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Mon, 30 Apr 2012 00:25:59 +0200 Subject: [PATCH] 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 --- js/ui/searchDisplay.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js index 3c16e5656..c2185d9ed 100644 --- a/js/ui/searchDisplay.js +++ b/js/ui/searchDisplay.js @@ -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);