From ad6347afead500fefb34131841f4beb5b03ad4ec Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 16 Jun 2009 16:35:40 +1000 Subject: [PATCH] Xi: don't use a constant number for class sizes - use sizeof instead The protocol is still changing, and having to debug crap like this is annoying. Signed-off-by: Peter Hutterer --- Xi/xiquerydevice.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c index 98325e112..2c01863bb 100644 --- a/Xi/xiquerydevice.c +++ b/Xi/xiquerydevice.c @@ -237,7 +237,7 @@ ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info) info->type = ButtonClass; info->num_buttons = dev->button->numButtons; - info->length = 2 + mask_len + info->num_buttons; + info->length = sizeof(xXIButtonInfo)/4 + mask_len + info->num_buttons; info->sourceid = dev->button->sourceid; bits = (unsigned char*)&info[1]; @@ -281,7 +281,7 @@ ListKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info) info->type = KeyClass; info->num_keycodes = xkb->max_key_code - xkb->min_key_code + 1; - info->length = 2 + info->num_keycodes; + info->length = sizeof(xXIKeyInfo)/4 + info->num_keycodes; info->sourceid = dev->key->sourceid; kc = (uint32_t*)&info[1];