Every time number is hardcoded deep inside the driver, god kills a kitten and a little part of me dies (unrelated to the kitten death). Use the defines already.
Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> --- src/wcmFilter.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/wcmFilter.c b/src/wcmFilter.c index ba50877..e6f7402 100644 --- a/src/wcmFilter.c +++ b/src/wcmFilter.c @@ -348,15 +348,16 @@ void wcmTilt2R(WacomDeviceStatePtr ds) * rotation and vice versa */ rotation = ((180.0 * atan2(-tilt_x,tilt_y)) / M_PI) + 180.0; - /* Intuos4 mouse has an (180-5) offset */ - ds->rotation = round((360.0 - rotation + 180.0 - 5.0) * 5.0); - ds->rotation %= 1800; + /* Intuos4 mouse has an (180-5) offset, + * normalize into the rotation range. */ + ds->rotation = round((360.0 - rotation + 180.0 - 5.0) * (MAX_ROTATION_RANGE / 360.0)); + ds->rotation %= MAX_ROTATION_RANGE; /* ds->rotation now normalised into 0 - MAX, but we want MIN - MAX * with 180 degrees (ignoring offset) being at 0 (for whatever * reason we need this) */ - if (ds->rotation >= 900) - ds->rotation = 1800 - ds->rotation; + if (ds->rotation >= (MIN_ROTATION + MAX_ROTATION_RANGE)) + ds->rotation = MAX_ROTATION_RANGE - ds->rotation; /* wrap around */ else ds->rotation = -ds->rotation; -- 1.7.4 ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel