Skip to content

Commit

Permalink
wayland: Set the keymap in keyboard_handle_keymap
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Apr 9, 2021
1 parent 89b6209 commit ec6ad51
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/video/wayland/SDL_waylandevents.c
Expand Up @@ -625,6 +625,9 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
{
struct SDL_WaylandInput *input = data;
char *map_str;
const xkb_keysym_t *syms;
SDL_Keycode keymap[SDL_NUM_SCANCODES];
SDL_Scancode i;

if (!data) {
close(fd);
Expand Down Expand Up @@ -661,6 +664,15 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
input->xkb.keymap = NULL;
return;
}

SDL_GetDefaultKeymap(keymap);
for (i = 0; i < SDL_arraysize(xfree86_scancode_table2); i += 1) {
if (WAYLAND_xkb_state_key_get_syms(input->xkb.state, i + 8, &syms) > 0) {
keymap[xfree86_scancode_table2[i]] = syms[0];
}
}
SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
SDL_SendKeymapChangedEvent();
}

static void
Expand Down

0 comments on commit ec6ad51

Please sign in to comment.