summaryrefslogtreecommitdiff
path: root/Xext/xtest.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-04-18 10:57:47 +0930
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-04-18 14:39:41 +0930
commite0eaf8e5e3fa7a11c087851dff93f50f6907c4a5 (patch)
tree973c1fc0165c078b3672cd98dbfcb94731296fe3 /Xext/xtest.c
parentcb0168b4ac5c59cdce6f0a6d89ddd9f30d93b5f3 (diff)
Xext: Let XTestFakeInput update the sprite for XI events.
Since XI devices can have their own sprite now, we need to update the sprite coordinates too when processing an XI event. Note: This doesn't deal with the device hierarchy correctly yet.
Diffstat (limited to 'Xext/xtest.c')
-rw-r--r--Xext/xtest.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/Xext/xtest.c b/Xext/xtest.c
index 0c96b3c33..5f0b25eb8 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -338,7 +338,23 @@ ProcXTestFakeInput(client)
values += 6;
}
}
- break;
+ /* For XI events, the actual event is mostly unset. Since we
+ * want to update the sprite nontheless, we need to fake up
+ * sane values for the event. */
+
+ ev->u.keyButtonPointer.root = None;
+ dv = (deviceValuator*)(ev + 1);
+ if (dv->num_valuators && dv->first_valuator == 0)
+ ev->u.keyButtonPointer.rootX = dv->valuator0;
+ else
+ ev->u.keyButtonPointer.rootX = 0;
+
+ /* XXX: AFAIK, XI requires always sending _all_ valuators,
+ * i.e. you can't just send vals 3 - 7. (whot) */
+ if (dv->num_valuators > 1 && dv->first_valuator == 0)
+ ev->u.keyButtonPointer.rootY = dv->valuator1;
+ else
+ ev->u.keyButtonPointer.rootY = 0;
}
if (!dev)
@@ -360,9 +376,13 @@ ProcXTestFakeInput(client)
if (ev->u.u.detail == xTrue)
{
int x, y;
- GetSpritePosition(dev, &x, &y);
- ev->u.keyButtonPointer.rootX += x;
- ev->u.keyButtonPointer.rootY += y;
+ if (!extension || !dev->valuator->mode == Absolute)
+ {
+ /* if Absolute, rootX already has the final coords. */
+ GetSpritePosition(dev, &x, &y);
+ ev->u.keyButtonPointer.rootX += x;
+ ev->u.keyButtonPointer.rootY += y;
+ }
}
else if (ev->u.u.detail != xFalse)
{
@@ -431,6 +451,12 @@ ProcXTestFakeInput(client)
case ButtonRelease:
if (!extension)
dev = PickPointer(client);
+ else
+ {
+ /* For XI events, the rootX/Y is unset. */
+ ev->u.keyButtonPointer.rootX = dev->lastx;
+ ev->u.keyButtonPointer.rootY = dev->lasty;
+ }
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
{
client->errorValue = ev->u.u.detail;