libxi: Changes to 'upstream-unstable'
Rebased ref, commits from common ancestor:
commit 2ac185d2fd2b884f4f59a7f7f61f414d139859aa
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Mon Mar 26 09:07:34 2012 +1000
Set the RawEvent sourceid (#34240)
XI 2.2 and later include the sourceid in raw events.
X.Org Bug 34240 <http://bugs.freedesktop.org/show_bug.cgi?id=34240>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
diff --git a/src/XExtInt.c b/src/XExtInt.c
index 4f85667..43738a2 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -145,7 +145,7 @@ wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XGenericEventCookie *cookie)
static int
wireToHierarchyChangedEvent(xXIHierarchyEvent *in, XGenericEventCookie *cookie);
static int
-wireToRawEvent(xXIRawEvent *in, XGenericEventCookie *cookie);
+wireToRawEvent(XExtDisplayInfo *info, xXIRawEvent *in, XGenericEventCookie *cookie);
static int
wireToEnterLeave(xXIEnterEvent *in, XGenericEventCookie *cookie);
static int
@@ -1012,7 +1012,7 @@ XInputWireToCookie(
case XI_RawTouchUpdate:
case XI_RawTouchEnd:
*cookie = *(XGenericEventCookie*)save;
- if (!wireToRawEvent((xXIRawEvent*)event, cookie))
+ if (!wireToRawEvent(info, (xXIRawEvent*)event, cookie))
{
printf("XInputWireToCookie: CONVERSION FAILURE! evtype=%d\n",
ge->evtype);
@@ -1832,14 +1832,13 @@ wireToHierarchyChangedEvent(xXIHierarchyEvent *in, XGenericEventCookie *cookie)
}
static int
-wireToRawEvent(xXIRawEvent *in, XGenericEventCookie *cookie)
+wireToRawEvent(XExtDisplayInfo *info, xXIRawEvent *in, XGenericEventCookie *cookie)
{
int len, i, bits;
FP3232 *values;
XIRawEvent *out;
void *ptr;
-
len = sizeof(XIRawEvent) + in->valuators_len * 4;
bits = count_bits((unsigned char*)&in[1], in->valuators_len * 4);
len += bits * sizeof(double) * 2; /* raw + normal */
@@ -1857,9 +1856,14 @@ wireToRawEvent(xXIRawEvent *in, XGenericEventCookie *cookie)
out->time = in->time;
out->detail = in->detail;
out->deviceid = in->deviceid;
- out->sourceid = 0; /* https://bugs.freedesktop.org/show_bug.cgi?id=34240 */
out->flags = in->flags;
+ /* https://bugs.freedesktop.org/show_bug.cgi?id=34240 */
+ if (_XiCheckVersion(info, XInput_2_2) >= 0)
+ out->sourceid = in->sourceid;
+ else
+ out->sourceid = 0;
+
out->valuators.mask_len = in->valuators_len * 4;
out->valuators.mask = next_block(&ptr, out->valuators.mask_len);
memcpy(out->valuators.mask, &in[1], out->valuators.mask_len);
commit dfc101e4c6cdac4ff9a51732b2754287fbdc8582
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Mon Mar 26 09:05:24 2012 +1000
Move version comparison into a helper function.
No functional changes, this simply introduces a version helper function that
returns -1, 0 or 1 depending on the version comparison result. To be used
internally only.
Needed for fix to #34240
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
diff --git a/src/XExtInt.c b/src/XExtInt.c
index 0c64f9a..4f85667 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -344,6 +344,43 @@ static int XInputCheckExtension(Display *dpy, XExtDisplayInfo *info)
return 1;
}
+/*****************************************************************
+ * Compare version numbers between info and the built-in version table.
+ * Returns
+ * -1 if info's version is less than version_index's version,
+ * 0 if equal (or DontCheck),
+ * 1 if info's version is greater than version_index's version.
+ * Returns -2 on initialization errors which shouldn't happen if you call it
+ * correctly.
+ */
+_X_HIDDEN int
+_XiCheckVersion(XExtDisplayInfo *info,
+ int version_index)
+{
+ XExtensionVersion *ext;
+
+ if (versions[version_index].major_version == Dont_Check)
+ return 0;
+
+ if (!info->data)
+ return -2;
+
+ ext = ((XInputData *) info->data)->vers;
+ if (!ext)
+ return -2;
+
+ if (ext->major_version == versions[version_index].major_version &&
+ ext->minor_version == versions[version_index].minor_version)
+ return 0;
+
+ if (ext->major_version < versions[version_index].major_version ||
+ (ext->major_version == versions[version_index].major_version &&
+ ext->minor_version < versions[version_index].minor_version))
+ return -1;
+ else
+ return 1;
+}
+
/***********************************************************************
*
* Check to see if the input extension is installed in the server.
@@ -357,8 +394,6 @@ _XiCheckExtInit(
register int version_index,
XExtDisplayInfo *info)
{
- XExtensionVersion *ext;
-
if (!XInputCheckExtension(dpy, info)) {
UnlockDisplay(dpy);
return (-1);
@@ -374,15 +409,11 @@ _XiCheckExtInit(
_XiGetExtensionVersion(dpy, "XInputExtension", info);
}
- if (versions[version_index].major_version > Dont_Check) {
- ext = ((XInputData *) info->data)->vers;
- if ((ext->major_version < versions[version_index].major_version) ||
- ((ext->major_version == versions[version_index].major_version) &&
- (ext->minor_version < versions[version_index].minor_version))) {
- UnlockDisplay(dpy);
- return (-1);
- }
+ if (_XiCheckVersion(info, version_index) < 0) {
+ UnlockDisplay(dpy);
+ return -1;
}
+
return (0);
}
diff --git a/src/XIint.h b/src/XIint.h
index cc46754..be4eafb 100644
--- a/src/XIint.h
+++ b/src/XIint.h
@@ -26,6 +26,7 @@
extern XExtDisplayInfo *XInput_find_display(Display *);
extern int _XiCheckExtInit(Display *, int, XExtDisplayInfo *);
+extern int _XiCheckVersion(XExtDisplayInfo *info, int version_index);
extern XExtensionVersion *_XiGetExtensionVersion(Display *, _Xconst char *, XExtDisplayInfo *);
extern XExtensionVersion* _XiGetExtensionVersionRequest(Display *dpy, _Xconst char *name, int xi_opcode);
commit 8436c920953f288aea2d6d5f370f8eaaaef82d97
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Mar 15 11:51:41 2012 +1000
Fix wrong button label and mask copy on OS X
Regression introduced in c1a5a70b51f12dedf354102217c7cd4247ed3a4b.
If double-padding is applied, the length of the mask on the wire may be
smaller than libXi's mask_len. When copying, only the wire length must be
copied, with the remainder set to 0.
When advancing to the button labels, the wire length matters, not libXi's
internal length.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
diff --git a/src/XExtInt.c b/src/XExtInt.c
index 89c0894..0c64f9a 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -1610,12 +1610,14 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
int struct_size;
int state_size;
int labels_size;
+ int wire_mask_size;
cls_wire = (xXIButtonInfo*)any_wire;
sizeXIButtonClassType(cls_wire->num_buttons,
&struct_size, &state_size,
&labels_size);
cls_lib = next_block(&ptr_lib, struct_size);
+ wire_mask_size = ((cls_wire->num_buttons + 7)/8 + 3)/4 * 4;
cls_lib->type = cls_wire->type;
cls_lib->sourceid = cls_wire->sourceid;
@@ -1623,10 +1625,14 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
cls_lib->state.mask_len = state_size;
cls_lib->state.mask = next_block(&ptr_lib, state_size);
memcpy(cls_lib->state.mask, &cls_wire[1],
- cls_lib->state.mask_len);
+ wire_mask_size);
+ if (state_size != wire_mask_size)
+ memset(&cls_lib->state.mask[wire_mask_size], 0,
+ state_size - wire_mask_size);
cls_lib->labels = next_block(&ptr_lib, labels_size);
- atoms =(uint32_t*)((char*)&cls_wire[1] + cls_lib->state.mask_len);
+
+ atoms =(uint32_t*)((char*)&cls_wire[1] + wire_mask_size);
for (j = 0; j < cls_lib->num_buttons; j++)
cls_lib->labels[j] = *atoms++;
commit 70b730b0548ca9e408f14f2576b972beb32a0ad0
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Mar 8 16:03:50 2012 +1000
libXi 1.6.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index 77341da..fc8c1f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([libXi], [1.5.99.3],
+AC_INIT([libXi], [1.6.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXi])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([src/config.h])
commit 1b9f0394c3d4d3833f8560ae8170a4d5842419ab
Author: Chase Douglas <chase.douglas@canonical.com>
Date: Wed Mar 7 14:52:54 2012 -0800
Fix XIScrollClass increment value on 32-bit machines
This fixes scroll class increment values on 32-bit machines. Performing
1UL << 32 shifts the bit off the end of a 32-bit unsigned long value. By
expanding to 1ULL, we have the full 64-bits of an unsigned long long
including on 32-bit machines.
Before this change, xinput list --long would output scroll increment
values of -nan.
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/XExtInt.c b/src/XExtInt.c
index 7694f06..89c0894 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -1695,7 +1695,7 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
cls_lib->scroll_type= cls_wire->scroll_type;
cls_lib->flags = cls_wire->flags;
cls_lib->increment = cls_wire->increment.integral;
- cls_lib->increment += (unsigned int)cls_wire->increment.frac/(double)(1UL << 32);
+ cls_lib->increment += (unsigned int)cls_wire->increment.frac/(double)(1ULL << 32);
to->classes[cls_idx++] = any_lib;
}
commit c1a5a70b51f12dedf354102217c7cd4247ed3a4b
Author: Michał Masłowski <mtjm@mtjm.eu>
Date: Tue Feb 21 20:54:40 2012 +0100
Fix bus error on MIPS N32 for bug #38331.
XIValuatorClassInfo and XIScrollClassInfo might have an address
of 4 bytes modulo 8, while they contain doubles which need 8 byte
alignment. This is fixed by adding extra padding after each structure
or array in sizeDeviceClassType and adding helper functions to
determine sizes and padding only in one place.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=38331
Signed-off-by: Michał Masłowski <mtjm@mtjm.eu>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/XExtInt.c b/src/XExtInt.c
index b12886d..7694f06 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -1036,6 +1036,55 @@ sizeDeviceEvent(int buttons_len, int valuators_len,
return len;
}
+/* Return the size with added padding so next element would be
+ double-aligned unless the architecture is known to allow unaligned
+ data accesses. Not doing this can cause a bus error on
+ MIPS N32. */
+static int
+pad_to_double(int size)
+{
+#if !defined(__i386__) && !defined(__sh__)
+ if (size % sizeof(double) != 0)
+ size += sizeof(double) - size % sizeof(double);
+#endif
+ return size;
+}
+
+/**
+ * Set structure and atoms to size in bytes of XIButtonClassInfo, its
+ * button state mask and labels array.
+ */
+static void
+sizeXIButtonClassType(int num_buttons, int* structure, int* state, int* atoms)
+{
+ int size;
+ int labels;
+
+ *structure = pad_to_double(sizeof(XIButtonClassInfo));
+ size = ((((num_buttons + 7)/8) + 3)/4);
+
+ /* Force mask alignment with longs to avoid unaligned
+ * access when accessing the atoms. */
+ *state = pad_to_double(size * 4);
+ labels = num_buttons * sizeof(Atom);
+
+ /* Force mask alignment with longs to avoid
+ * unaligned access when accessing the atoms. */
+ labels += ((((num_buttons + 7)/8) + 3)/4) * sizeof(Atom);
+ *atoms = pad_to_double(labels);
+}
+
+/**
+ * Set structure and keycodes to size in bytes of XIKeyClassInfo and
+ * its keycodes array.
+ */
+static void
+sizeXIKeyClassType(int num_keycodes, int* structure, int* keycodes)
+{
+ *structure = pad_to_double(sizeof(XIKeyClassInfo));
+ *keycodes = pad_to_double(num_keycodes * sizeof(int));
+}
+
/**
* Return the size in bytes required to store the matching class type
* num_elements is num_buttons for XIButtonClass or num_keycodes for
@@ -1047,27 +1096,26 @@ static int
sizeDeviceClassType(int type, int num_elements)
{
int l = 0;
+ int extra1 = 0;
+ int extra2 = 0;
switch(type)
{
case XIButtonClass:
- l = sizeof(XIButtonClassInfo);
- l += num_elements * sizeof(Atom);
- /* Force mask alignment with longs to avoid
- * unaligned access when accessing the atoms. */
- l += ((((num_elements + 7)/8) + 3)/4) * sizeof(Atom);
+ sizeXIButtonClassType(num_elements, &l, &extra1, &extra2);
+ l += extra1 + extra2;
break;
case XIKeyClass:
- l = sizeof(XIKeyClassInfo);
- l += num_elements * sizeof(int);
+ sizeXIKeyClassType(num_elements, &l, &extra1);
+ l += extra1;
break;
case XIValuatorClass:
- l = sizeof(XIValuatorClassInfo);
+ l = pad_to_double(sizeof(XIValuatorClassInfo));
break;
case XIScrollClass:
- l = sizeof(XIScrollClassInfo);
+ l = pad_to_double(sizeof(XIScrollClassInfo));
break;
case XITouchClass:
- l = sizeof(XITouchClassInfo);
+ l = pad_to_double(sizeof(XITouchClassInfo));
break;
default:
printf("sizeDeviceClassType: unknown type %d\n", type);
@@ -1156,20 +1204,21 @@ copyDeviceChangedEvent(XGenericEventCookie *in_cookie,
{
case XIButtonClass:
{
- int size;
+ int struct_size;
+ int state_size;
+ int labels_size;
XIButtonClassInfo *bin, *bout;
bin = (XIButtonClassInfo*)any;
- bout = next_block(&ptr, sizeof(XIButtonClass));
+ sizeXIButtonClassType(bin->num_buttons, &struct_size,
+ &state_size, &labels_size);
+ bout = next_block(&ptr, struct_size);
*bout = *bin;
- /* Force mask alignment with longs to avoid unaligned
- * access when accessing the atoms. */
- size = bout->state.mask_len/4 * sizeof(Atom);
- bout->state.mask = next_block(&ptr, size);
+ bout->state.mask = next_block(&ptr, state_size);
memcpy(bout->state.mask, bin->state.mask,
bout->state.mask_len);
- bout->labels = next_block(&ptr, bout->num_buttons * sizeof(Atom));
+ bout->labels = next_block(&ptr, labels_size);
memcpy(bout->labels, bin->labels, bout->num_buttons * sizeof(Atom));
out->classes[i] = (XIAnyClassInfo*)bout;
break;
@@ -1177,11 +1226,15 @@ copyDeviceChangedEvent(XGenericEventCookie *in_cookie,
case XIKeyClass:
{
XIKeyClassInfo *kin, *kout;
+ int struct_size;
+ int keycodes_size;
kin = (XIKeyClassInfo*)any;
+ sizeXIKeyClassType(kin->num_keycodes, &struct_size,
+ &keycodes_size);
- kout = next_block(&ptr, sizeof(XIKeyClass));
+ kout = next_block(&ptr, struct_size);
*kout = *kin;
- kout->keycodes = next_block(&ptr, kout->num_keycodes * sizeof(int));
+ kout->keycodes = next_block(&ptr, keycodes_size);
memcpy(kout->keycodes, kin->keycodes, kout->num_keycodes * sizeof(int));
out->classes[i] = (XIAnyClassInfo*)kout;
break;
@@ -1190,7 +1243,8 @@ copyDeviceChangedEvent(XGenericEventCookie *in_cookie,
{
XIValuatorClassInfo *vin, *vout;
vin = (XIValuatorClassInfo*)any;
- vout = next_block(&ptr, sizeof(XIValuatorClass));
+ vout = next_block(&ptr,
+ sizeDeviceClassType(XIValuatorClass, 0));
*vout = *vin;
out->classes[i] = (XIAnyClassInfo*)vout;
break;
@@ -1199,7 +1253,8 @@ copyDeviceChangedEvent(XGenericEventCookie *in_cookie,
{
XIScrollClassInfo *sin, *sout;
sin = (XIScrollClassInfo*)any;
- sout = next_block(&ptr, sizeof(XIScrollClassInfo));
+ sout = next_block(&ptr,
+ sizeDeviceClassType(XIScrollClass, 0));
*sout = *sin;
out->classes[i] = (XIAnyClassInfo*)sout;
break;
@@ -1478,7 +1533,8 @@ size_classes(xXIAnyInfo* from, int nclasses)
xXIAnyInfo *any_wire;
char *ptr_wire;
- len = nclasses * sizeof(XIAnyClassInfo*); /* len for to->classes */
+ /* len for to->classes */
+ len = pad_to_double(nclasses * sizeof(XIAnyClassInfo*));
ptr_wire = (char*)from;
for (i = 0; i < nclasses; i++)
{
@@ -1533,7 +1589,8 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
ptr_wire = (char*)from;
ptr_lib = to->classes;
- to->classes = next_block(&ptr_lib, (*nclasses) * sizeof(XIAnyClassInfo*));
+ to->classes = next_block(&ptr_lib,
+ pad_to_double((*nclasses) * sizeof(XIAnyClassInfo*)));
memset(to->classes, 0, (*nclasses) * sizeof(XIAnyClassInfo*));
len = 0; /* count wire length */
@@ -1549,24 +1606,26 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
XIButtonClassInfo *cls_lib;
xXIButtonInfo *cls_wire;
uint32_t *atoms;
- int size;
int j;
+ int struct_size;
+ int state_size;
+ int labels_size;
- cls_lib = next_block(&ptr_lib, sizeof(XIButtonClassInfo));
cls_wire = (xXIButtonInfo*)any_wire;
+ sizeXIButtonClassType(cls_wire->num_buttons,
+ &struct_size, &state_size,
+ &labels_size);
+ cls_lib = next_block(&ptr_lib, struct_size);
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;
- /* Force mask alignment with longs to avoid unaligned
- * access when accessing the atoms. */
- cls_lib->state.mask = next_block(&ptr_lib, size * sizeof(Atom));
+ cls_lib->state.mask_len = state_size;
+ cls_lib->state.mask = next_block(&ptr_lib, state_size);
memcpy(cls_lib->state.mask, &cls_wire[1],
cls_lib->state.mask_len);
- cls_lib->labels = next_block(&ptr_lib, cls_lib->num_buttons * sizeof(Atom));
+ cls_lib->labels = next_block(&ptr_lib, labels_size);
atoms =(uint32_t*)((char*)&cls_wire[1] + cls_lib->state.mask_len);
for (j = 0; j < cls_lib->num_buttons; j++)
cls_lib->labels[j] = *atoms++;
@@ -1578,15 +1637,18 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
{
XIKeyClassInfo *cls_lib;
xXIKeyInfo *cls_wire;
+ int struct_size;
+ int keycodes_size;
- cls_lib = next_block(&ptr_lib, sizeof(XIKeyClassInfo));
cls_wire = (xXIKeyInfo*)any_wire;
+ sizeXIKeyClassType(cls_wire->num_keycodes,
+ &struct_size, &keycodes_size);
+ cls_lib = next_block(&ptr_lib, struct_size);
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));
+ cls_lib->keycodes = next_block(&ptr_lib, keycodes_size);
memcpy(cls_lib->keycodes, &cls_wire[1],
cls_lib->num_keycodes);
@@ -1598,7 +1660,9 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
XIValuatorClassInfo *cls_lib;
xXIValuatorInfo *cls_wire;
- cls_lib = next_block(&ptr_lib, sizeof(XIValuatorClassInfo));
+ cls_lib =
+ next_block(&ptr_lib,
+ sizeDeviceClassType(XIValuatorClass, 0));
cls_wire = (xXIValuatorInfo*)any_wire;
cls_lib->type = cls_wire->type;
@@ -1620,7 +1684,9 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
XIScrollClassInfo *cls_lib;
xXIScrollInfo *cls_wire;
- cls_lib = next_block(&ptr_lib, sizeof(XIScrollClassInfo));
+ cls_lib =
+ next_block(&ptr_lib,
+ sizeDeviceClassType(XIScrollClass, 0));
cls_wire = (xXIScrollInfo*)any_wire;
cls_lib->type = cls_wire->type;
commit 34964b05c16161de65709d60799b9ad97ce56296
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri Jan 27 15:35:44 2012 +1000
libXi 1.5.99.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index 46f2fb8..77341da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([libXi], [1.5.99.2],
+AC_INIT([libXi], [1.5.99.3],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXi])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([src/config.h])
commit b355b7300235395717de06809ee6631ce55d3189
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri Jan 27 13:28:52 2012 +1000
Handle new XIAllowEvent request size
inputproto 2.1.99.6 restored the previous request for ABI compatibility
reasons, and it introduced a new XI 2.2 specific define.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
diff --git a/configure.ac b/configure.ac
index 481cf44..46f2fb8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,7 +28,7 @@ XORG_WITH_ASCIIDOC(8.4.5)
XORG_CHECK_MALLOC_ZERO
# Obtain compiler/linker options for dependencies
-PKG_CHECK_MODULES(XI, [xproto >= 7.0.13] [x11 >= 1.4.99.1] [xextproto >= 7.0.3] [xext >= 1.0.99.1] [inputproto >= 2.1.99.3])
+PKG_CHECK_MODULES(XI, [xproto >= 7.0.13] [x11 >= 1.4.99.1] [xextproto >= 7.0.3] [xext >= 1.0.99.1] [inputproto >= 2.1.99.6])
# Check for xmlto and asciidoc for man page conversion
# (only needed by people building tarballs)
diff --git a/src/XIAllowEvents.c b/src/XIAllowEvents.c
index d987549..c8d997a 100644
--- a/src/XIAllowEvents.c
+++ b/src/XIAllowEvents.c
@@ -33,13 +33,16 @@
#include <X11/extensions/extutil.h>
#include "XIint.h"
+/* for GetRequest() to work */
+#define X_XI2_2AllowEvents X_XIAllowEvents
+
static Status
_XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time,
unsigned int touchid, Window grab_window)
{
Bool have_XI22 = True;
- int req_len = sz_xXIAllowEventsReq; /* in bytes */
xXIAllowEventsReq *req;
+ xXI2_2AllowEventsReq *req_XI22;
XExtDisplayInfo *extinfo = XInput_find_display(dpy);
@@ -47,13 +50,15 @@ _XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time,
if (_XiCheckExtInit(dpy, XInput_2_0, extinfo) == -1)
return (NoSuchExtension);
- /* 2.2's XIAllowEvents is 8 bytes longer than 2.0 */
- if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == -1) {
- req_len -= 8;
- have_XI22 = False;
- }
+ if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == 0)
+ have_XI22 = True;
- GetReqSized(XIAllowEvents, req_len, req);
+ if (have_XI22)
+ {
+ GetReq(XI2_2AllowEvents, req_XI22);
+ req = (xXIAllowEventsReq*)req_XI22;
+ } else
+ GetReq(XIAllowEvents, req);
req->reqType = extinfo->codes->major_opcode;
req->ReqType = X_XIAllowEvents;
@@ -62,8 +67,8 @@ _XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time,
req->time = time;
if (have_XI22) {
- req->touchid = touchid;
- req->grab_window = grab_window;
+ req_XI22->touchid = touchid;
+ req_XI22->grab_window = grab_window;
}
UnlockDisplay(dpy);
commit 07ced7b48219e3bc0c98806f3d7106f86d1b2ca0
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue Jan 17 21:26:14 2012 +0100
Force class alignment to a multiple of sizeof(XID).
Calculate length field to a multiples of sizeof(XID). XIDs are typedefs
to ulong and thus may be 8 bytes on some platforms. This can trigger a
SIGBUS if a class ends up not being 8-aligned (e.g. after XAxisInfo).
Reported-by: Nicolai Stange <nicolai.stange@zmaw.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
diff --git a/src/XListDev.c b/src/XListDev.c
index 6a16da4..6b91238 100644
--- a/src/XListDev.c
+++ b/src/XListDev.c
@@ -61,6 +61,17 @@ SOFTWARE.
#include <X11/extensions/extutil.h>
#include "XIint.h"
+/* Calculate length field to a multiples of sizeof(XID). XIDs are typedefs
+ * to ulong and thus may be 8 bytes on some platforms. This can trigger a
+ * SIGBUS if a class ends up not being 8-aligned (e.g. after XAxisInfo).
+ */
+static int pad_to_xid(int base_size)
+{
+ int padsize = sizeof(XID);
+
+ return ((base_size + padsize - 1)/padsize) * padsize;
+}
+
static int
SizeClassInfo(xAnyClassPtr *any, int num_classes)
{
@@ -69,18 +80,18 @@ SizeClassInfo(xAnyClassPtr *any, int num_classes)
for (j = 0; j < num_classes; j++) {
switch ((*any)->class) {
case KeyClass:
- size += sizeof(XKeyInfo);
+ size += pad_to_xid(sizeof(XKeyInfo));
break;
case ButtonClass:
- size += sizeof(XButtonInfo);
+ size += pad_to_xid(sizeof(XButtonInfo));
break;
case ValuatorClass:
{
xValuatorInfoPtr v;
v = (xValuatorInfoPtr) *any;
- size += sizeof(XValuatorInfo) +
- (v->num_axes * sizeof(XAxisInfo));
+ size += pad_to_xid(sizeof(XValuatorInfo) +
+ (v->num_axes * sizeof(XAxisInfo)));
break;
}
default:
@@ -105,7 +116,7 @@ ParseClassInfo(xAnyClassPtr *any, XAnyClassPtr *Any, int num_classes)
xKeyInfoPtr k = (xKeyInfoPtr) *any;
K->class = KeyClass;
- K->length = sizeof(XKeyInfo);
+ K->length = pad_to_xid(sizeof(XKeyInfo));
K->min_keycode = k->min_keycode;
K->max_keycode = k->max_keycode;
K->num_keys = k->num_keys;
@@ -117,7 +128,7 @@ ParseClassInfo(xAnyClassPtr *any, XAnyClassPtr *Any, int num_classes)
xButtonInfoPtr b = (xButtonInfoPtr) *any;
B->class = ButtonClass;
- B->length = sizeof(XButtonInfo);
+ B->length = pad_to_xid(sizeof(XButtonInfo));
B->num_buttons = b->num_buttons;
break;
}
@@ -129,8 +140,8 @@ ParseClassInfo(xAnyClassPtr *any, XAnyClassPtr *Any, int num_classes)
xAxisInfoPtr a;
V->class = ValuatorClass;
- V->length = sizeof(XValuatorInfo) +
- (v->num_axes * sizeof(XAxisInfo));
+ V->length = pad_to_xid(sizeof(XValuatorInfo) +
+ (v->num_axes * sizeof(XAxisInfo)));
V->num_axes = v->num_axes;
V->motion_buffer = v->motion_buffer_size;
V->mode = v->mode;
commit 15feb92b30e13e7439a3434bea9f454645b97444
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Jan 5 13:55:41 2012 +1000
man: fix typo Mappiing → Mapping
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/man/XSelectExtensionEvent.txt b/man/XSelectExtensionEvent.txt
index cbcfffe..95e0ac7 100644
--- a/man/XSelectExtensionEvent.txt
+++ b/man/XSelectExtensionEvent.txt
@@ -86,7 +86,7 @@ DESCRIPTION
defined macros include DeviceKeyPress, DeviceKeyRelease,
DeviceButtonPress, DeviceButtonRelese, DeviceMotionNotify,
DeviceFocusIn, DeviceFocusOut, ProximityIn, ProximityOut,
- DeviceStateNotify, DeviceMappiingNotify, ChangeDeviceNotify,
+ DeviceStateNotify, DeviceMappingNotify, ChangeDeviceNotify,
DevicePointerMotionHint, DeviceButton1Motion,
DeviceButton2Motion, DeviceButton3Motion, DeviceButton4Motion,
DeviceButton5Motion, DeviceButtonMotion, DeviceOwnerGrabButton,
commit 8576ae6b9ee974829e2fb8a834087652a6e9e1a2
Author: Cyril Brulebois <kibi@debian.org>
Date: Thu Dec 22 15:50:47 2011 +0100
configure.ac: Fix a typo in comments.
Signed-off-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index 79ba97e..481cf44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,7 +27,7 @@ XORG_CHECK_SGML_DOCTOOLS(1.8)
XORG_WITH_ASCIIDOC(8.4.5)
XORG_CHECK_MALLOC_ZERO
-# Obtain compiler/linker options for depedencies
+# Obtain compiler/linker options for dependencies
PKG_CHECK_MODULES(XI, [xproto >= 7.0.13] [x11 >= 1.4.99.1] [xextproto >= 7.0.3] [xext >= 1.0.99.1] [inputproto >= 2.1.99.3])
# Check for xmlto and asciidoc for man page conversion
commit ae0187c8708d2378373889827117911086581fdd
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Dec 22 09:42:43 2011 +1000
libXi 1.5.99.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index 0a7bdfa..79ba97e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([libXi], [1.5.99.1],
+AC_INIT([libXi], [1.5.99.2],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXi])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([src/config.h])
commit 82a631263ef4e6f46c1f33748089db8bf603b095
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed Dec 21 15:33:17 2011 +1000
libXi 1.5.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index 10d2e5d..46329b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([libXi], [1.4.99.1],
+AC_INIT([libXi], [1.5.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXi])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([src/config.h])
commit e73e2fe95dab3e0048b24d16327adbe54326ff3f
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed Sep 14 22:33:57 2011 -0700
Implement support for XI 2.2
Adds support for the new TouchClass for multitouch-capable servers/devices.
New events:
XITouchOwnershipEvent
New event types handled:
XITouchBegin, XITouchUpdate, XITouchEnd
XIRawTouchBegin, XIRawTouchUpdate, XIRawTouchEnd
New functions:
XIGrabTouchBegin ... passive grabs on touches
XIUngrabTouchBegin
XIAllowTouchEvents ... Allow/reject touch event sequences
New XIQueryDevice classes:
XITouchClassInfo
Requires libX11 1.5 for GetReqSized
Co-authored by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index c6565a8..0a7bdfa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,7 +28,7 @@ XORG_WITH_ASCIIDOC(8.4.5)
XORG_CHECK_MALLOC_ZERO
# Obtain compiler/linker options for depedencies
-PKG_CHECK_MODULES(XI, [xproto >= 7.0.13] [x11 >= 1.2.99.1] [xextproto >= 7.0.3] [xext >= 1.0.99.1] [inputproto >= 2.0.99.1])
+PKG_CHECK_MODULES(XI, [xproto >= 7.0.13] [x11 >= 1.4.99.1] [xextproto >= 7.0.3] [xext >= 1.0.99.1] [inputproto >= 2.1.99.3])
# Check for xmlto and asciidoc for man page conversion
# (only needed by people building tarballs)
diff --git a/include/X11/extensions/XInput2.h b/include/X11/extensions/XInput2.h
index 910b25f..26de695 100644
--- a/include/X11/extensions/XInput2.h
+++ b/include/X11/extensions/XInput2.h
@@ -146,6 +146,14 @@ typedef struct
typedef struct
{
+ int type;
+ int sourceid;
+ int mode;
+ int num_touches;
+} XITouchClassInfo;
+
+typedef struct
+{
int deviceid;
char *name;
int use;
@@ -303,6 +311,23 @@ typedef struct {
int what;
} XIPropertyEvent;
+typedef struct {
+ int type; /* GenericEvent */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* XI extension offset */
+ int evtype;
+ Time time;
+ int deviceid;
+ int sourceid;
+ unsigned int touchid;
+ Window root;
+ Window event;
+ Window child;
+ int flags;
+} XITouchOwnershipEvent;
+
_XFUNCPROTOBEGIN
extern Bool XIQueryPointer(
@@ -426,6 +451,14 @@ extern Status XIAllowEvents(
Time time
);
+extern Status XIAllowTouchEvents(
+ Display* display,
+ int deviceid,
+ unsigned int touchid,
+ Window grab_window,
+ int event_mode
+);
+
extern int XIGrabButton(
Display* display,
int deviceid,
@@ -477,6 +510,17 @@ extern int XIGrabFocusIn(
int num_modifiers,
XIGrabModifiers *modifiers_inout
);
+
+extern int XIGrabTouchBegin(
+ Display* display,
+ int deviceid,
+ Window grab_window,
+ int owner_events,
+ XIEventMask *mask,
+ int num_modifiers,
+ XIGrabModifiers *modifiers_inout
+);
+
extern Status XIUngrabButton(
Display* display,
int deviceid,
@@ -511,6 +555,13 @@ extern Status XIUngrabFocusIn(
XIGrabModifiers *modifiers
);
+extern Status XIUngrabTouchBegin(
+ Display* display,
+ int deviceid,
+ Window grab_window,
+ int num_modifiers,
+ XIGrabModifiers *modifiers
+);
extern Atom *XIListProperties(
Display* display,
diff --git a/man/XIGrabButton.txt b/man/XIGrabButton.txt
index 45ac25e..a046ac7 100644
--- a/man/XIGrabButton.txt
+++ b/man/XIGrabButton.txt
@@ -49,6 +49,20 @@ SYNOPSIS
int num_modifiers,
XIGrabModifiers *modifiers);
+ int XIGrabTouchBegin( Display *display,
+ int deviceid,
+ Window grab_window,
+ Bool owner_events,
+ XIEventMask *mask,
+ int num_modifiers,
+ XIGrabModifiers *modifiers_inout);
+
+ int XIUngrabTouchBegin( Display *display,
+ int deviceid,
+ Window grab_window,
+ int num_modifiers,
+ XIGrabModifiers *modifiers);
+
display
Specifies the connection to the X server.
Reply to: