aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-08-06 21:25:55 +0200
committerKenny Levinsen <kl@kl.wtf>2021-08-06 23:06:29 +0200
commitc27263c105745dbce31b7ebd8166e167e182ed19 (patch)
treecca1fb2f7dd7a76b5aee40ccdfcec1b2d78ea3b1
parentd48ffac56bf25f51a1d47c158fa426a3666539a8 (diff)
seat: allow compositors to not load a keymap
The protocol allows compositors to not send any keymap to Wayland clients. Handle a keymap-less keyboard correctly by sending WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP instead of erroring out in the mmap call.
-rw-r--r--types/seat/wlr_seat_keyboard.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/types/seat/wlr_seat_keyboard.c b/types/seat/wlr_seat_keyboard.c
index e9aba4d2..f41ef880 100644
--- a/types/seat/wlr_seat_keyboard.c
+++ b/types/seat/wlr_seat_keyboard.c
@@ -370,6 +370,13 @@ static void seat_client_send_keymap(struct wlr_seat_client *client,
continue;
}
+ if (keyboard->keymap == NULL) {
+ wl_keyboard_send_keymap(resource,
+ WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP, keymap_fd, 0);
+ close(keymap_fd);
+ continue;
+ }
+
void *ptr = mmap(NULL, keyboard->keymap_size, PROT_READ | PROT_WRITE,
MAP_SHARED, keymap_fd, 0);
if (ptr == MAP_FAILED) {