keyboard: use the new data in wlr_keyboard_set_keymap()

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3647
master
Kirill Primak 2 years ago
parent e2647c5151
commit 75293d5fb0

@ -189,18 +189,18 @@ bool wlr_keyboard_set_keymap(struct wlr_keyboard *kb, struct xkb_keymap *keymap)
return true; return true;
} }
struct xkb_state *xkb_state = xkb_state_new(kb->keymap); struct xkb_state *xkb_state = xkb_state_new(keymap);
if (xkb_state == NULL) { if (xkb_state == NULL) {
wlr_log(WLR_ERROR, "Failed to create XKB state"); wlr_log(WLR_ERROR, "Failed to create XKB state");
return false; return false;
} }
char *keymap_str = xkb_keymap_get_as_string(kb->keymap, XKB_KEYMAP_FORMAT_TEXT_V1); char *keymap_str = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1);
if (keymap_str == NULL) { if (keymap_str == NULL) {
wlr_log(WLR_ERROR, "Failed to get string version of keymap"); wlr_log(WLR_ERROR, "Failed to get string version of keymap");
goto error_xkb_state; goto error_xkb_state;
} }
size_t keymap_size = strlen(kb->keymap_string) + 1; size_t keymap_size = strlen(keymap_str) + 1;
int rw_fd = -1, ro_fd = -1; int rw_fd = -1, ro_fd = -1;
if (!allocate_shm_file_pair(keymap_size, &rw_fd, &ro_fd)) { if (!allocate_shm_file_pair(keymap_size, &rw_fd, &ro_fd)) {

Loading…
Cancel
Save