shithub: riscv

Download patch

ref: e5dc3ade08ce91785ff889341941460ce72ba03f
parent: 3145ca7d786344f1ec91aeb48a3c7d1ad7e57e5e
author: cinap_lenrek <[email protected]>
date: Fri Oct 21 20:02:23 EDT 2016

mothra: avoid flushimage() calls, event() will implicitely flush

--- a/sys/src/cmd/mothra/libpanel/draw.c
+++ b/sys/src/cmd/mothra/libpanel/draw.c
@@ -254,7 +254,6 @@
 }
 void pldraw(Panel *p, Image *b){
 	pl_draw1(p, b);
-	flushimage(display, 1);
 }
 void pl_invis(Panel *p, int v){
 	for(;p;p=p->next){
--- a/sys/src/cmd/mothra/libpanel/entry.c
+++ b/sys/src/cmd/mothra/libpanel/entry.c
@@ -73,6 +73,8 @@
 		while(m->buttons&1){
 			int old;
 			old=m->buttons;
+			if(display->bufp > display->buf)
+				flushimage(display, 1);
 			*m=emouse();
 			if((old&7)==1){
 				if((m->buttons&7)==3){
--- a/sys/src/cmd/mothra/libpanel/event.c
+++ b/sys/src/cmd/mothra/libpanel/event.c
@@ -9,10 +9,8 @@
 	plkbfocus=g;
 }
 void plkeyboard(Rune c){
-	if(plkbfocus){
+	if(plkbfocus)
 		plkbfocus->type(plkbfocus, c);
-		flushimage(display, 1);
-	}
 }
 
 /*
@@ -47,5 +45,4 @@
 			g->flags&=~REMOUSE;
 		g->lastmouse=hit;
 	}
-	flushimage(display, 1);
 }
--- a/sys/src/cmd/mothra/libpanel/popup.c
+++ b/sys/src/cmd/mothra/libpanel/popup.c
@@ -65,7 +65,6 @@
 			if(g->state!=DOWN){
 				if(pp->save!=0){
 					draw(g->b, p->r, pp->save, 0, p->r.min);
-					flushimage(display, 1);
 					freeimage(pp->save);
 					pp->save=0;
 				}
--- a/sys/src/cmd/mothra/libpanel/textwin.c
+++ b/sys/src/cmd/mothra/libpanel/textwin.c
@@ -224,7 +224,8 @@
 	p1=addpt(p0, Pt(1, 0));
 	twhilite(t, sel0, sel1, 1);
 	for(;;){
-		flushimage(display, 1);
+		if(display->bufp > display->buf)
+			flushimage(display, 1);
 		*m=emouse();
 		if((m->buttons&7)!=1) break;
 		newsel=twpt2rune(t, m->xy);
--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -381,7 +381,6 @@
 			}
 		}
 
-		flushimage(display, 1);
 		drawlock(0);
 		i=event(&e);
 		drawlock(1);
@@ -545,7 +544,6 @@
 		}
 	}
 	plsetpostextview(text, current->yoffs);
-	flushimage(display, 1);
 }
 
 /*