History

wayland_common: ignore unknown key states

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.

nanahi committed 2 years ago

Commit 2fa66b81 parent 0fcfbab1 file · +11 −3Browse files

Unified · Split

video/out/wayland_common.c+11−3
@@ -1886,13 +1886,21 @@ static void handle_key_input(struct vo_wayland_seat *s, uint32_t key, · 1885 unmodified lines
18861886 {
18871887 struct vo_wayland_state *wl = s->wl;
18881888
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+
18891900 s->keyboard_code = key + 8;
18901901 xkb_keysym_t sym = xkb_state_key_get_one_sym(s->xkb_state, s->keyboard_code);
18911902 int mpkey = lookupkey(sym);
18921903
1893− state = state == WL_KEYBOARD_KEY_STATE_PRESSED ? MP_KEY_STATE_DOWN
1894− : MP_KEY_STATE_UP;
1895−
18961904 if (mpkey) {
18971905 mp_input_put_key(wl->vo->input_ctx, mpkey | state | s->mpmod);
18981906 } else {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t