Skip to content

Commit 5183b45

Browse files
committed
tslib.c: add pressure valuator axis
With supported values from 0 to 255.
1 parent 82271a0 commit 5183b45

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/tslib.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
#define TOUCH_MAX_SLOTS 10 /* fallback if not found */
6969
#define TOUCH_SAMPLES_READ 3 /* up to, if available */
7070
#define MAXBUTTONS 11 /* > 10 */
71-
#define TOUCH_NUM_AXES 2 /* x, y */
71+
#define TOUCH_NUM_AXES 3 /* x, y, pressure */
7272

7373
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23
7474
#define HAVE_THREADED_INPUT 1
@@ -120,6 +120,7 @@ static void ReadInputLegacy(InputInfoPtr local)
120120
if (type != XI_TouchEnd) {
121121
valuator_mask_set_double(m, 0, samp.x);
122122
valuator_mask_set_double(m, 1, samp.y);
123+
valuator_mask_set_double(m, 2, samp.pressure);
123124
}
124125

125126
xf86PostTouchEvent(local->dev, 0, type, 0, m);
@@ -155,6 +156,7 @@ static void ReadHandleMTSample(InputInfoPtr local, int nr, int slot)
155156
if (type != XI_TouchEnd) {
156157
valuator_mask_set_double(m, 0, priv->samp_mt[nr][slot].x);
157158
valuator_mask_set_double(m, 1, priv->samp_mt[nr][slot].y);
159+
valuator_mask_set_double(m, 2, priv->samp_mt[nr][slot].pressure);
158160
}
159161

160162
xf86PostTouchEvent(local->dev, priv->touchids[slot], type, 0, m);
@@ -288,6 +290,15 @@ static int xf86TslibControlProc(DeviceIntPtr device, int what)
288290
0, /* min_res */
289291
priv->height, /* max_res */
290292
Absolute);
293+
294+
InitValuatorAxisStruct(device, 2,
295+
XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE),
296+
0, /* min val */
297+
255, /* max val */
298+
256, /* resolution */
299+
0, /* min_res */
300+
256, /* max_res */
301+
Absolute);
291302
} else {
292303
InitValuatorAxisStruct(device, 0,
293304
XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_X),
@@ -306,6 +317,15 @@ static int xf86TslibControlProc(DeviceIntPtr device, int what)
306317
0, /* min_res */
307318
priv->height, /* max_res */
308319
Absolute);
320+
321+
InitValuatorAxisStruct(device, 2,
322+
XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_PRESSURE),
323+
0, /* min val */
324+
255, /* max val */
325+
256, /* resolution */
326+
0, /* min_res */
327+
256, /* max_res */
328+
Absolute);
309329
}
310330

311331
if (InitTouchClassDeviceStruct(device,

0 commit comments

Comments
 (0)