summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-01-12 15:29:36 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-01-13 09:22:56 +1000
commitd36adf52a2b2711d22b11105f7bd907d4493fb9b (patch)
tree36fdb74e052820c60d797ed80d5627256937b686
parent488d45295105daf10ccd17ca93ae6a6f4d0104f1 (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>
-rw-r--r--dix/events.c19
-rw-r--r--dix/getevents.c14
-rw-r--r--include/input.h1
-rw-r--r--mi/mipointer.c2
4 files changed, 27 insertions, 9 deletions
diff --git a/dix/events.c b/dix/events.c
index e6a3fbff8..da57aa093 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3139,8 +3139,8 @@ ProcWarpPointer(ClientPtr client)
3139 WindowPtr dest = NULL; 3139 WindowPtr dest = NULL;
3140 int x, y, rc; 3140 int x, y, rc;
3141 ScreenPtr newScreen; 3141 ScreenPtr newScreen;
3142 DeviceIntPtr dev = PickPointer(client); 3142 DeviceIntPtr dev;
3143 SpritePtr pSprite = dev->spriteInfo->sprite; 3143 SpritePtr pSprite;
3144 3144
3145 REQUEST(xWarpPointerReq); 3145 REQUEST(xWarpPointerReq);
3146 REQUEST_SIZE_MATCH(xWarpPointerReq); 3146 REQUEST_SIZE_MATCH(xWarpPointerReq);
@@ -3153,6 +3153,12 @@ ProcWarpPointer(ClientPtr client)
3153 return rc; 3153 return rc;
3154 } 3154 }
3155 } 3155 }
3156
3157 dev = PickPointer(client);
3158 if (dev->u.lastSlave)
3159 dev = dev->u.lastSlave;
3160 pSprite = dev->spriteInfo->sprite;
3161
3156#ifdef PANORAMIX 3162#ifdef PANORAMIX
3157 if(!noPanoramiXExtension) 3163 if(!noPanoramiXExtension)
3158 return XineramaWarpPointer(client); 3164 return XineramaWarpPointer(client);
@@ -3219,13 +3225,12 @@ ProcWarpPointer(ClientPtr client)
3219 else if (y >= pSprite->physLimits.y2) 3225 else if (y >= pSprite->physLimits.y2)
3220 y = pSprite->physLimits.y2 - 1; 3226 y = pSprite->physLimits.y2 - 1;
3221 if (pSprite->hotShape) 3227 if (pSprite->hotShape)
3222 ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y); 3228 ConfineToShape(dev, pSprite->hotShape, &x, &y);
3223 (*newScreen->SetCursorPosition)(PickPointer(client), newScreen, x, y, 3229 (*newScreen->SetCursorPosition)(dev, newScreen, x, y, TRUE);
3224 TRUE);
3225 } 3230 }
3226 else if (!PointerConfinedToScreen(PickPointer(client))) 3231 else if (!PointerConfinedToScreen(dev))
3227 { 3232 {
3228 NewCurrentScreen(PickPointer(client), newScreen, x, y); 3233 NewCurrentScreen(dev, newScreen, x, y);
3229 } 3234 }
3230 return Success; 3235 return Success;
3231} 3236}
diff --git a/dix/getevents.c b/dix/getevents.c
index acc8a4f69..672ff7df2 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -999,8 +999,20 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
999 events = updateFromMaster(events, pDev, &num_events); 999 events = updateFromMaster(events, pDev, &num_events);
1000 1000
1001 if (flags & POINTER_ABSOLUTE) 1001 if (flags & POINTER_ABSOLUTE)
1002 {
1003 if (flags & POINTER_SCREEN) /* valuators are in screen coords */
1004 {
1005
1006 valuators[0] = rescaleValuatorAxis(valuators[0], NULL,
1007 pDev->valuator->axes + 0,
1008 scr->width);
1009 valuators[1] = rescaleValuatorAxis(valuators[1], NULL,
1010 pDev->valuator->axes + 1,
1011 scr->height);
1012 }
1013
1002 moveAbsolute(pDev, &x, &y, first_valuator, num_valuators, valuators); 1014 moveAbsolute(pDev, &x, &y, first_valuator, num_valuators, valuators);
1003 else { 1015 } else {
1004 if (flags & POINTER_ACCELERATE) 1016 if (flags & POINTER_ACCELERATE)
1005 accelPointer(pDev, first_valuator, num_valuators, valuators, ms); 1017 accelPointer(pDev, first_valuator, num_valuators, valuators, ms);
1006 moveRelative(pDev, &x, &y, first_valuator, num_valuators, valuators); 1018 moveRelative(pDev, &x, &y, first_valuator, num_valuators, valuators);
diff --git a/include/input.h b/include/input.h
index 3a9bfa273..2dd29f8e9 100644
--- a/include/input.h
+++ b/include/input.h
@@ -62,6 +62,7 @@ SOFTWARE.
62#define POINTER_RELATIVE (1 << 1) 62#define POINTER_RELATIVE (1 << 1)
63#define POINTER_ABSOLUTE (1 << 2) 63#define POINTER_ABSOLUTE (1 << 2)
64#define POINTER_ACCELERATE (1 << 3) 64#define POINTER_ACCELERATE (1 << 3)
65#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
65 66
66/*int constants for pointer acceleration schemes*/ 67/*int constants for pointer acceleration schemes*/
67#define PtrAccelNoOp 0 68#define PtrAccelNoOp 0
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 83a355ea3..567790c49 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -576,7 +576,7 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
576 } 576 }
577 } 577 }
578 578
579 nevents = GetPointerEvents(events, pDev, MotionNotify, 0, POINTER_ABSOLUTE, 0, 2, valuators); 579 nevents = GetPointerEvents(events, pDev, MotionNotify, 0, POINTER_SCREEN | POINTER_ABSOLUTE, 0, 2, valuators);
580 580
581 OsBlockSignals(); 581 OsBlockSignals();
582#ifdef XQUARTZ 582#ifdef XQUARTZ