--- a/src/tslib.c +++ b/src/tslib.c @@ -49,6 +49,7 @@ #include #include #include +#include #include @@ -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");