[gnome-shell] searchDisplay: Reset the keyboard focus after displaying async results



commit 54788d750eb2b5a103440802e2ac7caf9d7801dd
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Apr 30 00:25:59 2012 +0200

    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 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js
index 3c16e56..c2185d9 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]