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.
This commit is contained in:
parent
34cd9dc4c4
commit
8556b8dae1
1 changed files with 6 additions and 1 deletions
|
@ -385,7 +385,12 @@ emouse(void)
|
|||
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue