From ceb026c6a6f1eea8b34e745f06f1ebcd652c0ba1 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 27 Jan 2012 12:41:09 +1000 Subject: Xi: handle new XIAllowEvents request in inputproto 2.1.99.6 grab_window and touchid were removed from the struct for ABI compatibility reasons, we need to pull in the new, XI 2.2-specific struct. Signed-off-by: Peter Hutterer --- Xi/xiallowev.c | 41 +++++++++++++++++++++++++++++++++++------ configure.ac | 2 +- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Xi/xiallowev.c b/Xi/xiallowev.c index 38967b225..d0856b656 100644 --- a/Xi/xiallowev.c +++ b/Xi/xiallowev.c @@ -41,6 +41,7 @@ #include #include "exglobals.h" /* BadDevice */ +#include "exevents.h" #include "xiallowev.h" int @@ -51,8 +52,12 @@ SProcXIAllowEvents(ClientPtr client) swaps(&stuff->length); swaps(&stuff->deviceid); swapl(&stuff->time); - /* FIXME swap touchid */ - /* FIXME swap window */ + if (stuff->length > 3) + { + xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq*)stuff; + swapl(&req_xi22->touchid); + swapl(&req_xi22->grab_window); + } return ProcXIAllowEvents(client); } @@ -63,9 +68,21 @@ ProcXIAllowEvents(ClientPtr client) TimeStamp time; DeviceIntPtr dev; int ret = Success; + XIClientPtr xi_client; + Bool have_xi22 = FALSE; + REQUEST(xXI2_2AllowEventsReq); - REQUEST(xXIAllowEventsReq); - /* FIXME: check request length, 12 for XI 2.0+, 20 for XI 2.2+ */ + xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey); + + if (version_compare(xi_client->major_version, + xi_client->minor_version, 2, 2) >= 0) + { + REQUEST_AT_LEAST_SIZE(xXI2_2AllowEventsReq); + have_xi22 = TRUE; + } else + { + REQUEST_SIZE_MATCH(xXIAllowEventsReq); + } ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); if (ret != Success) @@ -97,8 +114,20 @@ ProcXIAllowEvents(ClientPtr client) break; case XIRejectTouch: case XIAcceptTouch: - ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid, - stuff->grab_window, &client->errorValue); + { + int rc; + WindowPtr win; + + if (!have_xi22) + return BadValue; + + rc = dixLookupWindow(&win, stuff->grab_window, client, DixReadAccess); + if (rc != Success) + return rc; + + ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid, + stuff->grab_window, &client->errorValue); + } break; default: client->errorValue = stuff->mode; diff --git a/configure.ac b/configure.ac index 6241119c4..7e48d44b8 100644 --- a/configure.ac +++ b/configure.ac @@ -776,7 +776,7 @@ XPROTO="xproto >= 7.0.22" RANDRPROTO="randrproto >= 1.2.99.3" RENDERPROTO="renderproto >= 0.11" XEXTPROTO="xextproto >= 7.1.99" -INPUTPROTO="inputproto >= 2.1.99.5" +INPUTPROTO="inputproto >= 2.1.99.6" KBPROTO="kbproto >= 1.0.3" FONTSPROTO="fontsproto" FIXESPROTO="fixesproto >= 5.0" -- cgit v1.2.3 From 6f28388187cffae9e5bc9bfc9425acff4f478b59 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Sat, 11 Feb 2012 01:29:26 +1000 Subject: dix: reset last.scroll when resetting the valuator (#45611) last.scroll remained on the last-submitted scrolling value but last.valuator was changed whenever the slave device changed. The first scrolling delta after a switch was then calculated as (last.scroll - new abs value), causing erroneous scrolling events. Test case: - synaptics with a scrolling method enabled, other device with 3+ axes (e.g. wacom) - scroll on touchpad - use other device - scroll on touchpad The second scroll caused erroneous button press/release events. X.Org Bug 45611 Signed-off-by: Peter Hutterer Reviewed-by: Chase Douglas --- dix/getevents.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dix/getevents.c b/dix/getevents.c index 7678aa1f2..6ea4ba010 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -360,6 +360,7 @@ updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev) if (i >= lastSlave->valuator->numAxes) { pDev->last.valuators[i] = 0; + valuator_mask_set_double(pDev->last.scroll, i, 0); } else { @@ -367,6 +368,7 @@ updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev) val = rescaleValuatorAxis(val, lastSlave->valuator->axes + i, pDev->valuator->axes + i, 0, 0); pDev->last.valuators[i] = val; + valuator_mask_set_double(pDev->last.scroll, i, val); } } } -- cgit v1.2.3 From 1ecb7aaf2adedad1996cd26176ef5802113e3ad9 Mon Sep 17 00:00:00 2001 From: Chase Douglas Date: Sat, 11 Feb 2012 07:58:38 -0800 Subject: Focus event button state must show the logical buttons, not physical buttons Similar to the fix in fcda98c48610fd507ca0b89c6006a5497d9dc1c9. This ensures we show the correct logical state of the buttons in device focus events too. Signed-off-by: Chase Douglas Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- Xi/exevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 1ecc3ba5a..de7d50a3a 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -2215,7 +2215,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) if (BitIsOn(mouse->button->down, i)) - SetBit(&xi2event[1], i); + SetBit(&xi2event[1], mouse->button->map[i]); if (dev->key) { -- cgit v1.2.3 From 03d32fe7a718d9016053cdb5d57f51a74ef99b59 Mon Sep 17 00:00:00 2001 From: Chase Douglas Date: Mon, 13 Feb 2012 12:09:32 -0800 Subject: Don't dereference a touch after it has been ended when punting to next owner In this case, we have ended the touch because the last owner has rejected it. We need to return from the function right now so we don't attempt to dereference another touch client for early acceptance processing. Signed-off-by: Chase Douglas Reviewed-by: Chase Douglas Signed-off-by: Peter Hutterer --- Xi/exevents.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Xi/exevents.c b/Xi/exevents.c index de7d50a3a..816dfa7e9 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1164,6 +1164,7 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti, { EmitTouchEnd(dev, ti, 0, 0); TouchEndTouch(dev, ti); + return; } if (ti->listeners[0].state == LISTENER_EARLY_ACCEPT) -- cgit v1.2.3 From 8573b3519af138a3a12a2e77098718165f9fd8ff Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 13 Feb 2012 16:00:47 -0800 Subject: Don't clobber virtual core pointer touches array length The VCP has its own touches array, don't overwrite it when the class is copied from the SD to the master. Reported-by: Chase Douglas Signed-off-by: Peter Hutterer Reviewed-by: Chase Douglas --- Xi/exevents.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 816dfa7e9..ca8060d78 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -671,7 +671,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) if (from->touch) { - TouchPointInfoPtr tmp; + TouchClassPtr t, f; if (!to->touch) { classes = to->unused_classes; @@ -692,10 +692,18 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) } else classes->touch = NULL; } - tmp = to->touch->touches; - memcpy(to->touch, from->touch, sizeof(TouchClassRec)); - to->touch->touches = tmp; - to->touch->sourceid = from->id; + + + t = to->touch; + f = from->touch; + t->sourceid = f->sourceid; + t->max_touches = f->max_touches; + t->mode = f->mode; + t->buttonsDown = f->buttonsDown; + t->state = f->state; + t->motionMask = f->motionMask; + /* to->touches and to->num_touches are separate on the master, + * don't copy */ } else if (to->touch) { ClassesPtr classes; -- cgit v1.2.3 From eaba06a27c5520a02f08431ac1e4b0e0bdc22cd8 Mon Sep 17 00:00:00 2001 From: Chase Douglas Date: Mon, 13 Feb 2012 16:00:48 -0800 Subject: Keep virtual core pointer touch class around if new slave doesn't have one The VCP may have active touch grabs. The touch records must be kept so these touch grabs may be accepted/rejected in the future. This means the touch class list will not represent the touch class of the attached slave device if it does not have a touch class, but we already were breaking that assumption by keeping a separate touches array for the VCP. Signed-off-by: Chase Douglas Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- Xi/exevents.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index ca8060d78..f390f6739 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -704,13 +704,10 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) t->motionMask = f->motionMask; /* to->touches and to->num_touches are separate on the master, * don't copy */ - } else if (to->touch) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->touch = to->touch; - to->touch = NULL; } + /* Don't remove touch class if from->touch is non-existent. The to device + * may have an active touch grab, so we need to keep the touch class record + * around. */ } /** -- cgit v1.2.3