summaryrefslogtreecommitdiff
path: root/sys/src
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-03-23 15:51:15 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2012-03-23 15:51:15 +0100
commit7e90b115973ce1fe05627c127227405fd8854a82 (patch)
tree13fdd122019ec46c707bb3aae4897457ff7c54b9 /sys/src
parent4662b107ffa134f488dd6a4b8df6c031a2a3f418 (diff)
mothra: k - kill images in current page
Diffstat (limited to 'sys/src')
-rw-r--r--sys/src/cmd/mothra/mothra.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/sys/src/cmd/mothra/mothra.c b/sys/src/cmd/mothra/mothra.c
index 1d26bf4df..722feaefe 100644
--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -88,6 +88,7 @@ void updtext(Www *);
void dolink(Panel *, int, Rtext *);
void hit3(int, int);
void mothon(Www *, int);
+void killpix(Www *w);
char *buttons[]={
"alt display",
"moth mode",
@@ -645,6 +646,9 @@ void docmd(Panel *p, char *s){
case 'm':
mothon(current, !mothmode);
break;
+ case 'k':
+ killpix(current);
+ break;
case 'w':
case 'W':
s = arg(s);
@@ -934,7 +938,6 @@ void freeurl(Url *u){
void geturl(char *urlname, int method, char *body, int plumb, int map){
int i, fd, typ, pfd[2];
char cmd[NNAME];
- Rtext *t;
ulong n;
Www *w;
@@ -988,15 +991,8 @@ void geturl(char *urlname, int method, char *body, int plumb, int map){
for(i=wwwtop-1; i>=0 && i!=(wwwtop-NWWW-1); i--){
w = www(i);
n += countpix(w->pix);
- if(n < NPIXMB*1024*1024)
- continue;
- if(!w->finished && !w->alldone)
- continue;
- for(t=w->text; t; t=t->next)
- if(t->b && t->user)
- t->b=0;
- freepix(w->pix);
- w->pix=0;
+ if(n >= NPIXMB*1024*1024)
+ killpix(w);
}
w = www(i = wwwtop++);
if(i >= NWWW){
@@ -1046,6 +1042,8 @@ void updtext(Www *w){
a->field=0;
}
}
+ if(w != current)
+ return;
w->yoffs=plgetpostextview(text);
plinittextview(text, PACKE|EXPAND, Pt(0, 0), w->text, dolink);
plsetpostextview(text, w->yoffs);
@@ -1066,7 +1064,7 @@ mothon(Www *w, int on)
Rtext *t, *x;
Action *a, *ap;
- if(current == nil || mothmode == on)
+ if(w==0 || mothmode==on)
return;
if(mothmode = on)
message("moth mode!");
@@ -1097,6 +1095,19 @@ mothon(Www *w, int on)
donecurs();
}
+void killpix(Www *w){
+ Rtext *t;
+
+ if(w==0 || !w->finished && !w->alldone)
+ return;
+ for(t=w->text; t; t=t->next)
+ if(t->b && t->user)
+ t->b=0;
+ freepix(w->pix);
+ w->pix=0;
+ updtext(w);
+}
+
void snarf(Panel *p){
int fd;
if((fd=open("/dev/snarf", OWRITE|OTRUNC))>=0){