diff options
author | Povilas Kanapickas <povilas@radix.lt> | 2020-12-17 03:08:06 +0200 |
---|---|---|
committer | Povilas Kanapickas <povilas@radix.lt> | 2020-12-17 03:11:16 +0200 |
commit | 58465a3dd90c3bc698ba9ebb2c4a516df6ff7dfd (patch) | |
tree | c1ad72cd8269d2b389f0d3dc384e768353bb285c /hw/xfree86/drivers | |
parent | 91a8013990a967bfd8c4145c4a79b86cc495a205 (diff) |
xfree86: Add scroll axes to touch devices in inputtest driver
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
Diffstat (limited to 'hw/xfree86/drivers')
-rw-r--r-- | hw/xfree86/drivers/inputtest/inputtestdrv.man | 8 | ||||
-rw-r--r-- | hw/xfree86/drivers/inputtest/xf86-input-inputtest.c | 30 |
2 files changed, 20 insertions, 18 deletions
diff --git a/hw/xfree86/drivers/inputtest/inputtestdrv.man b/hw/xfree86/drivers/inputtest/inputtestdrv.man index 4741783d5..566e4f35a 100644 --- a/hw/xfree86/drivers/inputtest/inputtestdrv.man +++ b/hw/xfree86/drivers/inputtest/inputtestdrv.man @@ -61,9 +61,11 @@ The valuators are initialized in the same way as for \fBPointerAbsolute\fR type. .IP .BI Touch Initializes a touch device. -It will have 3 valuators: an "Abs MT Position X" at axis 0, -an "Abs MT Position Y" valuator at axis 1 and an "Abs MT Pressure" valuator -at axis 2. +It will have 5 valuators: an "Abs MT Position X" at axis 0, +an "Abs MT Position Y" valuator at axis 1, +a horizontal scroll valuator on axis 2, +a vertical scroll valuator on axis 3 and an "Abs MT Pressure" valuator +at axis 4. .TP 7 .BI "Option \*qTouchCount\*q \*q" int \*q Sets the maximum number of simultaneous touches for touch devices. diff --git a/hw/xfree86/drivers/inputtest/xf86-input-inputtest.c b/hw/xfree86/drivers/inputtest/xf86-input-inputtest.c index b2cc14e8c..02fbba142 100644 --- a/hw/xfree86/drivers/inputtest/xf86-input-inputtest.c +++ b/hw/xfree86/drivers/inputtest/xf86-input-inputtest.c @@ -48,7 +48,7 @@ #include "xf86-input-inputtest-protocol.h" #define MAX_POINTER_NUM_AXES 5 /* x, y, hscroll, vscroll, [pressure] */ -#define TOUCH_NUM_AXES 4 /* x, y, hscroll, vscroll */ +#define MAX_TOUCH_NUM_AXES 5 /* x, y, hscroll, vscroll, pressure */ #define TOUCH_MAX_SLOTS 15 #define TOUCH_AXIS_MAX 0xffff @@ -288,16 +288,6 @@ init_button_labels(Atom *labels, size_t size) } static void -init_axis_labels(Atom *labels, size_t size) -{ - memset(labels, 0, size * sizeof(Atom)); - labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); - labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); - labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HSCROLL); - labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_VSCROLL); -} - -static void init_pointer(InputInfoPtr pInfo) { DeviceIntPtr dev= pInfo->dev; @@ -439,13 +429,19 @@ init_touch(InputInfoPtr pInfo) int min, max, res; unsigned char btnmap[MAX_BUTTONS + 1]; Atom btnlabels[MAX_BUTTONS]; - Atom axislabels[TOUCH_NUM_AXES]; + Atom axislabels[MAX_TOUCH_NUM_AXES]; + int num_axes = 0; int nbuttons = 7; int ntouches = TOUCH_MAX_SLOTS; init_button_map(btnmap, ARRAY_SIZE(btnmap)); init_button_labels(btnlabels, ARRAY_SIZE(btnlabels)); - init_axis_labels(axislabels, ARRAY_SIZE(axislabels)); + + axislabels[num_axes++] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_X); + axislabels[num_axes++] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_Y); + axislabels[num_axes++] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HSCROLL); + axislabels[num_axes++] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_VSCROLL); + axislabels[num_axes++] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_PRESSURE); InitPointerDeviceStruct((DevicePtr)dev, btnmap, @@ -453,7 +449,7 @@ init_touch(InputInfoPtr pInfo) btnlabels, ptr_ctl, GetMotionHistorySize(), - TOUCH_NUM_AXES, + num_axes, axislabels); min = 0; max = TOUCH_AXIS_MAX; @@ -465,7 +461,11 @@ init_touch(InputInfoPtr pInfo) xf86InitValuatorAxisStruct(dev, 1, XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_Y), min, max, res * 1000, 0, res * 1000, Absolute); - xf86InitValuatorAxisStruct(dev, 2, + + SetScrollValuator(dev, 2, SCROLL_TYPE_HORIZONTAL, 15, 0); + SetScrollValuator(dev, 3, SCROLL_TYPE_VERTICAL, 15, 0); + + xf86InitValuatorAxisStruct(dev, 4, XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_PRESSURE), min, TABLET_PRESSURE_AXIS_MAX, res * 1000, 0, res * 1000, Absolute); |