mirror of https://github.com/mpv-player/mpv
Apply ancient double-click patch that nobody cares to comment on.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21959 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
21e71a8901
commit
b5f54a914d
|
@ -761,6 +761,17 @@ Automatically attaches gdb upon crash or SIGTRAP.
|
||||||
Support must be compiled in by configuring with \-\-enable-crash-debug.
|
Support must be compiled in by configuring with \-\-enable-crash-debug.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-doubleclick-time
|
||||||
|
Time in milliseconds to recognize two consecutive button presses as
|
||||||
|
a double-click (default: 300).
|
||||||
|
Set to 0 to let your windowing system decide what a double-click is
|
||||||
|
(\-vo directx only).
|
||||||
|
.br
|
||||||
|
.I NOTE:
|
||||||
|
you will get slightly different behaviour depending on whether you bind
|
||||||
|
MOUSE_BTN0_DBL or MOUSE_BTN0\-MOUSE_BTN0_DBL.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
.B \-edlout <filename>
|
.B \-edlout <filename>
|
||||||
Creates a new file and writes edit decision list (EDL) records to it.
|
Creates a new file and writes edit decision list (EDL) records to it.
|
||||||
During playback, the user hits 'i' to mark the start or end of a skip block.
|
During playback, the user hits 'i' to mark the start or end of a skip block.
|
||||||
|
|
|
@ -367,6 +367,7 @@ m_option_t mplayer_opts[]={
|
||||||
{"consolecontrols", &noconsolecontrols, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 0, NULL},
|
{"consolecontrols", &noconsolecontrols, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 0, NULL},
|
||||||
{"mouse-movements", &enable_mouse_movements, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
|
{"mouse-movements", &enable_mouse_movements, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
|
||||||
{"nomouse-movements", &enable_mouse_movements, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 0, NULL},
|
{"nomouse-movements", &enable_mouse_movements, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 0, NULL},
|
||||||
|
{"doubleclick-time", &doubleclick_time, CONF_TYPE_INT, CONF_RANGE, 0, 1000, NULL},
|
||||||
|
|
||||||
#define MAIN_CONF
|
#define MAIN_CONF
|
||||||
#include "cfg-common.h"
|
#include "cfg-common.h"
|
||||||
|
|
37
fifo.c
37
fifo.c
|
@ -1,3 +1,4 @@
|
||||||
|
#include "input/mouse.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ static void make_pipe(int* pr,int* pw){
|
||||||
set_nonblock_flag(temp[1]);
|
set_nonblock_flag(temp[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mplayer_put_key(int code){
|
static void mplayer_put_key_internal(int code){
|
||||||
|
|
||||||
if( write(keyb_fifo_put,&code,4) != 4 ){
|
if( write(keyb_fifo_put,&code,4) != 4 ){
|
||||||
mp_msg(MSGT_INPUT,MSGL_ERR,"*** key event dropped (FIFO is full) ***\n");
|
mp_msg(MSGT_INPUT,MSGL_ERR,"*** key event dropped (FIFO is full) ***\n");
|
||||||
|
@ -39,7 +40,7 @@ static int *key_fifo_data = NULL;
|
||||||
static int key_fifo_read=0;
|
static int key_fifo_read=0;
|
||||||
static int key_fifo_write=0;
|
static int key_fifo_write=0;
|
||||||
|
|
||||||
void mplayer_put_key(int code){
|
static void mplayer_put_key_internal(int code){
|
||||||
// printf("mplayer_put_key(%d)\n",code);
|
// printf("mplayer_put_key(%d)\n",code);
|
||||||
if (key_fifo_data == NULL)
|
if (key_fifo_data == NULL)
|
||||||
key_fifo_data = malloc(key_fifo_size * sizeof(int));
|
key_fifo_data = malloc(key_fifo_size * sizeof(int));
|
||||||
|
@ -62,3 +63,35 @@ int mplayer_get_key(int fd){
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static unsigned doubleclick_time = 300;
|
||||||
|
|
||||||
|
static void put_double(int code) {
|
||||||
|
if (code >= MOUSE_BTN0 && code <= MOUSE_BTN9)
|
||||||
|
mplayer_put_key_internal(code - MOUSE_BTN0 + MOUSE_BTN0_DBL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mplayer_put_key(int code) {
|
||||||
|
static unsigned last_key_time[2];
|
||||||
|
static int last_key[2];
|
||||||
|
unsigned now = GetTimerMS();
|
||||||
|
// ignore system-doubleclick if we generate these events ourselves
|
||||||
|
if (doubleclick_time &&
|
||||||
|
(code & ~MP_KEY_DOWN) >= MOUSE_BTN0_DBL &&
|
||||||
|
(code & ~MP_KEY_DOWN) <= MOUSE_BTN9_DBL)
|
||||||
|
return;
|
||||||
|
mplayer_put_key_internal(code);
|
||||||
|
if (code & MP_KEY_DOWN) {
|
||||||
|
code &= ~MP_KEY_DOWN;
|
||||||
|
last_key[1] = last_key[0];
|
||||||
|
last_key[0] = code;
|
||||||
|
last_key_time[1] = last_key_time[0];
|
||||||
|
last_key_time[0] = now;
|
||||||
|
if (last_key[1] == code &&
|
||||||
|
now - last_key_time[1] < doubleclick_time)
|
||||||
|
put_double(code);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (last_key[0] == code && last_key[1] == code &&
|
||||||
|
now - last_key_time[1] < doubleclick_time)
|
||||||
|
put_double(code);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue