aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-04-03 12:11:39 +0000
committerGerd Moellmann2000-04-03 12:11:39 +0000
commit8e1e42402f950a4ba4653fa75a988be527a391c4 (patch)
treec98f7725e2b037e961e8844dc343acb61b26189a /src
parent843930b70c7dfe1bce34ba744463ddb09dda4e47 (diff)
downloademacs-8e1e42402f950a4ba4653fa75a988be527a391c4.tar.gz
emacs-8e1e42402f950a4ba4653fa75a988be527a391c4.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c77
1 files changed, 43 insertions, 34 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 9aefce58f9b..1a9d751202e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -4085,12 +4085,7 @@ static char *iso_lispy_function_keys[] =
4085 4085
4086#endif /* not HAVE_NTGUI */ 4086#endif /* not HAVE_NTGUI */
4087 4087
4088static char *lispy_mouse_names[] = 4088Lisp_Object Vlispy_mouse_stem;
4089{
4090 "mouse-1", "mouse-2", "mouse-3", "mouse-4", "mouse-5",
4091 "mouse-6", "mouse-7", "mouse-8", "mouse-9", "mouse-10",
4092 "mouse-11", "mouse-12", "mouse-13", "mouse-14", "mouse-15"
4093};
4094 4089
4095#ifdef WINDOWSNT 4090#ifdef WINDOWSNT
4096/* mouse-wheel events are generated by the wheel on devices such as 4091/* mouse-wheel events are generated by the wheel on devices such as
@@ -4276,9 +4271,6 @@ make_lispy_event (event)
4276 Lisp_Object *start_pos_ptr; 4271 Lisp_Object *start_pos_ptr;
4277 Lisp_Object start_pos; 4272 Lisp_Object start_pos;
4278 4273
4279 if (button < 0 || button >= NUM_MOUSE_BUTTONS)
4280 abort ();
4281
4282 /* Build the position as appropriate for this mouse click. */ 4274 /* Build the position as appropriate for this mouse click. */
4283 if (event->kind == mouse_click) 4275 if (event->kind == mouse_click)
4284 { 4276 {
@@ -4430,6 +4422,13 @@ make_lispy_event (event)
4430 } 4422 }
4431#endif /* not USE_TOOLKIT_SCROLL_BARS */ 4423#endif /* not USE_TOOLKIT_SCROLL_BARS */
4432 4424
4425 if (button >= XVECTOR (button_down_location)->size)
4426 {
4427 button_down_location = larger_vector (button_down_location,
4428 button + 1, Qnil);
4429 mouse_syms = larger_vector (mouse_syms, button + 1, Qnil);
4430 }
4431
4433 start_pos_ptr = &XVECTOR (button_down_location)->contents[button]; 4432 start_pos_ptr = &XVECTOR (button_down_location)->contents[button];
4434 4433
4435 start_pos = *start_pos_ptr; 4434 start_pos = *start_pos_ptr;
@@ -4519,10 +4518,10 @@ make_lispy_event (event)
4519 4518
4520 head = modify_event_symbol (button, 4519 head = modify_event_symbol (button,
4521 event->modifiers, 4520 event->modifiers,
4522 Qmouse_click, Qnil, 4521 Qmouse_click, Vlispy_mouse_stem,
4523 lispy_mouse_names, &mouse_syms, 4522 NULL,
4524 (sizeof (lispy_mouse_names) 4523 &mouse_syms,
4525 / sizeof (lispy_mouse_names[0]))); 4524 XVECTOR (mouse_syms)->size);
4526 if (event->modifiers & drag_modifier) 4525 if (event->modifiers & drag_modifier)
4527 return Fcons (head, 4526 return Fcons (head,
4528 Fcons (start_pos, 4527 Fcons (start_pos,
@@ -4580,10 +4579,10 @@ make_lispy_event (event)
4580 /* Get the symbol we should use for the mouse click. */ 4579 /* Get the symbol we should use for the mouse click. */
4581 head = modify_event_symbol (event->code, 4580 head = modify_event_symbol (event->code,
4582 event->modifiers, 4581 event->modifiers,
4583 Qmouse_click, Qnil, 4582 Qmouse_click,
4584 lispy_mouse_names, &mouse_syms, 4583 Vlispy_mouse_stem,
4585 (sizeof (lispy_mouse_names) 4584 NULL, &mouse_syms,
4586 / sizeof (lispy_mouse_names[0]))); 4585 XVECTOR (mouse_syms)->size);
4587 return Fcons (head, Fcons (position, Qnil)); 4586 return Fcons (head, Fcons (position, Qnil));
4588 } 4587 }
4589 4588
@@ -4598,9 +4597,6 @@ make_lispy_event (event)
4598 Lisp_Object *start_pos_ptr; 4597 Lisp_Object *start_pos_ptr;
4599 Lisp_Object start_pos; 4598 Lisp_Object start_pos;
4600 4599
4601 if (button < 0 || button >= NUM_MOUSE_BUTTONS)
4602 abort ();
4603
4604 { 4600 {
4605 Lisp_Object window; 4601 Lisp_Object window;
4606 Lisp_Object portion_whole; 4602 Lisp_Object portion_whole;
@@ -4627,10 +4623,10 @@ make_lispy_event (event)
4627 4623
4628 head = modify_event_symbol (button, 4624 head = modify_event_symbol (button,
4629 event->modifiers, 4625 event->modifiers,
4630 Qmouse_click, Qnil, 4626 Qmouse_click,
4631 lispy_mouse_names, &mouse_syms, 4627 Vlispy_mouse_stem,
4632 (sizeof (lispy_mouse_names) 4628 NULL, &mouse_syms,
4633 / sizeof (lispy_mouse_names[0]))); 4629 XVECTOR (mouse_syms)->size);
4634 return Fcons (head, 4630 return Fcons (head,
4635 Fcons (position, 4631 Fcons (position,
4636 Qnil)); 4632 Qnil));
@@ -5220,8 +5216,11 @@ reorder_modifiers (symbol)
5220 is the name of the i'th symbol. TABLE_SIZE is the number of elements 5216 is the name of the i'th symbol. TABLE_SIZE is the number of elements
5221 in the table. 5217 in the table.
5222 5218
5223 Alternatively, NAME_ALIST is an alist mapping codes into symbol names. 5219 Alternatively, NAME_ALIST_OR_STEM is either an alist mapping codes
5224 NAME_ALIST is used if it is non-nil; otherwise NAME_TABLE is used. 5220 into symbol names, or a string specifying a name stem used to
5221 contruct a symbol name or the form `STEM-N', where N is the decimal
5222 representation of SYMBOL_NUM. NAME_ALIST_OR_STEM is used if it is
5223 non-nil; otherwise NAME_TABLE is used.
5225 5224
5226 SYMBOL_TABLE should be a pointer to a Lisp_Object whose value will 5225 SYMBOL_TABLE should be a pointer to a Lisp_Object whose value will
5227 persist between calls to modify_event_symbol that it can use to 5226 persist between calls to modify_event_symbol that it can use to
@@ -5241,12 +5240,12 @@ reorder_modifiers (symbol)
5241 in the symbol's name. */ 5240 in the symbol's name. */
5242 5241
5243static Lisp_Object 5242static Lisp_Object
5244modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist, 5243modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist_or_stem,
5245 name_table, symbol_table, table_size) 5244 name_table, symbol_table, table_size)
5246 int symbol_num; 5245 int symbol_num;
5247 unsigned modifiers; 5246 unsigned modifiers;
5248 Lisp_Object symbol_kind; 5247 Lisp_Object symbol_kind;
5249 Lisp_Object name_alist; 5248 Lisp_Object name_alist_or_stem;
5250 char **name_table; 5249 char **name_table;
5251 Lisp_Object *symbol_table; 5250 Lisp_Object *symbol_table;
5252 unsigned int table_size; 5251 unsigned int table_size;
@@ -5286,8 +5285,16 @@ modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist,
5286 if (NILP (value)) 5285 if (NILP (value))
5287 { 5286 {
5288 /* No; let's create it. */ 5287 /* No; let's create it. */
5289 if (!NILP (name_alist)) 5288 if (CONSP (name_alist_or_stem))
5290 value = Fcdr_safe (Fassq (symbol_int, name_alist)); 5289 value = Fcdr_safe (Fassq (symbol_int, name_alist_or_stem));
5290 else if (STRINGP (name_alist_or_stem))
5291 {
5292 int len = STRING_BYTES (XSTRING (name_alist_or_stem));
5293 char *buf = (char *) alloca (len + 50);
5294 sprintf (buf, "%s-%d", XSTRING (name_alist_or_stem)->data,
5295 XINT (symbol_int) + 1);
5296 value = intern (buf);
5297 }
5291 else if (name_table != 0 && name_table[symbol_num]) 5298 else if (name_table != 0 && name_table[symbol_num])
5292 value = intern (name_table[symbol_num]); 5299 value = intern (name_table[symbol_num]);
5293 5300
@@ -9638,6 +9645,9 @@ struct event_head head_table[] = {
9638void 9645void
9639syms_of_keyboard () 9646syms_of_keyboard ()
9640{ 9647{
9648 Vlispy_mouse_stem = build_string ("mouse");
9649 staticpro (&Vlispy_mouse_stem);
9650
9641 /* Tool-bars. */ 9651 /* Tool-bars. */
9642 QCimage = intern (":image"); 9652 QCimage = intern (":image");
9643 staticpro (&QCimage); 9653 staticpro (&QCimage);
@@ -9803,8 +9813,10 @@ syms_of_keyboard ()
9803 } 9813 }
9804 } 9814 }
9805 9815
9806 button_down_location = Fmake_vector (make_number (NUM_MOUSE_BUTTONS), Qnil); 9816 button_down_location = Fmake_vector (make_number (1), Qnil);
9807 staticpro (&button_down_location); 9817 staticpro (&button_down_location);
9818 mouse_syms = Fmake_vector (make_number (1), Qnil);
9819 staticpro (&mouse_syms);
9808 9820
9809 { 9821 {
9810 int i; 9822 int i;
@@ -9840,9 +9852,6 @@ syms_of_keyboard ()
9840 func_key_syms = Qnil; 9852 func_key_syms = Qnil;
9841 staticpro (&func_key_syms); 9853 staticpro (&func_key_syms);
9842 9854
9843 mouse_syms = Qnil;
9844 staticpro (&mouse_syms);
9845
9846#ifdef WINDOWSNT 9855#ifdef WINDOWSNT
9847 mouse_wheel_syms = Qnil; 9856 mouse_wheel_syms = Qnil;
9848 staticpro (&mouse_wheel_syms); 9857 staticpro (&mouse_wheel_syms);