x, y in struct _SynapticsSHM is ABS_X, ABS_Y, why not ABS_MT_POSITION_X, ABS_MT_POSITION_Y?
Leslie Zhai
xiangzhai83 at gmail.com
Sat Jan 4 00:25:51 PST 2014
Hi xorg developers,
in xserver-xorg-input-synaptics-1.6.2/include/synaptics.h
the struct _SynapticsSHM is shown as below:
```
typedef struct _SynapticsSHM {
int version; /* Driver version */
/* Current device state */
int x, y; /* actual x, y coordinates */
int z; /* pressure value */
int numFingers; /* number of fingers */
int fingerWidth; /* finger width value */
int left, right, up, down; /* left/right/up/down buttons */
Bool multi[8];
Bool middle;
} SynapticsSHM;
```
there are x and y, because I want to know what they are, then read about
src/eventcomm.c
```
if (ev.code < ABS_MT_SLOT) {
switch (ev.code) {
case ABS_X:
hw->x = apply_st_scaling(proto_data, ev.value, 0);
break;
case ABS_Y:
hw->y = apply_st_scaling(proto_data, ev.value, 1);
break;
case ABS_PRESSURE:
hw->z = ev.value;
break;
case ABS_TOOL_WIDTH:
hw->fingerWidth = ev.value;
break;
}
}
```
Why use ABS_X for hw->x?
I want to recognize multi-touch gesture, such as zoom in/out, with
ABS_MT_SLOT, ABS_MT_POSITION_X and ABS_MT_POSITION_Y based on Linux
Multi-touch (MT) Protocol.
But struct _SynapticsSHM only provides ABS_X and ABS_Y, even there is
numFingers, it is still unable to distinguish which finger touching the
point1, point2 or pointN...
So I hacked the struct _SynapticsSHM, added int slot, mt_x, mt_y, shown
as below:
```
typedef struct _SynapticsSHM {
int version; /* Driver version */
/* Current device state */
int x, y; /* actual x, y coordinates */
int z; /* pressure value */
int numFingers; /* number of fingers */
int fingerWidth; /* finger width value */
int left, right, up, down; /* left/right/up/down buttons */
Bool multi[8];
Bool middle;
int slot;
int mt_x;
int mt_y;
} SynapticsSHM;
```
and also hacked src/eventcomm.c, using ABS_MT_POSITION_X for mt_x, shown
as below:
```
case EV_ABS:
if (ev.code == ABS_MT_SLOT)
hw->slot = ev.value;
if (ev.code == ABS_MT_POSITION_X)
hw->mt_x = ev.value;
if (ev.code == ABS_MT_POSITION_Y)
hw->mt_y = ev.value;
```
Then I can use slot, mt_x, mt_y to recognize multi-touch gesture such as
zoom in, rotate ... but that is hacking way, perhaps there are some
synaptics developers already considered about multi-touch gesture
recognization requirement, it might be in TODO list.
Please someone give me some advice, thanks a lot!
Leslie Zhai
More information about the xorg-devel
mailing list