Added SDL_GetKeyboardName() and SDL_GetMouseName()
This commit is contained in:
@@ -607,17 +607,22 @@ static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode)
|
||||
|
||||
static int SDL_EVDEV_init_keyboard(SDL_evdevlist_item *item, int udev_class)
|
||||
{
|
||||
SDL_AddKeyboard((SDL_KeyboardID)item->fd, SDL_TRUE);
|
||||
SDL_AddKeyboard((SDL_KeyboardID)item->fd, NULL, SDL_TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SDL_EVDEV_destroy_keyboard(SDL_evdevlist_item *item)
|
||||
{
|
||||
SDL_RemoveKeyboard((SDL_KeyboardID)item->fd);
|
||||
}
|
||||
|
||||
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);
|
||||
SDL_AddMouse((SDL_MouseID)item->fd, NULL, SDL_TRUE);
|
||||
|
||||
ret = ioctl(item->fd, EVIOCGABS(ABS_X), &abs_info);
|
||||
if (ret < 0) {
|
||||
@@ -640,6 +645,11 @@ static int SDL_EVDEV_init_mouse(SDL_evdevlist_item *item, int udev_class)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SDL_EVDEV_destroy_mouse(SDL_evdevlist_item *item)
|
||||
{
|
||||
SDL_RemoveMouse((SDL_MouseID)item->fd);
|
||||
}
|
||||
|
||||
static int SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class)
|
||||
{
|
||||
int ret;
|
||||
@@ -974,6 +984,10 @@ static int SDL_EVDEV_device_removed(const char *dev_path)
|
||||
}
|
||||
if (item->is_touchscreen) {
|
||||
SDL_EVDEV_destroy_touchscreen(item);
|
||||
} else if (item->udev_class & SDL_UDEV_DEVICE_MOUSE) {
|
||||
SDL_EVDEV_destroy_mouse(item);
|
||||
} else if (item->udev_class & SDL_UDEV_DEVICE_KEYBOARD) {
|
||||
SDL_EVDEV_destroy_keyboard(item);
|
||||
}
|
||||
close(item->fd);
|
||||
SDL_free(item->path);
|
||||
|
||||
@@ -433,7 +433,7 @@ static SDL_WSCONS_input_data *SDL_WSCONS_Init_Keyboard(const char *dev)
|
||||
}
|
||||
|
||||
input->keyboardID = SDL_GetNextObjectID();
|
||||
SDL_AddKeyboard(input->keyboardID, SDL_FALSE);
|
||||
SDL_AddKeyboard(input->keyboardID, NULL, SDL_FALSE);
|
||||
|
||||
input->keymap.map = SDL_calloc(sizeof(struct wscons_keymap), KS_NUMKEYCODES);
|
||||
if (!input->keymap.map) {
|
||||
|
||||
@@ -52,7 +52,7 @@ SDL_WSCONS_mouse_input_data *SDL_WSCONS_Init_Mouse()
|
||||
}
|
||||
|
||||
input->mouseID = SDL_GetNextObjectID();
|
||||
SDL_AddMouse(input->mouseID, SDL_FALSE);
|
||||
SDL_AddMouse(input->mouseID, NULL, SDL_FALSE);
|
||||
|
||||
#ifdef WSMOUSEIO_SETMODE
|
||||
ioctl(input->fd, WSMOUSEIO_SETMODE, WSMOUSE_COMPAT);
|
||||
|
||||
Reference in New Issue
Block a user