]> Dogcows Code - chaz/openbox/blobdiff - python/windowplacement.py
ignore shit
[chaz/openbox] / python / windowplacement.py
index 56b5320d21db96247c43a56cf964e6a70e30c5f0..1702ab00a04575c727687477670566eeb4b3b71d 100644 (file)
@@ -16,9 +16,12 @@ def random(client):
     #if data.client.positionRequested(): return
     cx, cy, cw, ch = client.area()
     sx, sy, sw, sh = ob.Openbox.screenArea(client.desktop())
-    global _rand
-    x = Random().randrange(sx, sw - cw - 1)
-    y = Random().randrange(sy, sh - ch - 1)
+    xr = sw - cw - 1 # x range
+    yr = sh - ch - 1 # y range
+    if xr <= 0: x = 0
+    else: x = Random().randrange(sx, xr)
+    if yr <= 0: y = 0
+    else: y = Random().randrange(sy, yr)
     client.setArea((x, y, cw, ch))
 
 def cascade(client):
This page took 0.019857 seconds and 4 git commands to generate.