1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-17 17:58:46 +00:00

(make_lispy_event): Remember last wheel direction.

(syms_of_keyboard) <wheel_syms>: Compute array size at compile time.
This commit is contained in:
YAMAMOTO Mitsuharu 2009-09-27 04:40:41 +00:00
parent ce9a0ccb72
commit 3208cb35e9
2 changed files with 31 additions and 27 deletions

View File

@ -1,3 +1,8 @@
2009-09-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* keyboard.c (make_lispy_event): Remember last wheel direction.
(syms_of_keyboard) <wheel_syms>: Compute array size at compile time.
2009-09-26 Glenn Morris <rgm@gnu.org>
* Makefile.in (MSDOS_SUPPORT) [MSDOS]: Remove unneeded '/' in

View File

@ -5953,6 +5953,7 @@ make_lispy_event (event)
as a multiple of 1/8 characters. */
struct frame *f;
int fuzz;
int symbol_num;
int is_double;
if (WINDOWP (event->frame_or_window))
@ -5967,7 +5968,27 @@ make_lispy_event (event)
else
fuzz = double_click_fuzz / 8;
is_double = (last_mouse_button < 0
if (event->modifiers & up_modifier)
{
/* Emit a wheel-up event. */
event->modifiers &= ~up_modifier;
symbol_num = 0;
}
else if (event->modifiers & down_modifier)
{
/* Emit a wheel-down event. */
event->modifiers &= ~down_modifier;
symbol_num = 1;
}
else
/* Every wheel event should either have the down_modifier or
the up_modifier set. */
abort ();
if (event->kind == HORIZ_WHEEL_EVENT)
symbol_num += 2;
is_double = (last_mouse_button == - (1 + symbol_num)
&& (eabs (XINT (event->x) - last_mouse_x) <= fuzz)
&& (eabs (XINT (event->y) - last_mouse_y) <= fuzz)
&& button_down_time != 0
@ -5990,33 +6011,9 @@ make_lispy_event (event)
button_down_time = event->timestamp;
/* Use a negative value to distinguish wheel from mouse button. */
last_mouse_button = -1;
last_mouse_button = - (1 + symbol_num);
last_mouse_x = XINT (event->x);
last_mouse_y = XINT (event->y);
}
{
int symbol_num;
if (event->modifiers & up_modifier)
{
/* Emit a wheel-up event. */
event->modifiers &= ~up_modifier;
symbol_num = 0;
}
else if (event->modifiers & down_modifier)
{
/* Emit a wheel-down event. */
event->modifiers &= ~down_modifier;
symbol_num = 1;
}
else
/* Every wheel event should either have the down_modifier or
the up_modifier set. */
abort ();
if (event->kind == HORIZ_WHEEL_EVENT)
symbol_num += 2;
/* Get the symbol we should use for the wheel event. */
head = modify_event_symbol (symbol_num,
@ -11898,7 +11895,9 @@ syms_of_keyboard ()
staticpro (&button_down_location);
mouse_syms = Fmake_vector (make_number (5), Qnil);
staticpro (&mouse_syms);
wheel_syms = Fmake_vector (make_number (4), Qnil);
wheel_syms = Fmake_vector (make_number (sizeof (lispy_wheel_names)
/ sizeof (lispy_wheel_names[0])),
Qnil);
staticpro (&wheel_syms);
{