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
1886{1886{
1887 struct vo_wayland_state *wl = s->wl;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 s->keyboard_code = key + 8;1900 s->keyboard_code = key + 8;
1890 xkb_keysym_t sym = xkb_state_key_get_one_sym(s->xkb_state, s->keyboard_code);1901 xkb_keysym_t sym = xkb_state_key_get_one_sym(s->xkb_state, s->keyboard_code);
1891 int mpkey = lookupkey(sym);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 if (mpkey) {1904 if (mpkey) {
1897 mp_input_put_key(wl->vo->input_ctx, mpkey | state | s->mpmod);1905 mp_input_put_key(wl->vo->input_ctx, mpkey | state | s->mpmod);
1898 } else {1906 } 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