xfree86: Add scroll axes to touch devices in inputtest driver
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
parent
91a8013990
commit
58465a3dd9
|
@ -61,9 +61,11 @@ The valuators are initialized in the same way as for \fBPointerAbsolute\fR type.
|
||||||
.IP
|
.IP
|
||||||
.BI Touch
|
.BI Touch
|
||||||
Initializes a touch device.
|
Initializes a touch device.
|
||||||
It will have 3 valuators: an "Abs MT Position X" at axis 0,
|
It will have 5 valuators: an "Abs MT Position X" at axis 0,
|
||||||
an "Abs MT Position Y" valuator at axis 1 and an "Abs MT Pressure" valuator
|
an "Abs MT Position Y" valuator at axis 1,
|
||||||
at axis 2.
|
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
|
.TP 7
|
||||||
.BI "Option \*qTouchCount\*q \*q" int \*q
|
.BI "Option \*qTouchCount\*q \*q" int \*q
|
||||||
Sets the maximum number of simultaneous touches for touch devices.
|
Sets the maximum number of simultaneous touches for touch devices.
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#include "xf86-input-inputtest-protocol.h"
|
#include "xf86-input-inputtest-protocol.h"
|
||||||
|
|
||||||
#define MAX_POINTER_NUM_AXES 5 /* x, y, hscroll, vscroll, [pressure] */
|
#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_MAX_SLOTS 15
|
||||||
|
|
||||||
#define TOUCH_AXIS_MAX 0xffff
|
#define TOUCH_AXIS_MAX 0xffff
|
||||||
|
@ -287,16 +287,6 @@ init_button_labels(Atom *labels, size_t size)
|
||||||
labels[10] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_BACK);
|
labels[10] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_BACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
static void
|
||||||
init_pointer(InputInfoPtr pInfo)
|
init_pointer(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
|
@ -439,13 +429,19 @@ init_touch(InputInfoPtr pInfo)
|
||||||
int min, max, res;
|
int min, max, res;
|
||||||
unsigned char btnmap[MAX_BUTTONS + 1];
|
unsigned char btnmap[MAX_BUTTONS + 1];
|
||||||
Atom btnlabels[MAX_BUTTONS];
|
Atom btnlabels[MAX_BUTTONS];
|
||||||
Atom axislabels[TOUCH_NUM_AXES];
|
Atom axislabels[MAX_TOUCH_NUM_AXES];
|
||||||
|
int num_axes = 0;
|
||||||
int nbuttons = 7;
|
int nbuttons = 7;
|
||||||
int ntouches = TOUCH_MAX_SLOTS;
|
int ntouches = TOUCH_MAX_SLOTS;
|
||||||
|
|
||||||
init_button_map(btnmap, ARRAY_SIZE(btnmap));
|
init_button_map(btnmap, ARRAY_SIZE(btnmap));
|
||||||
init_button_labels(btnlabels, ARRAY_SIZE(btnlabels));
|
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,
|
InitPointerDeviceStruct((DevicePtr)dev,
|
||||||
btnmap,
|
btnmap,
|
||||||
|
@ -453,7 +449,7 @@ init_touch(InputInfoPtr pInfo)
|
||||||
btnlabels,
|
btnlabels,
|
||||||
ptr_ctl,
|
ptr_ctl,
|
||||||
GetMotionHistorySize(),
|
GetMotionHistorySize(),
|
||||||
TOUCH_NUM_AXES,
|
num_axes,
|
||||||
axislabels);
|
axislabels);
|
||||||
min = 0;
|
min = 0;
|
||||||
max = TOUCH_AXIS_MAX;
|
max = TOUCH_AXIS_MAX;
|
||||||
|
@ -465,7 +461,11 @@ init_touch(InputInfoPtr pInfo)
|
||||||
xf86InitValuatorAxisStruct(dev, 1,
|
xf86InitValuatorAxisStruct(dev, 1,
|
||||||
XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_Y),
|
XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_Y),
|
||||||
min, max, res * 1000, 0, res * 1000, Absolute);
|
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),
|
XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_PRESSURE),
|
||||||
min, TABLET_PRESSURE_AXIS_MAX, res * 1000, 0, res * 1000, Absolute);
|
min, TABLET_PRESSURE_AXIS_MAX, res * 1000, 0, res * 1000, Absolute);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue