Skip to content

Commit 4827c56

Browse files
committed
tslib.c: fix axis labels init
Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
1 parent 5183b45 commit 4827c56

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/tslib.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,6 @@ static void init_button_labels(Atom *labels, size_t size)
219219
labels[10] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_BACK);
220220
}
221221

222-
static void init_axis_labels(Atom *labels, size_t size)
223-
{
224-
assert(size >= TOUCH_NUM_AXES);
225-
226-
memset(labels, 0, size * sizeof(Atom));
227-
labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_X);
228-
labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_Y);
229-
}
230-
231222
static int xf86TslibControlProc(DeviceIntPtr device, int what)
232223
{
233224
InputInfoPtr pInfo;
@@ -252,7 +243,18 @@ static int xf86TslibControlProc(DeviceIntPtr device, int what)
252243
map[i + 1] = i + 1;
253244

254245
init_button_labels(labels, ARRAY_SIZE(labels));
255-
init_axis_labels(axis_labels, ARRAY_SIZE(axis_labels));
246+
247+
/* init axis labels */
248+
memset(axis_labels, 0, ARRAY_SIZE(axis_labels) * sizeof(Atom));
249+
if (priv->abs_x_only) {
250+
labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
251+
labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
252+
labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE);
253+
} else {
254+
labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_X);
255+
labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_Y);
256+
labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_PRESSURE);
257+
}
256258

257259
if (InitButtonClassDeviceStruct(device,
258260
MAXBUTTONS,

0 commit comments

Comments
 (0)