summaryrefslogtreecommitdiffstats
path: root/core/mp_fifo.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-01 23:54:59 +0200
committerwm4 <wm4@nowhere>2013-07-02 12:19:16 +0200
commitc4766dc3c6233d3353b79fbd226202e7b8e3fc46 (patch)
treeed8f8b06e53d5130c3a290ac0eadf873eaf0a7ec /core/mp_fifo.c
parent2f8dcac28b64cecd537ab1fad366b2c2052c2ead (diff)
downloadmpv-c4766dc3c6233d3353b79fbd226202e7b8e3fc46.tar.bz2
mpv-c4766dc3c6233d3353b79fbd226202e7b8e3fc46.tar.xz
input: require VOs to send key up events, redo input key lookup
Making key up events implicit was sort-of a nice idea, but it's too tricky and unreliable and makes the key lookup code (interpret_keys()) hard to reason about. See e.g. previous commit for subtle bugs and issues this caused. Make key-up events explicit instead. Add key up events to all VOs. Any time MP_KEY_STATE_DOWN is used, the matching key up event must use MP_KEY_STATE_UP. Rewrite the key lookup code. It should be simpler and more robust now. (Even though the LOC increases, because the new code is less "compact".)
Diffstat (limited to 'core/mp_fifo.c')
-rw-r--r--core/mp_fifo.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/core/mp_fifo.c b/core/mp_fifo.c
index 32036749d1..1c83e99dcd 100644
--- a/core/mp_fifo.c
+++ b/core/mp_fifo.c
@@ -53,9 +53,8 @@ void mplayer_put_key(struct mp_fifo *fifo, int code)
double now = mp_time_sec();
int doubleclick_time = fifo->opts->doubleclick_time;
// ignore system-doubleclick if we generate these events ourselves
- if (doubleclick_time
- && (code & ~MP_KEY_STATE_DOWN) >= MP_MOUSE_BTN0_DBL
- && (code & ~MP_KEY_STATE_DOWN) < MP_MOUSE_BTN_DBL_END)
+ int unmod = code & ~MP_KEY_MODIFIER_MASK;
+ if (doubleclick_time && MP_KEY_IS_MOUSE_BTN_DBL(unmod))
return;
mp_input_feed_key(fifo->input, code);
if (code & MP_KEY_STATE_DOWN) {