1 Fetch from: https://launchpad.net/ubuntu/+archive/primary/+files/xf86-input-tslib_0.0.6-7build3.debian.tar.gz
2 Fixes build against newer versions of xorg.
4 Signed-off-by: Jesper Baekdahl <jbb@gamblify.com>
6 Index: xf86-input-tslib-trunk/src/tslib.c
7 ===================================================================
8 --- xf86-input-tslib-trunk/src/tslib.c (revision 48)
9 +++ xf86-input-tslib-trunk/src/tslib.c (working copy)
11 #define DEFAULT_HEIGHT 240
12 #define DEFAULT_WIDTH 320
14 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
15 +#define COLLECT_INPUT_OPTIONS(pInfo, options) xf86CollectInputOptions((pInfo), (options), NULL)
17 +#define COLLECT_INPUT_OPTIONS(pInfo, options) xf86CollectInputOptions((pInfo), (options))
21 enum { TSLIB_ROTATE_NONE=0, TSLIB_ROTATE_CW=270, TSLIB_ROTATE_UD=180, TSLIB_ROTATE_CCW=90 };
23 enum button_state { BUTTON_NOT_PRESSED = 0, BUTTON_1_PRESSED = 1, BUTTON_3_CLICK = 3, BUTTON_3_CLICKED=4, BUTTON_EMULATION_OFF=-1 };
28 -ConvertProc( LocalDevicePtr local,
29 +ConvertProc( InputInfoPtr local,
37 -static void ReadInput (LocalDevicePtr local)
38 +static void ReadInput (InputInfoPtr local)
40 struct ts_priv *priv = (struct ts_priv *) (local->private);
41 struct ts_sample samp;
43 axiswidth - 1, /* max val */
44 axiswidth, /* resolution */
46 - axiswidth); /* max_res */
47 + axiswidth /* max_res */
48 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
53 InitValuatorAxisStruct(device, 1,
54 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
56 axisheight - 1, /* max val */
57 axisheight, /* resolution */
59 - axisheight); /* max_res */
60 + axisheight /* max_res */
61 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
66 if (InitProximityClassDeviceStruct (device) == FALSE) {
67 ErrorF ("Unable to allocate EVTouch touchscreen ProximityClassDeviceStruct\n");
69 ErrorF("%s\n", __FUNCTION__);
70 xf86TslibControlProc(pInfo->dev, DEVICE_OFF);
72 - xfree(pInfo->private);
73 + free(pInfo->private);
74 pInfo->private = NULL;
75 xf86DeleteInput(pInfo, 0);
79 * called when the module subsection is found in XF86Config
81 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
83 +xf86TslibInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
86 xf86TslibInit(InputDriverPtr drv, IDevPtr dev, int flags)
91 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
95 - priv = xcalloc (1, sizeof (struct ts_priv));
96 + priv = calloc (1, sizeof (struct ts_priv));
101 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
102 if (!(pInfo = xf86AllocateInput(drv, 0))) {
109 /* Initialise the InputInfoRec. */
110 pInfo->name = dev->identifier;
111 - pInfo->type_name = XI_TOUCHSCREEN;
113 XI86_KEYBOARD_CAPABLE | XI86_POINTER_CAPABLE |
114 XI86_SEND_DRAG_EVENTS;
115 - pInfo->device_control = xf86TslibControlProc;
116 - pInfo->read_input = ReadInput;
117 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
118 pInfo->motion_history_proc = xf86GetMotionEvents;
119 pInfo->history_size = 0;
121 - pInfo->control_proc = NULL;
122 + pInfo->conf_idev = dev;
123 pInfo->close_proc = NULL;
124 - pInfo->switch_mode = NULL;
125 pInfo->conversion_proc = ConvertProc;
126 pInfo->reverse_conversion_proc = NULL;
128 pInfo->private_flags = 0;
129 pInfo->always_core_feedback = 0;
130 - pInfo->conf_idev = dev;
133 + pInfo->type_name = XI_TOUCHSCREEN;
134 + pInfo->control_proc = NULL;
135 + pInfo->read_input = ReadInput;
136 + pInfo->device_control = xf86TslibControlProc;
137 + pInfo->switch_mode = NULL;
138 pInfo->private = priv;
141 /* Collect the options, and process the common options. */
142 - xf86CollectInputOptions(pInfo, NULL, NULL);
143 + COLLECT_INPUT_OPTIONS(pInfo, NULL);
144 xf86ProcessCommonOptions(pInfo, pInfo->options);
146 priv->screen_num = xf86SetIntOption(pInfo->options, "ScreenNumber", 0 );
147 @@ -510,23 +535,31 @@
148 priv->rotate = TSLIB_ROTATE_NONE;
151 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
152 s = xf86CheckStrOption(dev->commonOptions, "path", NULL);
154 + s = xf86CheckStrOption(pInfo->options, "path", NULL);
157 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
158 s = xf86CheckStrOption(dev->commonOptions, "Device", NULL);
160 + s = xf86CheckStrOption(pInfo->options, "Device", NULL);
163 priv->ts = ts_open(s, 1);
168 ErrorF("ts_open failed (device=%s)\n",s);
169 xf86DeleteInput(pInfo, 0);
174 if (ts_config(priv->ts)) {
175 ErrorF("ts_config failed\n");
176 xf86DeleteInput(pInfo, 0);
181 pInfo->fd = ts_fd(priv->ts);
182 @@ -536,11 +569,13 @@
183 priv->state = BUTTON_EMULATION_OFF;
186 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
187 /* Mark the device configured */
188 pInfo->flags |= XI86_CONFIGURED;
191 /* Return the configured device */
196 _X_EXPORT InputDriverRec TSLIB = {