summaryrefslogtreecommitdiff
path: root/sys/src/libdraw
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-10-22 00:04:21 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2016-10-22 00:04:21 +0200
commit6d97f77c2d95abcdf13593e8530c1f9f7ae1cd87 (patch)
tree6483c64b52ced640ed16b4e3d32d5e354f5a3c6b /sys/src/libdraw
parente5dc3ade08ce91785ff889341941460ce72ba03f (diff)
libdraw: avoid dropping queued button change mouse events in emouse()
Diffstat (limited to 'sys/src/libdraw')
-rw-r--r--sys/src/libdraw/event.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/src/libdraw/event.c b/sys/src/libdraw/event.c
index f8dde5692..5bc9386df 100644
--- a/sys/src/libdraw/event.c
+++ b/sys/src/libdraw/event.c
@@ -380,21 +380,22 @@ emouse(void)
{
Mouse m;
Ebuf *eb;
- static but[2];
+ static int lastb;
int b;
if(Smouse < 0)
drawerror(display, "events: mouse not initialized");
for(;;){
eb = ebread(&eslave[Smouse]);
- if(!ecanmouse())
+ b = atoi((char*)eb->buf+1+2*12);
+ if(b != lastb || !ecanmouse())
break;
free(eb); /* drop queued mouse events */
}
+ lastb = b;
+ m.buttons = b;
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);
- m.buttons = b;
m.msec = atoi((char*)eb->buf+1+3*12);
if (logfid)
fprint(logfid, "b: %d xy: %P\n", m.buttons, m.xy);