Merge pull request #7730 from grant2258/mouse

fix udev mouse
This commit is contained in:
Twinaphex 2018-12-16 23:17:06 +01:00 committed by GitHub
commit fbb095cc06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -505,41 +505,40 @@ static bool udev_input_add_device(udev_input_t *udev,
strlcpy(device->devnode, devnode, sizeof(device->devnode));
/* Touchpads report in absolute coords. */
if (type == UDEV_INPUT_TOUCHPAD)
{
if (ioctl(fd, EVIOCGABS(ABS_X), &absinfo) < 0 ||
absinfo.minimum >= absinfo.maximum)
goto error;
device->mouse.x_min = absinfo.minimum;
device->mouse.x_max = absinfo.maximum;
if (ioctl(fd, EVIOCGABS(ABS_Y), &absinfo) < 0 ||
absinfo.minimum >= absinfo.maximum)
goto error;
device->mouse.y_min = absinfo.minimum;
device->mouse.y_max = absinfo.maximum;
}
/* UDEV_INPUT_MOUSE may report in absolute coords too */
else if (type == UDEV_INPUT_MOUSE && ioctl(fd, EVIOCGABS(ABS_X), &absinfo) >= 0)
if (type == UDEV_INPUT_MOUSE || type == UDEV_INPUT_TOUCHPAD )
{
if (absinfo.minimum >= absinfo.maximum)
goto error;
if (ioctl(fd, EVIOCGABS(ABS_X), &absinfo) >= 0)
{
if (absinfo.minimum >= absinfo.maximum )
{
device->mouse.x_min = -1;
device->mouse.x_max = 1;
}
else
{
device->mouse.x_min = absinfo.minimum;
device->mouse.x_min = absinfo.maximum;
}
}
device->mouse.x_min = absinfo.minimum;
device->mouse.x_max = absinfo.maximum;
if (ioctl(fd, EVIOCGABS(ABS_Y), &absinfo) < 0 ||
absinfo.minimum >= absinfo.maximum)
goto error;
device->mouse.y_min = absinfo.minimum;
device->mouse.y_max = absinfo.maximum;
if (ioctl(fd, EVIOCGABS(ABS_Y), &absinfo) >= 0)
{
if (absinfo.minimum >= absinfo.maximum )
{
device->mouse.y_min = -1;
device->mouse.y_max = 1;
}
else
{
device->mouse.y_min = absinfo.minimum;
device->mouse.y_min = absinfo.maximum;
}
}
}
tmp = ( udev_input_device_t**)realloc(udev->devices,
tmp = ( udev_input_device_t**)realloc(udev->devices,
(udev->num_devices + 1) * sizeof(*udev->devices));
if (!tmp)