Commit 8e1e4240 authored by Gerd Moellmann's avatar Gerd Moellmann
Browse files

(lispy_mouse_names): Variable removed.

(Vlispy_mouse_stem): New variable.
(syms_of_keyboard): Initialize Vlispy_mouse_stem.
(make_lispy_event) <mouse_click, scroll_bar_click>: Don't abort
for any mouse button number.  Increase size of mouse_syms and
button_down_location as needed.  Call modify_event_symbol with
different arguments.
(make_lispy_event) <scroll_bar_click> [USE_TOOLKIT_SCROLL_BARS]:
Call modify_event_symbol with different arguments.
(make_lispy_event) <w32_scroll_bar_click> [WINDOWSNT]: Don't abort
for any button number.  Call modify_event_symbol with different
arguments.
(modify_event_symbol): Rename NAME_ALIST to NAME_ALIST_OR_STEM.
Accept a string for NAME_ALIST_OR_STEM.
parent 843930b7
......@@ -4085,12 +4085,7 @@ static char *iso_lispy_function_keys[] =
#endif /* not HAVE_NTGUI */
static char *lispy_mouse_names[] =
{
"mouse-1", "mouse-2", "mouse-3", "mouse-4", "mouse-5",
"mouse-6", "mouse-7", "mouse-8", "mouse-9", "mouse-10",
"mouse-11", "mouse-12", "mouse-13", "mouse-14", "mouse-15"
};
Lisp_Object Vlispy_mouse_stem;
#ifdef WINDOWSNT
/* mouse-wheel events are generated by the wheel on devices such as
......@@ -4276,9 +4271,6 @@ make_lispy_event (event)
Lisp_Object *start_pos_ptr;
Lisp_Object start_pos;
if (button < 0 || button >= NUM_MOUSE_BUTTONS)
abort ();
/* Build the position as appropriate for this mouse click. */
if (event->kind == mouse_click)
{
......@@ -4430,6 +4422,13 @@ make_lispy_event (event)
}
#endif /* not USE_TOOLKIT_SCROLL_BARS */
if (button >= XVECTOR (button_down_location)->size)
{
button_down_location = larger_vector (button_down_location,
button + 1, Qnil);
mouse_syms = larger_vector (mouse_syms, button + 1, Qnil);
}
start_pos_ptr = &XVECTOR (button_down_location)->contents[button];
start_pos = *start_pos_ptr;
......@@ -4519,10 +4518,10 @@ make_lispy_event (event)
head = modify_event_symbol (button,
event->modifiers,
Qmouse_click, Qnil,
lispy_mouse_names, &mouse_syms,
(sizeof (lispy_mouse_names)
/ sizeof (lispy_mouse_names[0])));
Qmouse_click, Vlispy_mouse_stem,
NULL,
&mouse_syms,
XVECTOR (mouse_syms)->size);
if (event->modifiers & drag_modifier)
return Fcons (head,
Fcons (start_pos,
......@@ -4580,10 +4579,10 @@ make_lispy_event (event)
/* Get the symbol we should use for the mouse click. */
head = modify_event_symbol (event->code,
event->modifiers,
Qmouse_click, Qnil,
lispy_mouse_names, &mouse_syms,
(sizeof (lispy_mouse_names)
/ sizeof (lispy_mouse_names[0])));
Qmouse_click,
Vlispy_mouse_stem,
NULL, &mouse_syms,
XVECTOR (mouse_syms)->size);
return Fcons (head, Fcons (position, Qnil));
}
......@@ -4598,9 +4597,6 @@ make_lispy_event (event)
Lisp_Object *start_pos_ptr;
Lisp_Object start_pos;
if (button < 0 || button >= NUM_MOUSE_BUTTONS)
abort ();
{
Lisp_Object window;
Lisp_Object portion_whole;
......@@ -4627,10 +4623,10 @@ make_lispy_event (event)
head = modify_event_symbol (button,
event->modifiers,
Qmouse_click, Qnil,
lispy_mouse_names, &mouse_syms,
(sizeof (lispy_mouse_names)
/ sizeof (lispy_mouse_names[0])));
Qmouse_click,
Vlispy_mouse_stem,
NULL, &mouse_syms,
XVECTOR (mouse_syms)->size);
return Fcons (head,
Fcons (position,
Qnil));
......@@ -5220,8 +5216,11 @@ reorder_modifiers (symbol)
is the name of the i'th symbol. TABLE_SIZE is the number of elements
in the table.
Alternatively, NAME_ALIST is an alist mapping codes into symbol names.
NAME_ALIST is used if it is non-nil; otherwise NAME_TABLE is used.
Alternatively, NAME_ALIST_OR_STEM is either an alist mapping codes
into symbol names, or a string specifying a name stem used to
contruct a symbol name or the form `STEM-N', where N is the decimal
representation of SYMBOL_NUM. NAME_ALIST_OR_STEM is used if it is
non-nil; otherwise NAME_TABLE is used.
SYMBOL_TABLE should be a pointer to a Lisp_Object whose value will
persist between calls to modify_event_symbol that it can use to
......@@ -5241,12 +5240,12 @@ reorder_modifiers (symbol)
in the symbol's name. */
static Lisp_Object
modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist,
modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist_or_stem,
name_table, symbol_table, table_size)
int symbol_num;
unsigned modifiers;
Lisp_Object symbol_kind;
Lisp_Object name_alist;
Lisp_Object name_alist_or_stem;
char **name_table;
Lisp_Object *symbol_table;
unsigned int table_size;
......@@ -5286,8 +5285,16 @@ modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist,
if (NILP (value))
{
/* No; let's create it. */
if (!NILP (name_alist))
value = Fcdr_safe (Fassq (symbol_int, name_alist));
if (CONSP (name_alist_or_stem))
value = Fcdr_safe (Fassq (symbol_int, name_alist_or_stem));
else if (STRINGP (name_alist_or_stem))
{
int len = STRING_BYTES (XSTRING (name_alist_or_stem));
char *buf = (char *) alloca (len + 50);
sprintf (buf, "%s-%d", XSTRING (name_alist_or_stem)->data,
XINT (symbol_int) + 1);
value = intern (buf);
}
else if (name_table != 0 && name_table[symbol_num])
value = intern (name_table[symbol_num]);
......@@ -9638,6 +9645,9 @@ struct event_head head_table[] = {
void
syms_of_keyboard ()
{
Vlispy_mouse_stem = build_string ("mouse");
staticpro (&Vlispy_mouse_stem);
/* Tool-bars. */
QCimage = intern (":image");
staticpro (&QCimage);
......@@ -9803,8 +9813,10 @@ syms_of_keyboard ()
}
}
button_down_location = Fmake_vector (make_number (NUM_MOUSE_BUTTONS), Qnil);
button_down_location = Fmake_vector (make_number (1), Qnil);
staticpro (&button_down_location);
mouse_syms = Fmake_vector (make_number (1), Qnil);
staticpro (&mouse_syms);
{
int i;
......@@ -9840,9 +9852,6 @@ syms_of_keyboard ()
func_key_syms = Qnil;
staticpro (&func_key_syms);
mouse_syms = Qnil;
staticpro (&mouse_syms);
#ifdef WINDOWSNT
mouse_wheel_syms = Qnil;
staticpro (&mouse_wheel_syms);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment