mirror of
https://github.com/mpv-player/mpv
synced 2024-11-07 01:47:00 +01:00
input: fix behavior if there are actually key up events
Wayland is the only backend that actually sends per-key key up events (the X11 one just sends MP_INPUT_RELEASE_ALL for simplicity). Handling was broken with Wayland, and each key event was interpreted twice, once on key down and once on key up. This commit should fix it.
This commit is contained in:
parent
931ee2dd21
commit
2f8dcac28b
@ -1324,6 +1324,7 @@ static mp_cmd_t *interpret_key(struct input_ctx *ictx, int code)
|
||||
if (ictx->key_down[j] == code)
|
||||
break;
|
||||
}
|
||||
bool emit_key = false;
|
||||
bool doubleclick = MP_KEY_IS_MOUSE_BTN_DBL(code);
|
||||
if (doubleclick) {
|
||||
int btn = code - MP_MOUSE_BTN0_DBL + MP_MOUSE_BTN0;
|
||||
@ -1332,8 +1333,8 @@ static mp_cmd_t *interpret_key(struct input_ctx *ictx, int code)
|
||||
return NULL;
|
||||
j = ictx->num_key_down - 1;
|
||||
ictx->key_down[j] = code;
|
||||
emit_key = true;
|
||||
}
|
||||
bool emit_key = ictx->last_key_down;
|
||||
if (j == ictx->num_key_down) { // was not already down; add temporarily
|
||||
if (ictx->num_key_down > MP_MAX_KEY_DOWN) {
|
||||
mp_tmsg(MSGT_INPUT, MSGL_ERR, "Too many key down events "
|
||||
|
Loading…
Reference in New Issue
Block a user