Input: Don't call positionSprite for non-pointer devices
If the device doesn't have any valuators, or if it has less than two of them, don't bother calling positionSprite. Users with one-dimensional pointing devices may be upset. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
4c364a312d
commit
51437995a5
|
@ -792,28 +792,19 @@ positionSprite(DeviceIntPtr dev, int mode,
|
||||||
int old_screenx, old_screeny;
|
int old_screenx, old_screeny;
|
||||||
double val, ret;
|
double val, ret;
|
||||||
|
|
||||||
/* scale x&y to screen */
|
if (!dev->valuator || dev->valuator->numAxes < 2)
|
||||||
if (dev->valuator && dev->valuator->numAxes > 0) {
|
return;
|
||||||
val = *x + x_frac;
|
|
||||||
ret = rescaleValuatorAxis(val, dev->valuator->axes + 0, NULL,
|
|
||||||
scr->width);
|
|
||||||
*screenx = trunc(ret);
|
|
||||||
*screenx_frac = ret - trunc(ret);
|
|
||||||
} else {
|
|
||||||
*screenx = dev->last.valuators[0];
|
|
||||||
*screenx_frac = dev->last.remainder[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dev->valuator && dev->valuator->numAxes > 1) {
|
/* scale x&y to screen */
|
||||||
val = *y + y_frac;
|
val = *x + x_frac;
|
||||||
ret = rescaleValuatorAxis(val, dev->valuator->axes + 1, NULL,
|
ret = rescaleValuatorAxis(val, dev->valuator->axes + 0, NULL, scr->width);
|
||||||
scr->height);
|
*screenx = trunc(ret);
|
||||||
*screeny = trunc(ret);
|
*screenx_frac = ret - trunc(ret);
|
||||||
*screeny_frac = ret - trunc(ret);
|
|
||||||
} else {
|
val = *y + y_frac;
|
||||||
*screeny = dev->last.valuators[1];
|
ret = rescaleValuatorAxis(val, dev->valuator->axes + 1, NULL, scr->height);
|
||||||
*screeny_frac = dev->last.remainder[1];
|
*screeny = trunc(ret);
|
||||||
}
|
*screeny_frac = ret - trunc(ret);
|
||||||
|
|
||||||
/* Hit the left screen edge? */
|
/* Hit the left screen edge? */
|
||||||
if (*screenx <= 0 && *screenx_frac < 0.0f)
|
if (*screenx <= 0 && *screenx_frac < 0.0f)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user