diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-10-04 02:17:53 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-10-04 02:17:53 +0200 |
commit | fe03ec0e21bf2491b7746e81053e91636eb1aa9c (patch) | |
tree | cdcd604ef0436af5c3ab9d126aca6d669076fff7 /sys/src/cmd/rio/wctl.c | |
parent | 60e3d2782b30019769bd250c15329108fab1cc5a (diff) |
rio: gone windows, window resize, rectonscreen, goodrect
dont rely on postnote to shutdown client. instead, make reads on
cons, kbd and mouse error. when we mount a window system over
exportfs, the pid useless and even dangerous! pid should be
only used by clients forked by rio itself.
fix bug in resized(), goodrect() takes rect in screen coordinates!
make rectonscreen() fix window size if the window doesnt fit
on the screen.
improve goodrect() to check for windows outside of the screen or
bigger than screen without borders visible.
Diffstat (limited to 'sys/src/cmd/rio/wctl.c')
-rw-r--r-- | sys/src/cmd/rio/wctl.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/src/cmd/rio/wctl.c b/sys/src/cmd/rio/wctl.c index 9d1cf796e..a19c5a4e8 100644 --- a/sys/src/cmd/rio/wctl.c +++ b/sys/src/cmd/rio/wctl.c @@ -90,16 +90,19 @@ goodrect(Rectangle r) { if(!eqrect(canonrect(r), r)) return 0; - if(Dx(r)<100 || Dy(r)<3*font->height) - return 0; - /* must have some screen and border visible so we can move it out of the way */ - if(Dx(r) >= Dx(screen->r) && Dy(r) >= Dy(screen->r)) - return 0; /* reasonable sizes only please */ if(Dx(r) > BIG*Dx(screen->r)) return 0; if(Dy(r) > BIG*Dx(screen->r)) return 0; + if(Dx(r) < 100 || Dy(r) < 3*font->height) + return 0; + /* window must be on screen */ + if(!rectXrect(screen->r, r)) + return 0; + /* must have some screen and border visible so we can move it out of the way */ + if(rectinrect(screen->r, insetrect(r, Borderwidth))) + return 0; return 1; } @@ -159,6 +162,8 @@ shift(int *minp, int *maxp, int min, int max) } if(*minp < min){ *maxp += min-*minp; + if(*maxp > max) + *maxp = max; *minp = min; } } @@ -355,6 +360,8 @@ wctlcmd(Window *w, Rectangle r, int cmd, char *err) r = rectonscreen(r); /* fall through */ case Resize: + if(eqrect(r, w->screenr)) + return 1; if(!goodrect(r)){ strcpy(err, Ebadwr); return -1; @@ -363,8 +370,6 @@ wctlcmd(Window *w, Rectangle r, int cmd, char *err) strcpy(err, "window not current"); return -1; } - if(eqrect(r, w->screenr)) - return 1; i = allocwindow(wscreen, r, Refbackup, DNofill); if(i == nil){ strcpy(err, Ewalloc); |