diff options
author | Chase Douglas <chase.douglas@canonical.com> | 2010-09-20 15:03:08 +1000 |
---|---|---|
committer | Chase Douglas <chase.douglas@canonical.com> | 2010-11-22 14:01:21 -0500 |
commit | 98fc16c703222a7af27e21a7685041e9e0934d12 (patch) | |
tree | c2d83143f89d78999ef1031fc887640e7901fdf6 | |
parent | 549dd5f470148df74e65ce7bb1af316a2848a71d (diff) |
Add multitouch support from Xi 2.1xi2.1-new
Add support to libXi for touch events.
Based on an initial patch by Daniel Stone.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | include/X11/extensions/XInput2.h | 19 | ||||
-rw-r--r-- | src/XExtInt.c | 47 |
3 files changed, 67 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 0a4b384..173537a 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl Process this file with autoconf to create configure. AC_PREREQ([2.60]) -AC_INIT(libXi, 1.4.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXi) +AC_INIT(libXi, 1.4.99.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXi) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE @@ -24,7 +24,7 @@ AC_PROG_LIBTOOL AC_PROG_SED # Checks for pkg-config packages -PKG_CHECK_MODULES(XI, [xproto >= 7.0.13] [x11 >= 1.2.99.1] [xextproto >= 7.0.3] [xext >= 1.0.99.1] [inputproto >= 1.9.99.902]) +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]) # 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 e6c7b30..05df3fc 100644 --- a/include/X11/extensions/XInput2.h +++ b/include/X11/extensions/XInput2.h @@ -135,6 +135,25 @@ typedef struct typedef struct { + int type; + int sourceid; + int mode; + int num_touches; +} XITouchClassInfo; + +typedef struct +{ + int type; + int sourceid; + int number; + Atom label; + double min; + double max; + int resolution; +} XITouchValuatorClassInfo; + +typedef struct +{ int deviceid; char *name; int use; diff --git a/src/XExtInt.c b/src/XExtInt.c index eed6637..a1ade31 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -268,7 +268,8 @@ static XExtensionVersion versions[] = { {XI_Absent, 0, 0}, XI_Add_DevicePresenceNotify_Minor}, {XI_Present, XI_Add_DeviceProperties_Major, XI_Add_DeviceProperties_Minor}, -{XI_Present, XI_2_Major, XI_2_Minor} +{XI_Present, XI_2_Major, XI_2_Minor}, +{XI_Present, XI_2_Major, XI_2_1_Minor} }; /*********************************************************************** @@ -924,6 +925,9 @@ XInputWireToCookie( case XI_ButtonRelease: case XI_KeyPress: case XI_KeyRelease: + case XI_TouchBegin: + case XI_TouchMotion: + case XI_TouchEnd: *cookie = *(XGenericEventCookie*)save; if (!wireToDeviceEvent((xXIDeviceEvent*)event, cookie)) { @@ -1037,6 +1041,12 @@ sizeDeviceClassType(int type, int num_elements) case XIValuatorClass: l = sizeof(XIValuatorClassInfo); break; + case XITouchClass: + l = sizeof(XITouchClassInfo); + break; + case XITouchValuatorClass: + l = sizeof(XITouchValuatorClassInfo); + break; default: printf("sizeDeviceClassType: unknown type %d\n", type); break; @@ -1426,6 +1436,12 @@ size_classes(xXIAnyInfo* from, int nclasses) case XIValuatorClass: l = sizeDeviceClassType(XIValuatorClass, 0); break; + case XITouchClass: + l = sizeDeviceClassType(XITouchClass, 0); + break; + case XITouchValuatorClass: + l = sizeDeviceClassType(XITouchValuatorClass, 0); + break; } len += l; @@ -1526,6 +1542,35 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses) } break; + case XITouchClass: + { + XITouchClassInfo *cls_lib; + xXITouchInfo *cls_wire; + + cls_wire = (xXITouchInfo*)any_wire; + cls_lib = next_block(&ptr_lib, sizeof(XITouchClassInfo)); + + cls_lib->mode = cls_wire->mode; + cls_lib->num_touches = cls_wire->num_touches; + } + break; + case XITouchValuatorClass: + { + XITouchValuatorClassInfo *cls_lib; + xXITouchValuatorInfo *cls_wire; + + cls_wire = (xXITouchValuatorInfo*)any_wire; + cls_lib = next_block(&ptr_lib, + sizeof(XITouchValuatorClassInfo)); + + cls_lib->number = cls_wire->number; + cls_lib->label = cls_wire->label; + /* FIXME: fractional parts */ + cls_lib->min = cls_wire->min.integral; + cls_lib->max = cls_wire->max.integral; + cls_lib->resolution = cls_wire->resolution; + } + break; } len += any_wire->length * 4; ptr_wire += any_wire->length * 4; |