diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-04-21 14:55:22 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-04-21 16:05:16 +1000 |
commit | 6f97fe5df16f947e52875187ff4f9e25fab33ad7 (patch) | |
tree | 48aaca5bcc292f5f4270898dbcbe76dcc71ab159 /dix | |
parent | a0eda8cd36ffba2ecc79e0d7a1908c89b45e76c4 (diff) |
dix: improve control flow in QueryTrackers
If the velocity is 0, skip the remainder.
If we're not in range, skip the remainder.
No functional change.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/ptrveloc.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c index f4548b6e9..dfccf1581 100644 --- a/dix/ptrveloc.c +++ b/dix/ptrveloc.c @@ -634,20 +634,20 @@ QueryTrackers(DeviceVelocityPtr vel, int cur_t){ used_offset = offset; } else if (initial_velocity != 0 && tracker_velocity != 0) { velocity_diff = fabs(initial_velocity - tracker_velocity); - if (velocity_diff <= vel->max_diff || - velocity_diff/(initial_velocity + tracker_velocity) < vel->max_rel_diff) { - /* we're in range with the initial velocity, - * so this result is likely better - * (it contains more information). */ - result = tracker_velocity; - used_offset = offset; - }else{ + + if (velocity_diff > vel->max_diff && + velocity_diff/(initial_velocity + tracker_velocity) >= vel->max_rel_diff) { /* we're not in range, quit - it won't get better. */ DebugAccelF("(dix prtacc) query: tracker too different:" " old %2.2f initial %2.2f diff: %2.2f\n", tracker_velocity, initial_velocity, velocity_diff); break; } + /* we're in range with the initial velocity, + * so this result is likely better + * (it contains more information). */ + result = tracker_velocity; + used_offset = offset; } } if(offset == vel->num_tracker){ |