mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Cope with ABI_XINPUT_VERSION 7 - requires button + axes labels.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
52
src/evdev.c
52
src/evdev.c
@@ -1000,6 +1000,7 @@ EvdevAddAbsClass(DeviceIntPtr device)
|
|||||||
InputInfoPtr pInfo;
|
InputInfoPtr pInfo;
|
||||||
EvdevPtr pEvdev;
|
EvdevPtr pEvdev;
|
||||||
int num_axes, axis, i = 0;
|
int num_axes, axis, i = 0;
|
||||||
|
Atom *atoms;
|
||||||
|
|
||||||
pInfo = device->public.devicePrivate;
|
pInfo = device->public.devicePrivate;
|
||||||
pEvdev = pInfo->private;
|
pEvdev = pInfo->private;
|
||||||
@@ -1013,8 +1014,14 @@ EvdevAddAbsClass(DeviceIntPtr device)
|
|||||||
pEvdev->num_vals = num_axes;
|
pEvdev->num_vals = num_axes;
|
||||||
memset(pEvdev->vals, 0, num_axes * sizeof(int));
|
memset(pEvdev->vals, 0, num_axes * sizeof(int));
|
||||||
memset(pEvdev->old_vals, -1, num_axes * sizeof(int));
|
memset(pEvdev->old_vals, -1, num_axes * sizeof(int));
|
||||||
|
atoms = xalloc(pEvdev->num_vals * sizeof(Atom));
|
||||||
|
|
||||||
|
EvdevInitAxesLabels(pEvdev, pEvdev->num_vals, atoms);
|
||||||
|
|
||||||
if (!InitValuatorClassDeviceStruct(device, num_axes,
|
if (!InitValuatorClassDeviceStruct(device, num_axes,
|
||||||
|
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
|
||||||
|
atoms,
|
||||||
|
#endif
|
||||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
|
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
|
||||||
GetMotionHistory,
|
GetMotionHistory,
|
||||||
#endif
|
#endif
|
||||||
@@ -1026,7 +1033,7 @@ EvdevAddAbsClass(DeviceIntPtr device)
|
|||||||
if (!TestBit(axis, pEvdev->abs_bitmask))
|
if (!TestBit(axis, pEvdev->abs_bitmask))
|
||||||
continue;
|
continue;
|
||||||
pEvdev->axis_map[axis] = i;
|
pEvdev->axis_map[axis] = i;
|
||||||
xf86InitValuatorAxisStruct(device, i,
|
xf86InitValuatorAxisStruct(device, i, atoms[axis],
|
||||||
pEvdev->absinfo[axis].minimum,
|
pEvdev->absinfo[axis].minimum,
|
||||||
pEvdev->absinfo[axis].maximum,
|
pEvdev->absinfo[axis].maximum,
|
||||||
10000, 0, 10000);
|
10000, 0, 10000);
|
||||||
@@ -1035,6 +1042,8 @@ EvdevAddAbsClass(DeviceIntPtr device)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xfree(atoms);
|
||||||
|
|
||||||
if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc))
|
if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc))
|
||||||
return !Success;
|
return !Success;
|
||||||
|
|
||||||
@@ -1063,6 +1072,7 @@ EvdevAddRelClass(DeviceIntPtr device)
|
|||||||
InputInfoPtr pInfo;
|
InputInfoPtr pInfo;
|
||||||
EvdevPtr pEvdev;
|
EvdevPtr pEvdev;
|
||||||
int num_axes, axis, i = 0;
|
int num_axes, axis, i = 0;
|
||||||
|
Atom *atoms;
|
||||||
|
|
||||||
pInfo = device->public.devicePrivate;
|
pInfo = device->public.devicePrivate;
|
||||||
pEvdev = pInfo->private;
|
pEvdev = pInfo->private;
|
||||||
@@ -1085,8 +1095,26 @@ EvdevAddRelClass(DeviceIntPtr device)
|
|||||||
|
|
||||||
pEvdev->num_vals = num_axes;
|
pEvdev->num_vals = num_axes;
|
||||||
memset(pEvdev->vals, 0, num_axes * sizeof(int));
|
memset(pEvdev->vals, 0, num_axes * sizeof(int));
|
||||||
|
atoms = xalloc(pEvdev->num_vals * sizeof(Atom));
|
||||||
|
|
||||||
|
for (axis = REL_X; axis <= REL_MAX; axis++)
|
||||||
|
{
|
||||||
|
pEvdev->axis_map[axis] = -1;
|
||||||
|
/* We don't post wheel events, so ignore them here too */
|
||||||
|
if (axis == REL_WHEEL || axis == REL_HWHEEL || axis == REL_DIAL)
|
||||||
|
continue;
|
||||||
|
if (!TestBit(axis, pEvdev->rel_bitmask))
|
||||||
|
continue;
|
||||||
|
pEvdev->axis_map[axis] = i;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
EvdevInitAxesLabels(pEvdev, pEvdev->num_vals, atoms);
|
||||||
|
|
||||||
if (!InitValuatorClassDeviceStruct(device, num_axes,
|
if (!InitValuatorClassDeviceStruct(device, num_axes,
|
||||||
|
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
|
||||||
|
atoms,
|
||||||
|
#endif
|
||||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
|
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
|
||||||
GetMotionHistory,
|
GetMotionHistory,
|
||||||
#endif
|
#endif
|
||||||
@@ -1095,19 +1123,16 @@ EvdevAddRelClass(DeviceIntPtr device)
|
|||||||
|
|
||||||
for (axis = REL_X; axis <= REL_MAX; axis++)
|
for (axis = REL_X; axis <= REL_MAX; axis++)
|
||||||
{
|
{
|
||||||
|
int axnum = pEvdev->axis_map[axis];
|
||||||
|
|
||||||
pEvdev->axis_map[axis] = -1;
|
if (axnum == -1)
|
||||||
/* We don't post wheel events, so ignore them here too */
|
|
||||||
if (axis == REL_WHEEL || axis == REL_HWHEEL || axis == REL_DIAL)
|
|
||||||
continue;
|
continue;
|
||||||
if (!TestBit(axis, pEvdev->rel_bitmask))
|
xf86InitValuatorAxisStruct(device, axnum, atoms[axnum], -1, -1, 1, 0, 1);
|
||||||
continue;
|
xf86InitValuatorDefaults(device, axnum);
|
||||||
pEvdev->axis_map[axis] = i;
|
|
||||||
xf86InitValuatorAxisStruct(device, i, -1, -1, 1, 0, 1);
|
|
||||||
xf86InitValuatorDefaults(device, i);
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xfree(atoms);
|
||||||
|
|
||||||
if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc))
|
if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc))
|
||||||
return !Success;
|
return !Success;
|
||||||
|
|
||||||
@@ -1121,13 +1146,18 @@ EvdevAddButtonClass(DeviceIntPtr device)
|
|||||||
{
|
{
|
||||||
InputInfoPtr pInfo;
|
InputInfoPtr pInfo;
|
||||||
EvdevPtr pEvdev;
|
EvdevPtr pEvdev;
|
||||||
|
Atom *labels;
|
||||||
|
|
||||||
pInfo = device->public.devicePrivate;
|
pInfo = device->public.devicePrivate;
|
||||||
pEvdev = pInfo->private;
|
pEvdev = pInfo->private;
|
||||||
|
|
||||||
if (!InitButtonClassDeviceStruct(device, pEvdev->num_buttons, pEvdev->btnmap))
|
labels = xalloc(pEvdev->num_buttons * sizeof(Atom));
|
||||||
|
EvdevInitButtonLabels(pEvdev, pEvdev->num_buttons, labels);
|
||||||
|
|
||||||
|
if (!InitButtonClassDeviceStruct(device, pEvdev->num_buttons, labels, pEvdev->btnmap))
|
||||||
return !Success;
|
return !Success;
|
||||||
|
|
||||||
|
xfree(labels);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user