packages/Xorg/driver/xf86-input-tslib/patches/030-xserver-1.7.patch
lars b35b2e9a6b Make tslib compile with xserver-1.7
git-svn-id: svn://svn.openwrt.org/openwrt/packages@18080 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-10-19 20:02:25 +00:00

92 lines
2.7 KiB
Diff

--- a/src/tslib.c
+++ b/src/tslib.c
@@ -49,6 +49,7 @@
#include <X11/keysym.h>
#include <mipointer.h>
#include <randrstr.h>
+#include <xserver-properties.h>
#include <tslib.h>
@@ -211,6 +212,15 @@ xf86TslibControlProc(DeviceIntPtr device, int what)
unsigned char map[MAXBUTTONS + 1];
int i;
struct ts_priv *priv;
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ Atom buttons[MAXBUTTONS];
+ Atom axes[2];
+
+ axes[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
+ axes[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
+
+ buttons[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+#endif
#ifdef DEBUG
ErrorF("%s\n", __FUNCTION__);
@@ -226,33 +236,45 @@ xf86TslibControlProc(DeviceIntPtr device, int what)
map[i + 1] = i + 1;
}
- if (InitButtonClassDeviceStruct(device,
- MAXBUTTONS, map) == FALSE) {
+ if (InitButtonClassDeviceStruct(device, MAXBUTTONS,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ buttons,
+#endif
+ map) == FALSE) {
ErrorF("unable to allocate Button class device\n");
return !Success;
}
- if (InitValuatorClassDeviceStruct(device,
- 2,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
- xf86GetMotionEvents,
+ if (InitValuatorClassDeviceStruct(device, 2,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ axes,
+#elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
+ xf86GetMotionEvents,
#endif
- 0, Absolute) == FALSE) {
+ 0, Absolute) == FALSE) {
ErrorF("unable to allocate Valuator class device\n");
return !Success;
}
- InitValuatorAxisStruct(device, 0, 0, /* min val */
- priv->width - 1, /* max val */
- priv->width, /* resolution */
- 0, /* min_res */
- priv->width); /* max_res */
-
- InitValuatorAxisStruct(device, 1, 0, /* min val */
- priv->height - 1,/* max val */
- priv->height, /* resolution */
- 0, /* min_res */
- priv->height); /* max_res */
+ InitValuatorAxisStruct(device, 0,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ axes[0],
+#endif
+ 0, /* min val */
+ priv->width - 1, /* max val */
+ priv->width, /* resolution */
+ 0, /* min_res */
+ priv->width); /* max_res */
+
+ InitValuatorAxisStruct(device, 1,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ axes[1],
+#endif
+ 0, /* min val */
+ priv->height - 1, /* max val */
+ priv->height, /* resolution */
+ 0, /* min_res */
+ priv->height); /* max_res */
if (InitProximityClassDeviceStruct (device) == FALSE) {
ErrorF ("Unable to allocate EVTouch touchscreen ProximityClassDeviceStruct\n");