summaryrefslogtreecommitdiff
path: root/sys/src/cmd/mothra/mothra.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-07-20 14:32:50 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-07-20 14:32:50 +0200
commit98d5687ce47dc3cb014d5c3cb951e05dfe9e9da5 (patch)
tree60426055aa98f7570e2d3c5a856f53df7a83a849 /sys/src/cmd/mothra/mothra.c
parent3707561e047f8e7c9993e0ba5a3a3fb5b5f6a6fd (diff)
mothra: delayed screen updates to reduce flicker
Diffstat (limited to 'sys/src/cmd/mothra/mothra.c')
-rw-r--r--sys/src/cmd/mothra/mothra.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/sys/src/cmd/mothra/mothra.c b/sys/src/cmd/mothra/mothra.c
index 9e16af66c..44ca1db15 100644
--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -241,7 +241,7 @@ extern char *mtpt; /* url */
void main(int argc, char *argv[]){
Event e;
- enum { Eplumb = 128 };
+ enum { Eplumb = 128, Ekick = 256 };
Plumbmsg *pm;
Www *new;
Action *a;
@@ -298,7 +298,7 @@ void main(int argc, char *argv[]){
eplumb(Eplumb, "web");
if(pipe(kickpipe) < 0)
sysfatal("pipe: %r");
- estart(0, kickpipe[0], 256);
+ estart(Ekick, kickpipe[0], 256);
plinit(screen->depth);
if(debug) notify(dienow);
getfonts();
@@ -333,10 +333,6 @@ void main(int argc, char *argv[]){
message(mothra);
donecurs();
}
- else if(current->changed){
- updtext(current);
- current->changed=0;
- }
}
flushimage(display, 1);
@@ -345,6 +341,13 @@ void main(int argc, char *argv[]){
lockdisplay(display);
switch(i){
+ case Ekick:
+ if(mouse.buttons==0 && current && current->changed){
+ if(!current->finished)
+ updtext(current);
+ current->changed=0;
+ }
+ break;
case Ekeyboard:
switch(e.kbdc){
default:
@@ -906,6 +909,16 @@ void geturl(char *urlname, int post, int plumb, int map){
w->finished = 0;
w->alldone = 0;
gettext(w, fd, typ);
+ if(rfork(RFPROC|RFMEM|RFNOWAIT) == 0){
+ for(;;){
+ sleep(1000);
+ if(w->finished || w->alldone)
+ break;
+ if(w->changed)
+ write(kickpipe[1], "C", 1);
+ }
+ _exits(0);
+ }
plinitlist(list, PACKN|FILLX, genwww, 8, doprev);
if(defdisplay) pldraw(list, screen);
setcurrent(i, selection->tag);
@@ -940,10 +953,7 @@ void updtext(Www *w){
plsetpostextview(text, w->yoffs);
pldraw(root, screen);
}
-void update(Www *w){
- w->changed = 1;
- write(kickpipe[1], "C", 1);
-}
+
void finish(Www *w){
w->finished = 1;
write(kickpipe[1], "F", 1);