[client] mouse: don't smooth large cursor jumps (ie, warp to align)

This commit is contained in:
Geoffrey McRae 2021-01-17 03:11:41 +11:00
parent fe835b98d5
commit 2a69a19dbd

View File

@ -895,8 +895,18 @@ static void cursorToInt(double ex, double ey, int *x, int *y)
if (params.mouseSmoothing && !(g_cursor.grab && params.rawMouse))
{
static struct DoublePoint last = { 0 };
ex = last.x = (last.x + ex) / 2.0;
ey = last.y = (last.y + ey) / 2.0;
/* only apply smoothing to small deltas */
if (fabs(ex - last.x) < 5.0 && fabs(ey - last.y) < 5.0)
{
ex = last.x = (last.x + ex) / 2.0;
ey = last.y = (last.y + ey) / 2.0;
}
else
{
last.x = ex;
last.y = ey;
}
}
/* convert to int accumulating the fractional error */