From 3dca3291505b452d864fd81cf31bc523a00b4224 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sun, 25 Jan 2015 08:11:44 +0100 Subject: [PATCH] evdev: Don't send mouse events on EV_ABS A real mouse will send EV_REL events. Joysticks, on the other hand, will use EV_ABS for their axes. This commit avoids joystick events to be misinterpreted as mouse events. --- src/core/linux/SDL_evdev.c | 61 -------------------------------------- 1 file changed, 61 deletions(-) diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index 719ba777d4f76..3f019f4b4a77e 100644 --- a/src/core/linux/SDL_evdev.c +++ b/src/core/linux/SDL_evdev.c @@ -302,67 +302,6 @@ SDL_EVDEV_Poll(void) } SDL_EVDEV_kbd_keycode(_this->kbd, events[i].code, events[i].value); break; - case EV_ABS: - switch(events[i].code) { - case ABS_MT_SLOT: - if (!item->is_touchscreen) /* FIXME: temp hack */ - break; - item->touchscreen_data->current_slot = events[i].value; - break; - case ABS_MT_TRACKING_ID: - if (!item->is_touchscreen) /* FIXME: temp hack */ - break; - if (events[i].value >= 0) { - item->touchscreen_data->slots[item->touchscreen_data->current_slot].tracking_id = events[i].value; - item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_DOWN; - } else { - item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_UP; - } - break; - case ABS_MT_POSITION_X: - if (!item->is_touchscreen) /* FIXME: temp hack */ - break; - item->touchscreen_data->slots[item->touchscreen_data->current_slot].x = events[i].value; - if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { - item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; - } - break; - case ABS_MT_POSITION_Y: - if (!item->is_touchscreen) /* FIXME: temp hack */ - break; - item->touchscreen_data->slots[item->touchscreen_data->current_slot].y = events[i].value; - if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { - item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; - } - break; - case ABS_MT_PRESSURE: - if (!item->is_touchscreen) /* FIXME: temp hack */ - break; - item->touchscreen_data->slots[item->touchscreen_data->current_slot].pressure = events[i].value; - if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { - item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; - } - break; - case ABS_X: - if (item->is_touchscreen) { - if (item->touchscreen_data->max_slots != 1) - break; - item->touchscreen_data->slots[0].x = events[i].value; - } else - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, events[i].value, mouse->y); - break; - case ABS_Y: - if (item->is_touchscreen) { - if (item->touchscreen_data->max_slots != 1) - break; - item->touchscreen_data->slots[0].y = events[i].value; - } else - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, mouse->x, events[i].value); - break; - default: - break; - } - break; case EV_REL: switch(events[i].code) { case REL_X: