mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-21 01:13:38 +00:00
input: fix up usage of button->down, used to be a bitmask, is now an array.
device->button->down used to be a 32-byte bitmask with one bit for each button. This has changed into a 256-byte array, with one byte assigned for each button. Some of the callers were still using this array as a bitmask however, this is fixed with this patch. Thanks to Keith Packard for pointing this out. See also: http://lists.freedesktop.org/archives/xorg/2008-June/036202.html
This commit is contained in:
parent
2b9c829bde
commit
d21155a3e9
6 changed files with 16 additions and 13 deletions
|
|
@ -1153,9 +1153,11 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
|
|||
ev->num_valuators = 0;
|
||||
|
||||
if (b) {
|
||||
int i;
|
||||
ev->classes_reported |= (1 << ButtonClass);
|
||||
ev->num_buttons = b->numButtons;
|
||||
memmove((char *)&ev->buttons[0], (char *)b->down, 4);
|
||||
for (i = 0; i < 32; i++)
|
||||
SetBitIf(ev->buttons, b->down, i);
|
||||
} else if (k) {
|
||||
ev->classes_reported |= (1 << KeyClass);
|
||||
ev->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode;
|
||||
|
|
@ -1270,11 +1272,13 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
|
|||
first += 3;
|
||||
nval -= 3;
|
||||
if (nbuttons > 32) {
|
||||
int i;
|
||||
(ev - 1)->deviceid |= MORE_EVENTS;
|
||||
bev = (deviceButtonStateNotify *) ev++;
|
||||
bev->type = DeviceButtonStateNotify;
|
||||
bev->deviceid = dev->id;
|
||||
memmove((char *)&bev->buttons[0], (char *)&b->down[4], 28);
|
||||
for (i = 32; i < MAP_LENGTH; i++)
|
||||
SetBitIf(bev->buttons, b->down, i);
|
||||
}
|
||||
if (nval > 0) {
|
||||
(ev - 1)->deviceid |= MORE_EVENTS;
|
||||
|
|
@ -1692,7 +1696,7 @@ SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map)
|
|||
if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue))
|
||||
return BadValue;
|
||||
for (i = 0; i < nElts; i++)
|
||||
if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1))
|
||||
if ((b->map[i + 1] != map[i]) && (b->down[i + 1]))
|
||||
return MappingBusy;
|
||||
for (i = 0; i < nElts; i++)
|
||||
b->map[i + 1] = map[i];
|
||||
|
|
|
|||
Loading…
Reference in a new issue