summaryrefslogtreecommitdiffstats
path: root/mp_fifo.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-04-25 14:12:04 +0300
committerUoti Urpala <uau@mplayer2.org>2011-05-02 00:44:21 +0300
commitb9eaafe1ed4f38efcd08d113d9e51e9ebb034f6e (patch)
treefd70a279e23af0e61b98f3bb66382005f18ca3c4 /mp_fifo.c
parent325926f9f87070615521747646c47012f1434e15 (diff)
downloadmpv-b9eaafe1ed4f38efcd08d113d9e51e9ebb034f6e.tar.bz2
mpv-b9eaafe1ed4f38efcd08d113d9e51e9ebb034f6e.tar.xz
input: modify interpretation of doubleclick events
The code combining button presses into multibutton commands prevented single click commands from triggering if a doubleclick event had been generated from the same button press. As a result using the mouse wheel to seek worked very badly. Special-case doubleclick events in the event interpretation code to avoid this issue. This changes the sequence of generated "keys" for press-release-press-release from MOUSE_BTN0 MOUSE_BTN0-MOUSE_BTN0_DBL MOUSE_BTN0_DBL to MOUSE_BTN0 MOUSE_BTN0_DBL MOUSE_BTN0. "Keys" like MOUSE_BTN0-MOUSE_BTN0_DBL will never be generated now; any existing configuration files using those need to be changed.
Diffstat (limited to 'mp_fifo.c')
-rw-r--r--mp_fifo.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/mp_fifo.c b/mp_fifo.c
index 97a3b06ce0..b470c55a83 100644
--- a/mp_fifo.c
+++ b/mp_fifo.c
@@ -31,8 +31,8 @@ struct mp_fifo {
int readpos;
int writepos;
int size;
- unsigned last_key_time[2];
- int last_key[2];
+ int last_key_down;
+ unsigned last_down_time;
};
struct mp_fifo *mp_fifo_create(struct MPOpts *opts)
@@ -86,16 +86,10 @@ void mplayer_put_key(struct mp_fifo *fifo, int code)
mplayer_put_key_internal(fifo, code);
if (code & MP_KEY_DOWN) {
code &= ~MP_KEY_DOWN;
- fifo->last_key[1] = fifo->last_key[0];
- fifo->last_key[0] = code;
- fifo->last_key_time[1] = fifo->last_key_time[0];
- fifo->last_key_time[0] = now;
- if (fifo->last_key[1] == code
- && now - fifo->last_key_time[1] < doubleclick_time)
+ if (fifo->last_key_down == code
+ && now - fifo->last_down_time < doubleclick_time)
put_double(fifo, code);
- return;
+ fifo->last_key_down = code;
+ fifo->last_down_time = now;
}
- if (fifo->last_key[0] == code && fifo->last_key[1] == code
- && now - fifo->last_key_time[1] < doubleclick_time)
- put_double(fifo, code);
}