Minor cleanup

(cherry picked from commit 92fd2938e737cf044d2da781cf0f4b4b4de4463f)
main
Sam Lantinga 2023-07-10 09:42:12 -07:00
parent 47fd07bde6
commit 95d17f9d2c
1 changed files with 26 additions and 30 deletions

View File

@ -570,6 +570,32 @@ static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode)
return scancode;
}
static int SDL_EVDEV_init_mouse(SDL_evdevlist_item *item, int udev_class)
{
int ret;
struct input_absinfo abs_info;
ret = ioctl(item->fd, EVIOCGABS(ABS_X), &abs_info);
if (ret < 0) {
// no absolute mode info, continue
return 0;
}
item->min_x = abs_info.minimum;
item->max_x = abs_info.maximum;
item->range_x = abs_info.maximum - abs_info.minimum;
ret = ioctl(item->fd, EVIOCGABS(ABS_Y), &abs_info);
if (ret < 0) {
// no absolute mode info, continue
return 0;
}
item->min_y = abs_info.minimum;
item->max_y = abs_info.maximum;
item->range_y = abs_info.maximum - abs_info.minimum;
return 0;
}
static int SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class)
{
int ret, i;
@ -671,36 +697,6 @@ static int SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class)
return 0;
}
static int SDL_EVDEV_init_mouse(SDL_evdevlist_item *item, int udev_class)
{
int ret;
struct input_absinfo abs_info;
if (item->is_touchscreen) {
return 0;
}
ret = ioctl(item->fd, EVIOCGABS(ABS_X), &abs_info);
if (ret < 0) {
// no absolute mode info, continue
return 0;
}
item->min_x = abs_info.minimum;
item->max_x = abs_info.maximum;
item->range_x = abs_info.maximum - abs_info.minimum;
ret = ioctl(item->fd, EVIOCGABS(ABS_Y), &abs_info);
if (ret < 0) {
// no absolute mode info, continue
return 0;
}
item->min_y = abs_info.minimum;
item->max_y = abs_info.maximum;
item->range_y = abs_info.maximum - abs_info.minimum;
return 0;
}
static void SDL_EVDEV_destroy_touchscreen(SDL_evdevlist_item *item)
{
if (!item->is_touchscreen) {