Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Povilas Kanapickas
xserver
Commits
58465a3d
Commit
58465a3d
authored
Dec 17, 2020
by
Povilas Kanapickas
Browse files
xfree86: Add scroll axes to touch devices in inputtest driver
Signed-off-by:
Povilas Kanapickas
<
povilas@radix.lt
>
parent
91a80139
Pipeline
#245124
passed with stages
in 3 minutes and 52 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
hw/xfree86/drivers/inputtest/inputtestdrv.man
View file @
58465a3d
...
...
@@ -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.
...
...
hw/xfree86/drivers/inputtest/xf86-input-inputtest.c
View file @
58465a3d
...
...
@@ -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
...
...
@@ -287,16 +287,6 @@ init_button_labels(Atom *labels, size_t size)
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
init_pointer
(
InputInfoPtr
pInfo
)
{
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment