[gnome-shell] grabHelper: Clean up the code a bit



commit be5df17a4aa6d3fb3e683ba30165b9efc5b94fbd
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Sep 3 20:23:51 2012 -0300

    grabHelper: Clean up the code a bit
    
    I don't remember why I added needsGrab in the first place.

 js/ui/grabHelper.js |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js
index 4eb3065..a4392cc 100644
--- a/js/ui/grabHelper.js
+++ b/js/ui/grabHelper.js
@@ -10,11 +10,12 @@ const St = imports.gi.St;
 const Main = imports.ui.main;
 const Params = imports.misc.params;
 
-function _navigateActor(actor, needsGrab) {
+function _navigateActor(actor) {
     if (!actor)
         return;
 
-    if (needsGrab && actor instanceof St.Widget)
+    let needsGrab = true;
+    if (actor instanceof St.Widget)
         needsGrab = !actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
     if (needsGrab)
         actor.grab_key_focus();
@@ -169,7 +170,8 @@ const GrabHelper = new Lang.Class({
         if (params.grabFocus)
             this._grabFocusCount++;
 
-        _navigateActor(newFocus, hadFocus);
+        if (hadFocus)
+            _navigateActor(newFocus);
 
         return true;
     },
@@ -254,7 +256,9 @@ const GrabHelper = new Lang.Class({
             this._fullUngrab(wasModal);
 
         let poppedGrab = poppedGrabs[0];
-        _navigateActor(poppedGrab.savedFocus, hadFocus);
+
+        if (hadFocus)
+            _navigateActor(poppedGrab.savedFocus);
     },
 
     _fullUngrab: function(wasModal) {



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