]> Dogcows Code - chaz/openbox/commitdiff
add some safety checks
authorDana Jansens <danakj@orodu.net>
Tue, 4 Feb 2003 12:10:19 +0000 (12:10 +0000)
committerDana Jansens <danakj@orodu.net>
Tue, 4 Feb 2003 12:10:19 +0000 (12:10 +0000)
scripts/focus.py

index 5e7c0d28dbdf900b65053c70b11654c915167562..f51b92144e5ddf02fa989288185aaa514d88eb94 100644 (file)
@@ -53,7 +53,9 @@ def _focused(data):
 
     if data.client:
         # move it to the top
-        _remove(data.client)
+        try:
+            _remove(data.client)
+        except ValueError: pass # happens if _focused comes before _newwindow
         _clients.insert(0, data.client)
     elif FALLBACK:
         # pass around focus
@@ -63,6 +65,11 @@ def _focused(data):
                 break
 
 def _newwindow(data):
+    # make sure its not already in the list
+    win = client.window()
+    for i in range(len(_clients)):
+        if _clients[i].window() == win:
+            return
     _clients.append(data.client)
         
 def _closewindow(data):
This page took 0.024085 seconds and 4 git commands to generate.