diff options
author | wm4 <wm4@nowhere> | 2013-07-01 21:33:41 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-02 12:19:14 +0200 |
commit | 2f8dcac28b64cecd537ab1fad366b2c2052c2ead (patch) | |
tree | cf490ec08a89b67dbad953b912c3cabf134cd15e /core | |
parent | 931ee2dd2142772343fcab38da83126035f6a204 (diff) | |
download | mpv-2f8dcac28b64cecd537ab1fad366b2c2052c2ead.tar.bz2 mpv-2f8dcac28b64cecd537ab1fad366b2c2052c2ead.tar.xz |
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.
Diffstat (limited to 'core')
-rw-r--r-- | core/input/input.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/input/input.c b/core/input/input.c index e843a88380..9fdd77ddd0 100644 --- a/core/input/input.c +++ b/core/input/input.c @@ -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 " |