Xi: avoid double button mapping.

Button events were mapped once in GetPointerEvents and then again in
UpdateDeviceState. While it might make sense to just fix up UpdateDeviceState,
it turns out to be better to leave the raw button number in the event because
DGA reports raw device events without button translation, and so when it calls
UpdateDeviceState, the button down counts get scrambled and buttons get stuck
down.

See also:
http://lists.freedesktop.org/archives/xorg/2008-June/036201.html

Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
This commit is contained in:
Keith Packard 2008-06-15 10:01:28 +09:30 committed by Peter Hutterer
parent d894e86aa5
commit 8c9234a163
2 changed files with 10 additions and 5 deletions

View File

@ -1066,9 +1066,11 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
(key == device->deviceGrab.activatingKey))
deactivateDeviceGrab = TRUE;
} else if (xE->u.u.type == DeviceButtonPress) {
xE->u.u.detail = key;
if (xE->u.u.detail == 0)
xE->u.u.detail = b->map[key];
if (xE->u.u.detail == 0) {
xE->u.u.detail = key;
return;
}
if (!grab && CheckDeviceGrabs(device, xE, 0, count))
{
/* if a passive grab was activated, the event has been sent
@ -1077,9 +1079,11 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
}
} else if (xE->u.u.type == DeviceButtonRelease) {
xE->u.u.detail = key;
if (xE->u.u.detail == 0)
xE->u.u.detail = b->map[key];
if (xE->u.u.detail == 0) {
xE->u.u.detail = key;
return;
}
if (!b->state && device->deviceGrab.fromPassiveGrab)
deactivateDeviceGrab = TRUE;
}
@ -1094,6 +1098,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
if (deactivateDeviceGrab == TRUE)
(*device->deviceGrab.DeactivateGrab) (device);
xE->u.u.detail = key;
}
_X_EXPORT int

View File

@ -1030,7 +1030,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
kbp->type = DeviceButtonPress;
else if (type == ButtonRelease)
kbp->type = DeviceButtonRelease;
kbp->detail = pDev->button->map[buttons];
kbp->detail = buttons;
}
kbp->root_x = cx; /* root_x/y always in screen coords */