diff options
author | Thomas Jaeger <ThJaeger@gmail.com> | 2009-06-20 20:17:04 -0400 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-06-24 09:00:41 +1000 |
commit | 5cbd4d3d6e54d202ecdbb527b57aaefeb8435600 (patch) | |
tree | 21bd4937f274452abbba665f199258a2d578777f /dix | |
parent | 94cdc1ef0a72802573a11ba292e2f5cc8474aa8e (diff) |
dix: do away with an instance of temporary in-place modification
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/getevents.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index b71e98078..9a68bf0fe 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -753,6 +753,8 @@ static void positionSprite(DeviceIntPtr dev, int *x, int *y, ScreenPtr scr, int *screenx, int *screeny) { + int old_screenx, old_screeny; + /* scale x&y to screen */ if (dev->valuator->numAxes > 0) *screenx = rescaleValuatorAxis(*x, dev->valuator->axes + 0, NULL, scr->width); @@ -764,12 +766,11 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, else *screeny = dev->last.valuators[1]; - dev->last.valuators[0] = *screenx; - dev->last.valuators[1] = *screeny; - + old_screenx = *screenx; + old_screeny = *screeny; /* This takes care of crossing screens for us, as well as clipping * to the current screen. */ - miPointerSetPosition(dev, &dev->last.valuators[0], &dev->last.valuators[1]); + miPointerSetPosition(dev, screenx, screeny); if (dev->u.master) { 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 */ - if(*screenx != dev->last.valuators[0]) + if(*screenx != old_screenx) { scr = miPointerGetScreen(dev); - *x = rescaleValuatorAxis(dev->last.valuators[0], NULL, + *x = rescaleValuatorAxis(*screenx, NULL, dev->valuator->axes + 0, scr->width); - *screenx = dev->last.valuators[0]; } - if(*screeny != dev->last.valuators[1]) + if(*screeny != old_screeny) { scr = miPointerGetScreen(dev); - *screeny = dev->last.valuators[1]; - *y = rescaleValuatorAxis(dev->last.valuators[1], NULL, + *y = rescaleValuatorAxis(*screeny, NULL, dev->valuator->axes + 1, scr->height); } |