mirror of
https://github.com/X11Libre/xf86-input-synaptics.git
synced 2026-04-14 11:54:16 +00:00
Ensure delta computation does not go crazy
I have seen this a couple times, but I haven't been able to catch it when it starts. It's a feedback loop, so once you miss the entrance of the loop, you can't see what really went wrong. This patch papers over the issue for now. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Peter Hutterer
parent
782c7fb6fe
commit
dfdcf8b343
@@ -1974,6 +1974,14 @@ get_delta(SynapticsPrivate *priv, const struct SynapticsHwState *hw,
|
||||
|
||||
/* report edge speed as synthetic motion. Of course, it would be
|
||||
* cooler to report floats than to buffer, but anyway. */
|
||||
|
||||
/* FIXME: When these values go NaN, bad things happen. Root cause is unknown
|
||||
* thus far though. */
|
||||
if (isnan(priv->frac_x))
|
||||
priv->frac_x = 0;
|
||||
if (isnan(priv->frac_y))
|
||||
priv->frac_y = 0;
|
||||
|
||||
tmpf = *dx + x_edge_speed * dtime + priv->frac_x;
|
||||
priv->frac_x = modf(tmpf, &integral);
|
||||
*dx = integral;
|
||||
|
||||
Reference in New Issue
Block a user