On Tue, Feb 28, 2012 at 23:00:57 +0100, Julien Cristau wrote: > libXi has had several important fixes upstream over the past year, some > of which are required for operation with recent X servers (see > bug#660411 e.g.). A lot of it is related to calculating the proper size > of an allocation to fill in structures with the right size and > alignment, so it's rather painful unfortunately. > > Not all of these changes are in sid yet, so whatever's decided I won't > upload before that's done. The affected interfaces are part of XI2, > which doesn't have a lot of users in squeeze (seems to be just xinput > and synaptiks), but gets a lot more exposure now with e.g. gtk3. > So this was a bit too intrusive, let's dial it down to:
diff -u libxi-1.3/debian/changelog libxi-1.3/debian/changelog --- libxi-1.3/debian/changelog +++ libxi-1.3/debian/changelog @@ -1,3 +1,12 @@ +libxi (2:1.3-7) squeeze; urgency=low + + * Cherry-pick two patches from upstream: + - Fix passive grabs + - Fill in mods/group->effective in XIQueryPointer + - Handle unknown device classes (closes: #661021, #660411) + + -- Julien Cristau <jcris...@debian.org> Wed, 02 May 2012 23:46:50 +0200 + libxi (2:1.3-6) unstable; urgency=medium * WireToEvent: Set display member of all events as well (cherry-pick from diff -u libxi-1.3/src/XExtInt.c libxi-1.3/src/XExtInt.c --- libxi-1.3/src/XExtInt.c +++ libxi-1.3/src/XExtInt.c @@ -100,7 +100,7 @@ Display * /* dpy */ ); -int copy_classes(XIDeviceInfo *to, xXIAnyInfo* from, int nclasses); +int copy_classes(XIDeviceInfo *to, xXIAnyInfo* from, int *nclasses); int size_classes(xXIAnyInfo* from, int nclasses); static XExtensionInfo *xinput_info; @@ -1445,30 +1445,29 @@ * |______________________^ */ _X_HIDDEN int -copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses) +copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses) { XIAnyClassInfo *any_lib; xXIAnyInfo *any_wire; void *ptr_lib; char *ptr_wire; int i, len; + int cls_idx = 0; if (!to->classes) return -1; ptr_wire = (char*)from; ptr_lib = to->classes; - to->classes = next_block(&ptr_lib, nclasses * sizeof(XIAnyClassInfo*)); + to->classes = next_block(&ptr_lib, *nclasses * sizeof(XIAnyClassInfo*)); + memset(to->classes, 0, sizeof(*nclasses * sizeof(XIAnyClassInfo*))); len = 0; /* count wire length */ - for (i = 0; i < nclasses; i++) + for (i = 0; i < *nclasses; i++) { any_lib = (XIAnyClassInfo*)ptr_lib; any_wire = (xXIAnyInfo*)ptr_wire; - to->classes[i] = any_lib; - any_lib->type = any_wire->type; - any_lib->sourceid = any_wire->sourceid; switch(any_wire->type) { case XIButtonClass: @@ -1481,6 +1480,8 @@ cls_lib = next_block(&ptr_lib, sizeof(XIButtonClassInfo)); cls_wire = (xXIButtonInfo*)any_wire; + cls_lib->type = cls_wire->type; + cls_lib->sourceid = cls_wire->sourceid; cls_lib->num_buttons = cls_wire->num_buttons; cls_lib->state.mask_len = ((((cls_wire->num_buttons + 7)/8) + 3)/4) * 4; cls_lib->state.mask = next_block(&ptr_lib, cls_lib->state.mask_len); @@ -1492,6 +1493,7 @@ for (j = 0; j < cls_lib->num_buttons; j++) cls_lib->labels[j] = *atoms++; + to->classes[cls_idx++] = any_lib; break; } case XIKeyClass: @@ -1502,12 +1504,15 @@ cls_lib = next_block(&ptr_lib, sizeof(XIKeyClassInfo)); cls_wire = (xXIKeyInfo*)any_wire; + cls_lib->type = cls_wire->type; + cls_lib->sourceid = cls_wire->sourceid; cls_lib->num_keycodes = cls_wire->num_keycodes; cls_lib->keycodes = next_block(&ptr_lib, cls_lib->num_keycodes * sizeof(int)); memcpy(cls_lib->keycodes, &cls_wire[1], cls_lib->num_keycodes); + to->classes[cls_idx++] = any_lib; break; } case XIValuatorClass: @@ -1518,6 +1523,8 @@ cls_lib = next_block(&ptr_lib, sizeof(XIValuatorClassInfo)); cls_wire = (xXIValuatorInfo*)any_wire; + cls_lib->type = cls_wire->type; + cls_lib->sourceid = cls_wire->sourceid; cls_lib->number = cls_wire->number; cls_lib->label = cls_wire->label; cls_lib->resolution = cls_wire->resolution; @@ -1527,12 +1534,16 @@ /* FIXME: fractional parts */ cls_lib->mode = cls_wire->mode; + to->classes[cls_idx++] = any_lib; } break; } len += any_wire->length * 4; ptr_wire += any_wire->length * 4; } + + /* we may have skipped unknown classes, reset nclasses */ + *nclasses = cls_idx; return len; } @@ -1543,6 +1554,7 @@ XIDeviceChangedEvent *out; XIDeviceInfo info; int len; + int nclasses = in->num_classes; len = size_classes((xXIAnyInfo*)&in[1], in->num_classes); @@ -1557,13 +1569,13 @@ out->deviceid = in->deviceid; out->sourceid = in->sourceid; out->reason = in->reason; - out->num_classes = in->num_classes; out->classes = (XIAnyClassInfo**)&out[1]; info.classes = out->classes; - copy_classes(&info, (xXIAnyInfo*)&in[1], in->num_classes); + copy_classes(&info, (xXIAnyInfo*)&in[1], &nclasses); + out->num_classes = nclasses; return 1; } only in patch2: unchanged: --- libxi-1.3.orig/src/XIQueryDevice.c +++ libxi-1.3/src/XIQueryDevice.c @@ -29,7 +29,7 @@ #include <X11/extensions/extutil.h> #include "XIint.h" -extern int copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses); +extern int copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses); extern int size_classes(xXIAnyInfo* from, int nclasses); XIDeviceInfo* @@ -87,7 +87,7 @@ ptr += ((wire->name_len + 3)/4) * 4; lib->classes = Xmalloc(size_classes((xXIAnyInfo*)ptr, lib->num_classes)); - ptr += copy_classes(lib, (xXIAnyInfo*)ptr, lib->num_classes); + ptr += copy_classes(lib, (xXIAnyInfo*)ptr, &lib->num_classes); } Xfree(buf); only in patch2: unchanged: --- libxi-1.3.orig/src/XIPassiveGrab.c +++ libxi-1.3/src/XIPassiveGrab.c @@ -73,7 +73,7 @@ free(buff); - if (_XReply(dpy, (xReply *)&reply, 0, xTrue)) + if (!_XReply(dpy, (xReply *)&reply, 0, xTrue)) { UnlockDisplay(dpy); SyncHandle(); only in patch2: unchanged: --- libxi-1.3.orig/src/XIQueryPointer.c +++ libxi-1.3/src/XIQueryPointer.c @@ -86,9 +86,12 @@ mods->base = rep.mods.base_mods; mods->latched = rep.mods.latched_mods; mods->locked = rep.mods.locked_mods; + mods->effective = mods->base | mods->latched | mods->locked; + group->base = rep.group.base_group; group->latched = rep.group.latched_group; group->locked = rep.group.locked_group; + group->effective = group->base | group->latched | group->locked; buttons->mask_len = rep.buttons_len * 4; buttons->mask = malloc(buttons->mask_len); OK to upload? Cheers, Julien
signature.asc
Description: Digital signature