[PATCH 02/42] dix: add an update argument to positionSprite
Jamey Sharp
jamey at minilop.net
Wed Dec 14 21:19:18 PST 2011
This patch obviously doesn't change any behavior, but wouldn't it be
more clear to just factor out the beginning of positionSprite to a
computeSpritePosition or something?
I suppose there's a later patch that justifies this approach, but I
can't help thinking that returning early by adding another argument to
a 7-argument function with 5 out-parameters, a return value, and side
effects, is going to mean pain maintaining invariants.
Jamey
On 12/14/11, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> For future touch points, we need positionSprite to calculate the coordinates
> but we don't want to actually change the cursor position for non-emulating
> touches.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> dix/getevents.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/dix/getevents.c b/dix/getevents.c
> index 57d8c17..3b7b626 100644
> --- a/dix/getevents.c
> +++ b/dix/getevents.c
> @@ -808,7 +808,7 @@ scale_from_screen(DeviceIntPtr dev, ValuatorMask *mask)
> * @param[out] screeny y coordinate in desktop coordinate system
> */
> static ScreenPtr
> -positionSprite(DeviceIntPtr dev, int mode, ValuatorMask *mask,
> +positionSprite(DeviceIntPtr dev, Bool update, int mode, ValuatorMask *mask,
> double *devx, double *devy,
> double *screenx, double *screeny)
> {
> @@ -839,6 +839,9 @@ positionSprite(DeviceIntPtr dev, int mode, ValuatorMask
> *mask,
> *devx = x;
> *devy = y;
>
> + if (!update)
> + return scr;
> +
> /* miPointerSetPosition takes care of crossing screens for us, as well
> as
> * clipping to the current screen. Coordinates returned are in desktop
> * coord system */
> @@ -1251,7 +1254,7 @@ fill_pointer_events(InternalEvent *events,
> DeviceIntPtr pDev, int type,
> if ((flags & POINTER_NORAW) == 0)
> set_raw_valuators(raw, &mask, raw->valuators.data);
>
> - scr = positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute :
> Relative,
> + scr = positionSprite(pDev, TRUE, (flags & POINTER_ABSOLUTE) ? Absolute
> : Relative,
> &mask, &devx, &devy, &screenx, &screeny);
>
> /* screenx, screeny are in desktop coordinates,
> --
> 1.7.7.1
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>
More information about the xorg-devel
mailing list