mirror of https://github.com/encounter/SDL.git
wscons: Make USB keyboard input layout independent
This commit is contained in:
parent
9d86ec8573
commit
d90bd261f3
|
@ -394,6 +394,7 @@ typedef struct {
|
||||||
unsigned int text_len;
|
unsigned int text_len;
|
||||||
keysym_t composebuffer[2];
|
keysym_t composebuffer[2];
|
||||||
unsigned char composelen;
|
unsigned char composelen;
|
||||||
|
int type;
|
||||||
} SDL_WSCONS_input_data;
|
} SDL_WSCONS_input_data;
|
||||||
|
|
||||||
static SDL_WSCONS_input_data* inputs[4] = {NULL, NULL, NULL, NULL};
|
static SDL_WSCONS_input_data* inputs[4] = {NULL, NULL, NULL, NULL};
|
||||||
|
@ -432,6 +433,7 @@ static SDL_WSCONS_input_data* SDL_WSCONS_Init_Keyboard(const char* dev)
|
||||||
RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETLEDS, &input->ledstate));
|
RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETLEDS, &input->ledstate));
|
||||||
input->origledstate = input->ledstate;
|
input->origledstate = input->ledstate;
|
||||||
RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETENCODING, &input->encoding));
|
RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETENCODING, &input->encoding));
|
||||||
|
RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GTYPE, &input->type));
|
||||||
#ifdef WSKBDIO_SETVERSION
|
#ifdef WSKBDIO_SETVERSION
|
||||||
RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_SETVERSION, &version));
|
RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_SETVERSION, &version));
|
||||||
#endif
|
#endif
|
||||||
|
@ -725,7 +727,12 @@ static void updateKeyboard(SDL_WSCONS_input_data* input)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Translate_to_keycode(input, type, events[i].value);
|
|
||||||
|
if (input->type == WSKBD_TYPE_USB && events[i].value <= 0xE7)
|
||||||
|
SDL_SendKeyboardKey(type == WSCONS_EVENT_KEY_DOWN ? SDL_PRESSED : SDL_RELEASED, (SDL_Scancode)events[i].value);
|
||||||
|
else
|
||||||
|
Translate_to_keycode(input, type, events[i].value);
|
||||||
|
|
||||||
if (type == WSCONS_EVENT_KEY_UP) continue;
|
if (type == WSCONS_EVENT_KEY_UP) continue;
|
||||||
|
|
||||||
if (IS_ALTGR_MODE && !IS_CONTROL_HELD)
|
if (IS_ALTGR_MODE && !IS_CONTROL_HELD)
|
||||||
|
|
Loading…
Reference in New Issue