summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-03-17 07:28:32 +0000
committerDana Jansens <danakj@orodu.net>2003-03-17 07:28:32 +0000
commit9a2699fa487233b8f0e2e8f130863b9c0a40e849 (patch)
treed287499a08718d9fb1784082f0b70da12f7d0fe4 /python
parenta4838c740cd52d4405fab019b73d118d02599c56 (diff)
place at 0,0 if the window is too big
Diffstat (limited to 'python')
-rw-r--r--python/windowplacement.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/python/windowplacement.py b/python/windowplacement.py
index afeff2ed..1702ab00 100644
--- a/python/windowplacement.py
+++ b/python/windowplacement.py
@@ -16,11 +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
- if sw - cw - 1 <= 0: x = 0
- else: x = Random().randrange(sx, sw - cw - 1)
- if (sh - ch - 1 <= 0: y = 0
- else: 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):