From be5df17a4aa6d3fb3e683ba30165b9efc5b94fbd Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 3 Sep 2012 20:23:51 -0300 Subject: [PATCH] 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 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js index 4eb3065a1..a4392cc6b 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) {