libdraw: don't flush in readmouse() when theres nothing to flush

This commit is contained in:
cinap_lenrek 2016-03-13 00:03:42 +01:00
parent 2dddca9847
commit 7b8fcd1269

View file

@ -26,8 +26,11 @@ closemouse(Mousectl *mc)
int
readmouse(Mousectl *mc)
{
if(mc->image)
flushimage(mc->image->display, 1);
if(mc->image){
Display *d = mc->image->display;
if(d->bufp > d->buf)
flushimage(d, 1);
}
if(recv(mc->c, &mc->Mouse) < 0){
fprint(2, "readmouse: %r\n");
return -1;