ref: 8556b8dae158c631725184a9243c3493af15c8b6
parent: 34cd9dc4c462ab01ce063a58a40f1317fcb13172
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Tue Sep 17 21:54:22 EDT 2013
libevent: drop queued mouse events the changeset r541ead66e8af: "libdraw: make ebread() return buffer immidiately if available" makes mouse sluggish when the program cant keep up as mouse events queue up. this more or less restores the original behaviour but only for mouse events.
--- a/sys/src/libdraw/event.c
+++ b/sys/src/libdraw/event.c
@@ -385,7 +385,12 @@
if(Smouse < 0)
drawerror(display, "events: mouse not initialized");
- eb = ebread(&eslave[Smouse]);
+ for(;;){+ eb = ebread(&eslave[Smouse]);
+ if(!ecanmouse())
+ break;
+ free(eb); /* drop queued mouse events */
+ }
m.xy.x = atoi((char*)eb->buf+1+0*12);
m.xy.y = atoi((char*)eb->buf+1+1*12);
b = atoi((char*)eb->buf+1+2*12);
--
⑨