Once https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/368 is merged and we upgrade wl_seat version to 10, compositors will also generate "repeated" events, which mpv treats as key up right now. Change the check so that unknown key states are ignored.
Unified · Split
| @@ -1886,13 +1886,21 @@ static void handle_key_input(struct vo_wayland_seat *s, uint32_t key, · 1885 unmodified lines | ||
| 1886 | 1886 | { |
| 1887 | 1887 | struct vo_wayland_state *wl = s->wl; |
| 1888 | 1888 | |
| 1889 | + switch (state) { | |
| 1890 | + case WL_KEYBOARD_KEY_STATE_RELEASED: | |
| 1891 | + state = MP_KEY_STATE_UP; | |
| 1892 | + break; | |
| 1893 | + case WL_KEYBOARD_KEY_STATE_PRESSED: | |
| 1894 | + state = MP_KEY_STATE_DOWN; | |
| 1895 | + break; | |
| 1896 | + default: | |
| 1897 | + return; | |
| 1898 | + } | |
| 1899 | + | |
| 1889 | 1900 | s->keyboard_code = key + 8; |
| 1890 | 1901 | xkb_keysym_t sym = xkb_state_key_get_one_sym(s->xkb_state, s->keyboard_code); |
| 1891 | 1902 | int mpkey = lookupkey(sym); |
| 1892 | 1903 | |
| 1893 | − state = state == WL_KEYBOARD_KEY_STATE_PRESSED ? MP_KEY_STATE_DOWN | |
| 1894 | − : MP_KEY_STATE_UP; | |
| 1895 | − | |
| 1896 | 1904 | if (mpkey) { |
| 1897 | 1905 | mp_input_put_key(wl->vo->input_ctx, mpkey | state | s->mpmod); |
| 1898 | 1906 | } else { |