Optimize check in timer callback a bit.

It won't help much because there are not that many eyes, but then
it also won't hurt, so stop checking when we know the pointer has
not been moved.
This commit is contained in:
Harald Judt 2013-03-03 09:55:26 +01:00
parent 88c2ec8222
commit 9463e7a941

View file

@ -162,13 +162,18 @@ timer_cb(EyesPlugin *eyes)
if ((x != eyes->pointer_last_x[i]) || (y != eyes->pointer_last_y[i]))
{
calculate_pupil_xy (eyes, x, y, &pupil_x, &pupil_y, eyes->eyes[i]);
draw_eye (eyes, i, pupil_x, pupil_y);
eyes->pointer_last_x[i] = x;
eyes->pointer_last_y[i] = y;
}
else
{
/* pointer position did not change since last poll, so
why would it be different for the remaining eyes? */
break;
}
}
}