diff options
| author | Charles.Forsyth <devnull@localhost> | 2007-07-14 10:41:18 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2007-07-14 10:41:18 +0000 |
| commit | a6011949be081a8fe1bec0713ce60c36beb3a351 (patch) | |
| tree | 0855fa75f38a7361a9b7a9fe12608bd99761add0 /appl/wm | |
| parent | d42218ac2785e9e4bea53ec499f563cab5747959 (diff) | |
20070714-1142
Diffstat (limited to 'appl/wm')
| -rw-r--r-- | appl/wm/wm.b | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/appl/wm/wm.b b/appl/wm/wm.b index d8232b0b..d2dee3f8 100644 --- a/appl/wm/wm.b +++ b/appl/wm/wm.b @@ -402,9 +402,20 @@ dragwin(ptr: chan of ref Pointer, c: ref Client, w: ref Window, off: Point): str if(buttons == 0) return "too late"; p: ref Pointer; + scr := screen.image.r; + Margin: con 10; do{ p = <-ptr; - w.img.origin(w.img.r.min, p.xy.sub(off)); + org := p.xy.sub(off); + if(org.y < scr.min.y) + org.y = scr.min.y; + else if(org.y > scr.max.y - Margin) + org.y = scr.max.y - Margin; + if(org.x < scr.min.x && org.x + w.r.dx() < scr.min.x + Margin) + org.x = scr.min.x + Margin - w.r.dx(); + else if(org.x > scr.max.x - Margin) + org.x = scr.max.x - Margin; + w.img.origin(w.img.r.min, org); } while (p.buttons != 0); c.ptr <-= p; buttons = 0; |
