mirror of
https://github.com/mpv-player/mpv
synced 2025-01-09 01:36:25 +01:00
wayland: use new function xkb_keymap_from_buffer
Bump xkbcommon version and use the new xkb_keymap_from_buffer. This is more secure, because the from_string expects a 0 terminated string, but this cannot be guaranteed with mmap.
This commit is contained in:
parent
0d1cd116d7
commit
c0b8c35e3b
2
configure
vendored
2
configure
vendored
@ -1786,7 +1786,7 @@ fi #if darwin
|
||||
echocheck "Wayland"
|
||||
if test "$_wayland" != no; then
|
||||
_wayland="no"
|
||||
pkg_config_add "wayland-client >= 1.0.0 wayland-egl >= 9.0.0 wayland-cursor >= 1.0.0 xkbcommon >= 0.2.0" \
|
||||
pkg_config_add "wayland-client >= 1.0.0 wayland-egl >= 9.0.0 wayland-cursor >= 1.0.0 xkbcommon >= 0.3.0" \
|
||||
&& _wayland="yes"
|
||||
res_comment=""
|
||||
else
|
||||
|
@ -217,15 +217,10 @@ static void keyboard_handle_keymap(void *data,
|
||||
int32_t fd,
|
||||
uint32_t size)
|
||||
{
|
||||
struct vo_wayland_input *input = ((struct vo_wayland_state *) data)->input;
|
||||
struct vo_wayland_input *input;
|
||||
char *map_str;
|
||||
|
||||
if(!data) {
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
|
||||
if(!data || format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
@ -236,8 +231,9 @@ static void keyboard_handle_keymap(void *data,
|
||||
return;
|
||||
}
|
||||
|
||||
input->xkb.keymap = xkb_map_new_from_string(input->xkb.context,
|
||||
map_str, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
||||
input = ((struct vo_wayland_state *) data)->input;
|
||||
input->xkb.keymap = xkb_keymap_new_from_buffer(input->xkb.context,
|
||||
map_str, size, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
||||
|
||||
munmap(map_str, size);
|
||||
close(fd);
|
||||
|
Loading…
Reference in New Issue
Block a user