[gnome-shell] main: Rename curFocus to prevFocus



commit 2d9ddd4bc8d964c12846e6d29fe2797fb94edceb
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jan 2 09:13:24 2013 -0500

    main: Rename curFocus to prevFocus
    
    This better describes what we're tracking here: the previous
    keyboard focus before pushing the modal.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690965

 js/ui/main.js |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 1334d58..8c9136a 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -547,19 +547,20 @@ function pushModal(actor, params) {
         if (index >= 0)
             popModal(actor);
     });
-    let curFocus = global.stage.get_key_focus();
-    let curFocusDestroyId;
-    if (curFocus != null) {
-        curFocusDestroyId = curFocus.connect('destroy', function() {
+
+    let prevFocus = global.stage.get_key_focus();
+    let prevFocusDestroyId;
+    if (prevFocus != null) {
+        prevFocusDestroyId = prevFocus.connect('destroy', function() {
             let index = _findModal(actor);
             if (index >= 0)
-                modalActorFocusStack[index].focus = null;
+                modalActorFocusStack[index].prevFocus = null;
         });
     }
     modalActorFocusStack.push({ actor: actor,
-                                focus: curFocus,
                                 destroyId: actorDestroyId,
-                                focusDestroyId: curFocusDestroyId,
+                                prevFocus: prevFocus,
+                                prevFocusDestroyId: prevFocusDestroyId,
                                 keybindingMode: keybindingMode });
 
     keybindingMode = params.keybindingMode;
@@ -600,18 +601,18 @@ function popModal(actor, timestamp) {
     record.actor.disconnect(record.destroyId);
 
     if (focusIndex == modalActorFocusStack.length - 1) {
-        if (record.focus)
-            record.focus.disconnect(record.focusDestroyId);
+        if (record.prevFocus)
+            record.prevFocus.disconnect(record.prevFocusDestroyId);
         keybindingMode = record.keybindingMode;
-        global.stage.set_key_focus(record.focus);
+        global.stage.set_key_focus(record.prevFocus);
     } else {
         let t = modalActorFocusStack[modalActorFocusStack.length - 1];
-        if (t.focus)
-            t.focus.disconnect(t.focusDestroyId);
+        if (t.prevFocus)
+            t.prevFocus.disconnect(t.prevFocusDestroyId);
         // Remove from the middle, shift the focus chain up
         for (let i = modalActorFocusStack.length - 1; i > focusIndex; i--) {
-            modalActorFocusStack[i].focus = modalActorFocusStack[i - 1].focus;
-            modalActorFocusStack[i].focusDestroyId = modalActorFocusStack[i - 1].focusDestroyId;
+            modalActorFocusStack[i].prevFocus = modalActorFocusStack[i - 1].prevFocus;
+            modalActorFocusStack[i].prevFocusDestroyId = modalActorFocusStack[i - 1].prevFocusDestroyId;
             modalActorFocusStack[i].keybindingMode = modalActorFocusStack[i - 1].keybindingMode;
         }
     }



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