mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
* key.c (xmouse_get_event): Filter out GPM_UP events that don't
follow a GPM_DOWN event. Filter out events with unknown button numbers, such as mouse wheel events. (get_event): Return EV_NONE if xmouse_get_event() decided to ignore the event.
This commit is contained in:
parent
d6b3b9bff1
commit
fdc234060f
@ -1,5 +1,11 @@
|
||||
2001-08-18 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* key.c (xmouse_get_event): Filter out GPM_UP events that don't
|
||||
follow a GPM_DOWN event. Filter out events with unknown button
|
||||
numbers, such as mouse wheel events.
|
||||
(get_event): Return EV_NONE if xmouse_get_event() decided to
|
||||
ignore the event.
|
||||
|
||||
* main.c (init_sigchld): Disable subshell if SIGCHLD handler
|
||||
cannot be installed.
|
||||
|
||||
|
23
src/key.c
23
src/key.c
@ -283,6 +283,7 @@ xmouse_get_event (Gpm_Event *ev)
|
||||
static struct timeval tv1 = { 0, 0 }; /* Force first click as single */
|
||||
static struct timeval tv2;
|
||||
static int clicks;
|
||||
static int last_btn = 0;
|
||||
|
||||
/* Decode Xterm mouse information to a GPM style event */
|
||||
|
||||
@ -294,10 +295,16 @@ xmouse_get_event (Gpm_Event *ev)
|
||||
/* So we assume all the buttons were released */
|
||||
|
||||
if (btn == 3){
|
||||
ev->type = GPM_UP | (GPM_SINGLE << clicks);
|
||||
ev->buttons = 0;
|
||||
GET_TIME (tv1);
|
||||
clicks = 0;
|
||||
if (last_btn) {
|
||||
ev->type = GPM_UP | (GPM_SINGLE << clicks);
|
||||
ev->buttons = 0;
|
||||
last_btn = 0;
|
||||
GET_TIME (tv1);
|
||||
clicks = 0;
|
||||
} else {
|
||||
/* Bogus event, maybe mouse wheel */
|
||||
ev->type = 0;
|
||||
}
|
||||
} else {
|
||||
ev->type = GPM_DOWN;
|
||||
GET_TIME (tv2);
|
||||
@ -319,8 +326,11 @@ xmouse_get_event (Gpm_Event *ev)
|
||||
break;
|
||||
default:
|
||||
/* Nothing */
|
||||
ev->type = 0;
|
||||
ev->buttons = 0;
|
||||
break;
|
||||
}
|
||||
last_btn = ev->buttons;
|
||||
}
|
||||
/* Coordinates are 33-based */
|
||||
/* Transform them to 1-based */
|
||||
@ -788,7 +798,10 @@ int get_event (Gpm_Event *event, int redo_event, int block)
|
||||
|
||||
if (c == MCKEY_MOUSE) { /* Mouse event */
|
||||
xmouse_get_event (event);
|
||||
return EV_MOUSE;
|
||||
if (event->type)
|
||||
return EV_MOUSE;
|
||||
else
|
||||
return EV_NONE;
|
||||
}
|
||||
|
||||
return c;
|
||||
|
Loading…
Reference in New Issue
Block a user