Skip to content

Commit 064f82f

Browse files
committed
tslib.c: use axis_labels for valuator device
1 parent 0ef6f50 commit 064f82f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/tslib.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,21 @@ static void init_button_labels(Atom *labels, size_t size)
216216
labels[10] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_BACK);
217217
}
218218

219+
static void init_axis_labels(Atom *labels, size_t size)
220+
{
221+
assert(size >= 2);
222+
223+
memset(labels, 0, size * sizeof(Atom));
224+
labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_X);
225+
labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_Y);
226+
}
227+
219228
static int xf86TslibControlProc(DeviceIntPtr device, int what)
220229
{
221230
InputInfoPtr pInfo;
222231
unsigned char map[MAXBUTTONS + 1];
223232
Atom labels[MAXBUTTONS];
233+
Atom axis_labels[2];
224234
int i, axiswidth, axisheight;
225235
struct ts_priv *priv;
226236

@@ -239,6 +249,7 @@ static int xf86TslibControlProc(DeviceIntPtr device, int what)
239249
map[i + 1] = i + 1;
240250

241251
init_button_labels(labels, ARRAY_SIZE(labels));
252+
init_axis_labels(axis_labels, ARRAY_SIZE(axis_labels));
242253

243254
if (InitButtonClassDeviceStruct(device,
244255
MAXBUTTONS,
@@ -251,7 +262,7 @@ static int xf86TslibControlProc(DeviceIntPtr device, int what)
251262

252263
if (InitValuatorClassDeviceStruct(device,
253264
2,
254-
labels,
265+
axis_labels,
255266
0, Absolute) == FALSE) {
256267
xf86IDrvMsg(pInfo, X_ERROR,
257268
"unable to allocate Valuator class device\n");

0 commit comments

Comments
 (0)