diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-01-12 15:29:36 +1000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-01-30 17:10:40 -0800 |
commit | 50d80c25525a691472e3fc5859fb303a3ffe1ef2 (patch) | |
tree | 2c7b1cbeab5aaca49dfcffbcbd82f91610a227e7 /dix | |
parent | b19f12712a0762f20065282fd055fe9bc3ca975f (diff) |
dix: fix WarpPointer calls for devices with custom valuator ranges (#19297)
If the MD's lastSlave was a devices with custom axes ranges, then a
WarpPointer would position the cursor at the wrong location. A WarpPointer
request provides screen coordinates and these coordinates were scaled to the
device range before warping.
This patch consists of two parts:
1) in the WarpPointer handling, get the lastSlave and post the event through
this device.
2) assume that WarpPointer coordinates are always in screen coordinates and
scale them to device coordinates in GPE before continuing. Note that this
breaks device-coordinate based XWarpDevicePointer calls (for which the spec
isn't nailed down yet anyway) until a better solution is found.
X.Org Bug 19297 <http://bugs.freedesktop.org/show_bug.cgi?id=19297>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit d36adf52a2b2711d22b11105f7bd907d4493fb9b)
Diffstat (limited to 'dix')
-rw-r--r-- | dix/events.c | 19 | ||||
-rw-r--r-- | dix/getevents.c | 14 |
2 files changed, 25 insertions, 8 deletions
diff --git a/dix/events.c b/dix/events.c index 498616f40..768a33ecb 100644 --- a/dix/events.c +++ b/dix/events.c @@ -3073,8 +3073,8 @@ ProcWarpPointer(ClientPtr client) WindowPtr dest = NULL; int x, y, rc; ScreenPtr newScreen; - DeviceIntPtr dev = PickPointer(client); - SpritePtr pSprite = dev->spriteInfo->sprite; + DeviceIntPtr dev; + SpritePtr pSprite; REQUEST(xWarpPointerReq); REQUEST_SIZE_MATCH(xWarpPointerReq); @@ -3087,6 +3087,12 @@ ProcWarpPointer(ClientPtr client) return rc; } } + + dev = PickPointer(client); + if (dev->u.lastSlave) + dev = dev->u.lastSlave; + pSprite = dev->spriteInfo->sprite; + #ifdef PANORAMIX if(!noPanoramiXExtension) return XineramaWarpPointer(client); @@ -3153,13 +3159,12 @@ ProcWarpPointer(ClientPtr client) else if (y >= pSprite->physLimits.y2) y = pSprite->physLimits.y2 - 1; if (pSprite->hotShape) - ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y); - (*newScreen->SetCursorPosition)(PickPointer(client), newScreen, x, y, - TRUE); + ConfineToShape(dev, pSprite->hotShape, &x, &y); + (*newScreen->SetCursorPosition)(dev, newScreen, x, y, TRUE); } - else if (!PointerConfinedToScreen(PickPointer(client))) + else if (!PointerConfinedToScreen(dev)) { - NewCurrentScreen(PickPointer(client), newScreen, x, y); + NewCurrentScreen(dev, newScreen, x, y); } return Success; } diff --git a/dix/getevents.c b/dix/getevents.c index 16e23dc20..279f49e54 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -973,8 +973,20 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, events = updateFromMaster(events, pDev, &num_events); if (flags & POINTER_ABSOLUTE) + { + if (flags & POINTER_SCREEN) /* valuators are in screen coords */ + { + + valuators[0] = rescaleValuatorAxis(valuators[0], NULL, + pDev->valuator->axes + 0, + scr->width); + valuators[1] = rescaleValuatorAxis(valuators[1], NULL, + pDev->valuator->axes + 1, + scr->height); + } + moveAbsolute(pDev, &x, &y, first_valuator, num_valuators, valuators); - else { + } else { if (flags & POINTER_ACCELERATE) accelPointer(pDev, first_valuator, num_valuators, valuators, ms); moveRelative(pDev, &x, &y, first_valuator, num_valuators, valuators); |