From 13541e0b1ec6b166edb245eea81a836e7a3cde93 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 9 Nov 2011 11:35:12 +1000 Subject: [PATCH] Update to 1.5.99.1 (with XI 2.1 support) --- .gitignore | 1 + 0001-Handle-unknown-device-classes.patch | 176 ----------------------- libXi.spec | 12 +- sources | 2 +- 4 files changed, 8 insertions(+), 183 deletions(-) delete mode 100644 0001-Handle-unknown-device-classes.patch diff --git a/.gitignore b/.gitignore index 52092a7..5413427 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ libXi-1.4.0.tar.bz2 /libXi-1.4.1.tar.bz2 /libXi-1.4.2.tar.bz2 /libXi-1.4.3.tar.bz2 +/libXi-1.4.99.1.tar.bz2 diff --git a/0001-Handle-unknown-device-classes.patch b/0001-Handle-unknown-device-classes.patch deleted file mode 100644 index b9cae1c..0000000 --- a/0001-Handle-unknown-device-classes.patch +++ /dev/null @@ -1,176 +0,0 @@ -From 635c2c029b1e73311c3f650bcaf7eeb9e782134b Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Wed, 17 Aug 2011 15:20:48 +1000 -Subject: [PATCH] Handle unknown device classes. - -If the server sends an unknown device class in response to an XIQueryDevice -call, no memory is allocated for these classes but we still write type -and sourceid as well as setting to->classes[i]. The latter causes multiple -classes to point to the same memory field. - -Move the common code of assigning these three into the respective class type -handlers so to automatically skip any unknown classes. - -Signed-off-by: Peter Hutterer ---- - src/XExtInt.c | 30 +++++++++++++++++++++--------- - src/XIQueryDevice.c | 4 ++-- - 2 files changed, 23 insertions(+), 11 deletions(-) - -diff --git a/src/XExtInt.c b/src/XExtInt.c -index 86a780e..9e1ad19 100644 ---- a/src/XExtInt.c -+++ b/src/XExtInt.c -@@ -98,7 +98,7 @@ extern int _XiGetDevicePresenceNotifyEvent( - 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; -@@ -1448,30 +1448,29 @@ size_classes(xXIAnyInfo* from, int nclasses) - * |______________________^ - */ - _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: -@@ -1485,6 +1484,8 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses) - 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; - size = ((((cls_wire->num_buttons + 7)/8) + 3)/4); - cls_lib->state.mask_len = size * 4; -@@ -1499,6 +1500,7 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses) - for (j = 0; j < cls_lib->num_buttons; j++) - cls_lib->labels[j] = *atoms++; - -+ to->classes[cls_idx++] = any_lib; - break; - } - case XIKeyClass: -@@ -1509,12 +1511,15 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses) - 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: -@@ -1525,6 +1530,8 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses) - 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; -@@ -1534,12 +1541,16 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses) - /* 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; - } - -@@ -1550,6 +1561,7 @@ wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XGenericEventCookie *cookie) - XIDeviceChangedEvent *out; - XIDeviceInfo info; - int len; -+ int nclasses = in->num_classes; - - len = size_classes((xXIAnyInfo*)&in[1], in->num_classes); - -@@ -1564,13 +1576,13 @@ wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XGenericEventCookie *cookie) - 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; - } -diff --git a/src/XIQueryDevice.c b/src/XIQueryDevice.c -index 4e2f392..c22aee1 100644 ---- a/src/XIQueryDevice.c -+++ b/src/XIQueryDevice.c -@@ -29,7 +29,7 @@ - #include - #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 @@ XIQueryDevice(Display *dpy, int deviceid, int *ndevices_return) - 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); --- -1.7.6.4 - diff --git a/libXi.spec b/libXi.spec index e590018..5310e70 100644 --- a/libXi.spec +++ b/libXi.spec @@ -3,8 +3,8 @@ Summary: X.Org X11 libXi runtime library Name: libXi -Version: 1.4.3 -Release: 3%{?dist} +Version: 1.4.99.1 +Release: 1%{?dist} License: MIT Group: System Environment/Libraries URL: http://www.x.org @@ -13,12 +13,10 @@ Source0: ftp://ftp.x.org/pub/individual/lib/%{name}-%{version}.tar.bz2 #Source0: %{tarball}-%{gitdate}.tar.bz2 Source1: make-git-snapshot.sh -Patch01: 0001-Handle-unknown-device-classes.patch - BuildRequires: autoconf automake libtool BuildRequires: xorg-x11-util-macros BuildRequires: xorg-x11-proto-devel -BuildRequires: pkgconfig(inputproto) >= 1.9.99.902 +BuildRequires: pkgconfig(inputproto) >= 2.0.99.1 BuildRequires: libX11-devel >= 1.2.99 BuildRequires: libXext-devel BuildRequires: xmlto asciidoc >= 8.4.5 @@ -40,7 +38,6 @@ X.Org X11 libXi development package %prep %setup -q #setup -q -n %{tarball}-%{gitdate} -%patch01 -p1 # Disable static library creation by default. %define with_static 0 @@ -87,6 +84,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man3/*.3* %changelog +* Wed Nov 09 2011 Peter Hutterer 1.4.99.1-1 +- Update to 1.4.99.1 (with XI 2.1 support) + * Tue Oct 11 2011 Peter Hutterer 1.4.3-3 - Fix 0001-Handle-unknown-device-classes.patch: missing prototype change for copy_classes in XIQueryDevice caused parameter corruption (#744960) diff --git a/sources b/sources index 1ddbb16..d432bc3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -792e8a7ddc7175911d69f823d38eaff6 libXi-1.4.3.tar.bz2 +4e9dedaa2fe2561f9f0161d5c14db804 libXi-1.4.99.1.tar.bz2