dix: do away with an instance of temporary in-place modification

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Thomas Jaeger 2009-06-20 20:17:04 -04:00 committed by Peter Hutterer
parent 94cdc1ef0a
commit 5cbd4d3d6e

View File

@ -753,6 +753,8 @@ static void
positionSprite(DeviceIntPtr dev, int *x, int *y, positionSprite(DeviceIntPtr dev, int *x, int *y,
ScreenPtr scr, int *screenx, int *screeny) ScreenPtr scr, int *screenx, int *screeny)
{ {
int old_screenx, old_screeny;
/* scale x&y to screen */ /* scale x&y to screen */
if (dev->valuator->numAxes > 0) if (dev->valuator->numAxes > 0)
*screenx = rescaleValuatorAxis(*x, dev->valuator->axes + 0, NULL, scr->width); *screenx = rescaleValuatorAxis(*x, dev->valuator->axes + 0, NULL, scr->width);
@ -764,12 +766,11 @@ positionSprite(DeviceIntPtr dev, int *x, int *y,
else else
*screeny = dev->last.valuators[1]; *screeny = dev->last.valuators[1];
dev->last.valuators[0] = *screenx; old_screenx = *screenx;
dev->last.valuators[1] = *screeny; old_screeny = *screeny;
/* This takes care of crossing screens for us, as well as clipping /* This takes care of crossing screens for us, as well as clipping
* to the current screen. */ * to the current screen. */
miPointerSetPosition(dev, &dev->last.valuators[0], &dev->last.valuators[1]); miPointerSetPosition(dev, screenx, screeny);
if (dev->u.master) { if (dev->u.master) {
dev->u.master->last.valuators[0] = dev->last.valuators[0]; dev->u.master->last.valuators[0] = dev->last.valuators[0];
@ -777,18 +778,16 @@ positionSprite(DeviceIntPtr dev, int *x, int *y,
} }
/* Crossed screen? Scale back to device coordiantes */ /* Crossed screen? Scale back to device coordiantes */
if(*screenx != dev->last.valuators[0]) if(*screenx != old_screenx)
{ {
scr = miPointerGetScreen(dev); scr = miPointerGetScreen(dev);
*x = rescaleValuatorAxis(dev->last.valuators[0], NULL, *x = rescaleValuatorAxis(*screenx, NULL,
dev->valuator->axes + 0, scr->width); dev->valuator->axes + 0, scr->width);
*screenx = dev->last.valuators[0];
} }
if(*screeny != dev->last.valuators[1]) if(*screeny != old_screeny)
{ {
scr = miPointerGetScreen(dev); scr = miPointerGetScreen(dev);
*screeny = dev->last.valuators[1]; *y = rescaleValuatorAxis(*screeny, NULL,
*y = rescaleValuatorAxis(dev->last.valuators[1], NULL,
dev->valuator->axes + 1, scr->height); dev->valuator->axes + 1, scr->height);
} }