place at 0,0 if the window is too big

This commit is contained in:
Dana Jansens 2003-03-17 07:28:32 +00:00
parent a4838c740c
commit 9a2699fa48

View file

@ -16,11 +16,12 @@ def random(client):
#if data.client.positionRequested(): return #if data.client.positionRequested(): return
cx, cy, cw, ch = client.area() cx, cy, cw, ch = client.area()
sx, sy, sw, sh = ob.Openbox.screenArea(client.desktop()) sx, sy, sw, sh = ob.Openbox.screenArea(client.desktop())
global _rand xr = sw - cw - 1 # x range
if sw - cw - 1 <= 0: x = 0 yr = sh - ch - 1 # y range
else: x = Random().randrange(sx, sw - cw - 1) if xr <= 0: x = 0
if (sh - ch - 1 <= 0: y = 0 else: x = Random().randrange(sx, xr)
else: y = Random().randrange(sy, sh - ch - 1) if yr <= 0: y = 0
else: y = Random().randrange(sy, yr)
client.setArea((x, y, cw, ch)) client.setArea((x, y, cw, ch))
def cascade(client): def cascade(client):