Be explicit about the event mouse and keyboard ID
This commit is contained in:
parent
1c54455353
commit
d1eb4adb16
53 changed files with 383 additions and 703 deletions
|
@ -605,11 +605,20 @@ static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode)
|
|||
return scancode;
|
||||
}
|
||||
|
||||
static int SDL_EVDEV_init_keyboard(SDL_evdevlist_item *item, int udev_class)
|
||||
{
|
||||
SDL_AddKeyboard((SDL_KeyboardID)item->fd, SDL_TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int SDL_EVDEV_init_mouse(SDL_evdevlist_item *item, int udev_class)
|
||||
{
|
||||
int ret;
|
||||
struct input_absinfo abs_info;
|
||||
|
||||
SDL_AddMouse((SDL_MouseID)item->fd, SDL_TRUE);
|
||||
|
||||
ret = ioctl(item->fd, EVIOCGABS(ABS_X), &abs_info);
|
||||
if (ret < 0) {
|
||||
// no absolute mode info, continue
|
||||
|
@ -922,6 +931,14 @@ static int SDL_EVDEV_device_added(const char *dev_path, int udev_class)
|
|||
SDL_free(item);
|
||||
return ret;
|
||||
}
|
||||
} else if (udev_class & SDL_UDEV_DEVICE_KEYBOARD) {
|
||||
int ret = SDL_EVDEV_init_keyboard(item, udev_class);
|
||||
if (ret < 0) {
|
||||
close(item->fd);
|
||||
SDL_free(item->path);
|
||||
SDL_free(item);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_this->last) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue