summaryrefslogtreecommitdiff
path: root/sys/src/cmd
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-11-25 04:30:44 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2015-11-25 04:30:44 +0100
commit9ef4ba83f62761b517db23a16e2f61e5861aae23 (patch)
tree1d410acc61ee75b0973051403a75e4748e1b2311 /sys/src/cmd
parente82b10ffb480c85a80af21d016f3f8a30db08156 (diff)
rio: fix handling "resize" wctl for hidden windows
when the "resize" wctl was used on a hidden window, the window was put back on the screen, however, it was not removed from the hidden[] array so trying to hide the window again failed because whide() assumed it was already hidden. the fix is to not unhide the window, but preserve the hidden state, so windows can programmatically be reshaped and moved, but will remain hidden unless explicitely unhidden.
Diffstat (limited to 'sys/src/cmd')
-rw-r--r--sys/src/cmd/rio/wctl.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/sys/src/cmd/rio/wctl.c b/sys/src/cmd/rio/wctl.c
index a19c5a4e8..cb5acb64a 100644
--- a/sys/src/cmd/rio/wctl.c
+++ b/sys/src/cmd/rio/wctl.c
@@ -360,22 +360,29 @@ 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;
}
- if(w != input){
- strcpy(err, "window not current");
- return -1;
+ if(Dx(w->screenr) > 0){
+ if(eqrect(r, w->screenr))
+ return 1;
+ if(w != input){
+ strcpy(err, "window not current");
+ return -1;
+ }
+ i = allocwindow(wscreen, r, Refbackup, DNofill);
+ } else { /* hidden */
+ if(eqrect(r, w->i->r))
+ return 1;
+ i = allocimage(display, r, w->i->chan, 0, DNofill);
+ r = ZR;
}
- i = allocwindow(wscreen, r, Refbackup, DNofill);
if(i == nil){
strcpy(err, Ewalloc);
return -1;
}
- wsendctlmesg(w, Reshaped, i->r, i);
+ wsendctlmesg(w, Reshaped, r, i);
return 1;
case Scroll:
w->scrolling = 1;
@@ -393,6 +400,10 @@ wctlcmd(Window *w, Rectangle r, int cmd, char *err)
wbottomme(w);
return 1;
case Current:
+ if(Dx(w->screenr)<=0){
+ strcpy(err, "window is hidden");
+ return -1;
+ }
wtopme(w);
wcurrent(w);
return 1;