diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2013-01-26 15:53:08 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2013-02-08 13:49:49 +1000 |
commit | 8571c648a79444bcee9a0fe6e395129116372f49 (patch) | |
tree | 143843a256d3ccda8f461749de9a089dcebaf5ee /dix | |
parent | 9fd6cb89539fde44a41ae5183c89ef9c8831c8dd (diff) |
Xext: if a root window is given in XTestFakeInput, move to that
For absolute events, if the client specifies a screen number offset the
coordinates by that. And add a new flag so we know when _not_ to add the
screen offset in GPE.
Without this offset and the flag, GPE would simply add the offset of the
current screen if POINTER_SCREEN is set.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/getevents.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index 8fe54d713..02f5366aa 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -820,24 +820,30 @@ accelPointer(DeviceIntPtr dev, ValuatorMask *valuators, CARD32 ms) * device's coordinate range. * * @param dev The device to scale for. - * @param[in, out] mask The mask in desktop coordinates, modified in place + * @param[in, out] mask The mask in desktop/screen coordinates, modified in place * to contain device coordinate range. + * @param flags If POINTER_SCREEN is set, mask is in per-screen coordinates. + * Otherwise, mask is in desktop coords. */ static void -scale_from_screen(DeviceIntPtr dev, ValuatorMask *mask) +scale_from_screen(DeviceIntPtr dev, ValuatorMask *mask, int flags) { double scaled; ScreenPtr scr = miPointerGetScreen(dev); if (valuator_mask_isset(mask, 0)) { - scaled = valuator_mask_get_double(mask, 0) + scr->x; + scaled = valuator_mask_get_double(mask, 0); + if (flags & POINTER_SCREEN) + scaled += scr->x; scaled = rescaleValuatorAxis(scaled, NULL, dev->valuator->axes + 0, screenInfo.x, screenInfo.width); valuator_mask_set_double(mask, 0, scaled); } if (valuator_mask_isset(mask, 1)) { - scaled = valuator_mask_get_double(mask, 1) + scr->y; + scaled = valuator_mask_get_double(mask, 1); + if (flags & POINTER_SCREEN) + scaled += scr->y; scaled = rescaleValuatorAxis(scaled, NULL, dev->valuator->axes + 1, screenInfo.y, screenInfo.height); @@ -1363,10 +1369,10 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, /* valuators are in driver-native format (rel or abs) */ if (flags & POINTER_ABSOLUTE) { - if (flags & POINTER_SCREEN) { /* valuators are in screen coords */ + if (flags & (POINTER_SCREEN | POINTER_DESKTOP)) { /* valuators are in screen/desktop coords */ sx = valuator_mask_get(&mask, 0); sy = valuator_mask_get(&mask, 1); - scale_from_screen(pDev, &mask); + scale_from_screen(pDev, &mask, flags); } transformAbsolute(pDev, &mask); |