[PULL] hw/xwin fixes + a warning fix

Daniel Stone daniel at fooishbar.org
Thu Jan 26 15:47:51 PST 2012


Hi,

On 27 January 2012 10:22, Colin Harrison <colin.harrison at virgin.net> wrote:
> If I revert those traps and then call the function...
>
> void winEnqueueMotion(int x, int y)
> {
>  int valuators[2];
>  ValuatorMask mask;
>  double dx = (double)x;
>  double dy = (double)y;
>
>  miPointerSetPosition(g_pwinPointer, POINTER_RELATIVE, &dx, &dy);
>  x = trunc(dx);
>  y = trunc(dy);
>  valuators[0] = x;
>  valuators[1] = y;
>
>  valuator_mask_set_range(&mask, 0, 2, valuators);
>  QueuePointerEvents(g_pwinPointer, MotionNotify, 0,
>                     POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
>
> }
>
> I now get no problem...I could however do better by just using doubles for x
> and y in the hw/xwin function headers and get rid of those hacky casts and
> trunc()'s. Will now test that + use of POINTER_RELATIVE looks dodgy!

Why are you actually calling miPointerSetPosition at all?
QueuePointerEvents (-> GetPointerEvents -> positionSprite, both in
dix/getevents.c) already do that for you.  You can also avoid the need
for the valuators[] array by just calling valuator_mask_set(&mask, 0,
x); valuator_mask_set(&mask, 1, y); at which point your function gets
very short indeed.

Cheers,
Daniel


More information about the xorg-devel mailing list