git: 9front

Download patch

ref: 441564a863b57d0b1ee9c6d3679a74fc4e8a79b1
parent: b35400779c8f3e4b082d88bf2d78a61b118447b8
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Sun Aug 11 20:08:51 EDT 2013

games/juggle, games/catclock: keep up with queued mouse events

many queued mouse events delay eresize() because
new ebread() takes from the queue first before attempting
to read from the event pipe. this is a waste of memory, so
just process (dequeue) all the events as long as there are
any on each iteration.

--- a/sys/src/games/catclock.c
+++ b/sys/src/games/catclock.c
@@ -118,7 +118,7 @@
 		eye[i]=draweye(i*PI/NTAIL);
 	}
 	for(;;){
-		if(ecanmouse()) emouse();	/* don't get resize events without this! */
+		while(ecanmouse()) emouse();	/* don't get resize events without this! */
 		drawclock();
 		flushimage(display, 1);
 //		bflush();
--- a/sys/src/games/juggle.c
+++ b/sys/src/games/juggle.c
@@ -76,7 +76,7 @@
 void move(int t){
 	int i, j;
 	for(i=0;i!=NSTEP;i++){
-		if(ecanmouse()) emouse();
+		while(ecanmouse()) emouse();
 		draw(image, inset(image->r, 3), display->white, nil, ZP);
 		for(j=0;j!=nball;j++)
 			fillellipse(image, bpos(j, i, t), RBALL, RBALL, disk[j%ndisk], ZP);
--