aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c278
1 files changed, 135 insertions, 143 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 7f770ae4df1..17819170640 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -144,10 +144,6 @@ int this_single_command_key_start;
144static int before_command_key_count; 144static int before_command_key_count;
145static int before_command_echo_length; 145static int before_command_echo_length;
146 146
147extern int minbuf_level;
148
149extern int message_enable_multibyte;
150
151/* If non-nil, the function that implements the display of help. 147/* If non-nil, the function that implements the display of help.
152 It's called with one argument, the help string to display. */ 148 It's called with one argument, the help string to display. */
153 149
@@ -431,8 +427,6 @@ FILE *dribble;
431/* Nonzero if input is available. */ 427/* Nonzero if input is available. */
432int input_pending; 428int input_pending;
433 429
434extern char *pending_malloc_warning;
435
436/* Circular buffer for pre-read keyboard input. */ 430/* Circular buffer for pre-read keyboard input. */
437 431
438static struct input_event kbd_buffer[KBD_BUFFER_SIZE]; 432static struct input_event kbd_buffer[KBD_BUFFER_SIZE];
@@ -495,10 +489,10 @@ Lisp_Object Qconfig_changed_event;
495Lisp_Object Qevent_kind; 489Lisp_Object Qevent_kind;
496Lisp_Object Qevent_symbol_elements; 490Lisp_Object Qevent_symbol_elements;
497 491
498/* menu item parts */ 492/* menu and tool bar item parts */
499Lisp_Object Qmenu_enable; 493Lisp_Object Qmenu_enable;
500Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence; 494Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence;
501Lisp_Object QCbutton, QCtoggle, QCradio, QClabel; 495Lisp_Object QCbutton, QCtoggle, QCradio, QClabel, QCvert_only;
502 496
503/* An event header symbol HEAD may have a property named 497/* An event header symbol HEAD may have a property named
504 Qevent_symbol_element_mask, which is of the form (BASE MODIFIERS); 498 Qevent_symbol_element_mask, which is of the form (BASE MODIFIERS);
@@ -620,7 +614,7 @@ static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object,
620 unsigned long); 614 unsigned long);
621#endif 615#endif
622static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object, 616static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object,
623 Lisp_Object, const char **, 617 Lisp_Object, const char *const *,
624 Lisp_Object *, unsigned); 618 Lisp_Object *, unsigned);
625static Lisp_Object make_lispy_switch_frame (Lisp_Object); 619static Lisp_Object make_lispy_switch_frame (Lisp_Object);
626static void save_getcjmp (jmp_buf); 620static void save_getcjmp (jmp_buf);
@@ -3601,6 +3595,7 @@ event_to_kboard (struct input_event *event)
3601 return FRAME_KBOARD (XFRAME (frame)); 3595 return FRAME_KBOARD (XFRAME (frame));
3602} 3596}
3603 3597
3598#ifdef subprocesses
3604/* Return the number of slots occupied in kbd_buffer. */ 3599/* Return the number of slots occupied in kbd_buffer. */
3605 3600
3606static int 3601static int
@@ -3613,6 +3608,7 @@ kbd_buffer_nr_stored (void)
3613 : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr 3608 : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr
3614 + (kbd_store_ptr - kbd_buffer))); 3609 + (kbd_store_ptr - kbd_buffer)));
3615} 3610}
3611#endif /* subprocesses */
3616 3612
3617Lisp_Object Vthrow_on_input; 3613Lisp_Object Vthrow_on_input;
3618 3614
@@ -3734,6 +3730,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3734 { 3730 {
3735 *kbd_store_ptr = *event; 3731 *kbd_store_ptr = *event;
3736 ++kbd_store_ptr; 3732 ++kbd_store_ptr;
3733#ifdef subprocesses
3737 if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ()) 3734 if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ())
3738 { 3735 {
3739 /* Don't read keyboard input until we have processed kbd_buffer. 3736 /* Don't read keyboard input until we have processed kbd_buffer.
@@ -3745,6 +3742,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3745#endif 3742#endif
3746 stop_polling (); 3743 stop_polling ();
3747 } 3744 }
3745#endif /* subprocesses */
3748 } 3746 }
3749 3747
3750 /* If we're inside while-no-input, and this event qualifies 3748 /* If we're inside while-no-input, and this event qualifies
@@ -3905,6 +3903,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3905 register int c; 3903 register int c;
3906 Lisp_Object obj; 3904 Lisp_Object obj;
3907 3905
3906#ifdef subprocesses
3908 if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4) 3907 if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4)
3909 { 3908 {
3910 /* Start reading input again, we have processed enough so we can 3909 /* Start reading input again, we have processed enough so we can
@@ -3916,6 +3915,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3916#endif /* SIGIO */ 3915#endif /* SIGIO */
3917 start_polling (); 3916 start_polling ();
3918 } 3917 }
3918#endif /* subprocesses */
3919 3919
3920 if (noninteractive 3920 if (noninteractive
3921 /* In case we are running as a daemon, only do this before 3921 /* In case we are running as a daemon, only do this before
@@ -4752,7 +4752,7 @@ static const int lispy_accent_codes[] =
4752/* This is a list of Lisp names for special "accent" characters. 4752/* This is a list of Lisp names for special "accent" characters.
4753 It parallels lispy_accent_codes. */ 4753 It parallels lispy_accent_codes. */
4754 4754
4755static const char *lispy_accent_keys[] = 4755static const char *const lispy_accent_keys[] =
4756{ 4756{
4757 "dead-circumflex", 4757 "dead-circumflex",
4758 "dead-grave", 4758 "dead-grave",
@@ -4779,7 +4779,7 @@ static const char *lispy_accent_keys[] =
4779#ifdef HAVE_NTGUI 4779#ifdef HAVE_NTGUI
4780#define FUNCTION_KEY_OFFSET 0x0 4780#define FUNCTION_KEY_OFFSET 0x0
4781 4781
4782char const *lispy_function_keys[] = 4782const char *const lispy_function_keys[] =
4783 { 4783 {
4784 0, /* 0 */ 4784 0, /* 0 */
4785 4785
@@ -4973,7 +4973,7 @@ char const *lispy_function_keys[] =
4973 4973
4974/* Some of these duplicate the "Media keys" on newer keyboards, 4974/* Some of these duplicate the "Media keys" on newer keyboards,
4975 but they are delivered to the application in a different way. */ 4975 but they are delivered to the application in a different way. */
4976static const char *lispy_multimedia_keys[] = 4976static const char *const lispy_multimedia_keys[] =
4977 { 4977 {
4978 0, 4978 0,
4979 "browser-back", 4979 "browser-back",
@@ -5037,7 +5037,7 @@ static const char *lispy_multimedia_keys[] =
5037 the XK_kana_A case below. */ 5037 the XK_kana_A case below. */
5038#if 0 5038#if 0
5039#ifdef XK_kana_A 5039#ifdef XK_kana_A
5040static const char *lispy_kana_keys[] = 5040static const char *const lispy_kana_keys[] =
5041 { 5041 {
5042 /* X Keysym value */ 5042 /* X Keysym value */
5043 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x400 .. 0x40f */ 5043 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x400 .. 0x40f */
@@ -5076,7 +5076,7 @@ static const char *lispy_kana_keys[] =
5076 5076
5077/* You'll notice that this table is arranged to be conveniently 5077/* You'll notice that this table is arranged to be conveniently
5078 indexed by X Windows keysym values. */ 5078 indexed by X Windows keysym values. */
5079static const char *lispy_function_keys[] = 5079static const char *const lispy_function_keys[] =
5080 { 5080 {
5081 /* X Keysym value */ 5081 /* X Keysym value */
5082 5082
@@ -5162,7 +5162,7 @@ static const char *lispy_function_keys[] =
5162/* ISO 9995 Function and Modifier Keys; the first byte is 0xFE. */ 5162/* ISO 9995 Function and Modifier Keys; the first byte is 0xFE. */
5163#define ISO_FUNCTION_KEY_OFFSET 0xfe00 5163#define ISO_FUNCTION_KEY_OFFSET 0xfe00
5164 5164
5165static const char *iso_lispy_function_keys[] = 5165static const char *const iso_lispy_function_keys[] =
5166 { 5166 {
5167 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe00 */ 5167 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe00 */
5168 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe08 */ 5168 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe08 */
@@ -5185,14 +5185,14 @@ static const char *iso_lispy_function_keys[] =
5185 5185
5186Lisp_Object Vlispy_mouse_stem; 5186Lisp_Object Vlispy_mouse_stem;
5187 5187
5188static const char *lispy_wheel_names[] = 5188static const char *const lispy_wheel_names[] =
5189{ 5189{
5190 "wheel-up", "wheel-down", "wheel-left", "wheel-right" 5190 "wheel-up", "wheel-down", "wheel-left", "wheel-right"
5191}; 5191};
5192 5192
5193/* drag-n-drop events are generated when a set of selected files are 5193/* drag-n-drop events are generated when a set of selected files are
5194 dragged from another application and dropped onto an Emacs window. */ 5194 dragged from another application and dropped onto an Emacs window. */
5195static const char *lispy_drag_n_drop_names[] = 5195static const char *const lispy_drag_n_drop_names[] =
5196{ 5196{
5197 "drag-n-drop" 5197 "drag-n-drop"
5198}; 5198};
@@ -5203,7 +5203,7 @@ Lisp_Object Qup, Qdown, Qbottom, Qend_scroll;
5203Lisp_Object Qtop, Qratio; 5203Lisp_Object Qtop, Qratio;
5204 5204
5205/* An array of scroll bar parts, indexed by an enum scroll_bar_part value. */ 5205/* An array of scroll bar parts, indexed by an enum scroll_bar_part value. */
5206const Lisp_Object *scroll_bar_parts[] = { 5206static Lisp_Object *const scroll_bar_parts[] = {
5207 &Qabove_handle, &Qhandle, &Qbelow_handle, 5207 &Qabove_handle, &Qhandle, &Qbelow_handle,
5208 &Qup, &Qdown, &Qtop, &Qbottom, &Qend_scroll, &Qratio 5208 &Qup, &Qdown, &Qtop, &Qbottom, &Qend_scroll, &Qratio
5209}; 5209};
@@ -5243,24 +5243,22 @@ EMACS_INT double_click_fuzz;
5243 5243
5244int double_click_count; 5244int double_click_count;
5245 5245
5246/* Return position of a mouse click or wheel event */ 5246/* X and Y are frame-relative coordinates for a click or wheel event.
5247 Return a Lisp-style event list. */
5247 5248
5248static Lisp_Object 5249static Lisp_Object
5249make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, 5250make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5250 unsigned long time) 5251 unsigned long time)
5251{ 5252{
5252 Lisp_Object window;
5253 enum window_part part; 5253 enum window_part part;
5254 Lisp_Object posn = Qnil; 5254 Lisp_Object posn = Qnil;
5255 Lisp_Object extra_info = Qnil; 5255 Lisp_Object extra_info = Qnil;
5256 int wx, wy; 5256 /* Coordinate pixel positions to return. */
5257 5257 int xret = 0, yret = 0;
5258 /* Set `window' to the window under frame pixel coordinates (x,y) */ 5258 /* The window under frame pixel coordinates (x,y) */
5259 if (f) 5259 Lisp_Object window = f
5260 window = window_from_coordinates (f, XINT (*x), XINT (*y), 5260 ? window_from_coordinates (f, XINT (x), XINT (y), &part, 0)
5261 &part, &wx, &wy, 0); 5261 : Qnil;
5262 else
5263 window = Qnil;
5264 5262
5265 if (WINDOWP (window)) 5263 if (WINDOWP (window))
5266 { 5264 {
@@ -5268,102 +5266,114 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y,
5268 struct window *w = XWINDOW (window); 5266 struct window *w = XWINDOW (window);
5269 Lisp_Object string_info = Qnil; 5267 Lisp_Object string_info = Qnil;
5270 EMACS_INT textpos = -1; 5268 EMACS_INT textpos = -1;
5271 int rx = -1, ry = -1; 5269 int col = -1, row = -1;
5272 int dx = -1, dy = -1; 5270 int dx = -1, dy = -1;
5273 int width = -1, height = -1; 5271 int width = -1, height = -1;
5274 Lisp_Object object = Qnil; 5272 Lisp_Object object = Qnil;
5275 5273
5276 /* Set event coordinates to window-relative coordinates 5274 /* Pixel coordinates relative to the window corner. */
5277 for constructing the Lisp event below. */ 5275 int wx = XINT (x) - WINDOW_LEFT_EDGE_X (w);
5278 XSETINT (*x, wx); 5276 int wy = XINT (y) - WINDOW_TOP_EDGE_Y (w);
5279 XSETINT (*y, wy);
5280 5277
5278 /* For text area clicks, return X, Y relative to the corner of
5279 this text area. Note that dX, dY etc are set below, by
5280 buffer_posn_from_coords. */
5281 if (part == ON_TEXT) 5281 if (part == ON_TEXT)
5282 { 5282 {
5283 wx += WINDOW_LEFT_MARGIN_WIDTH (w); 5283 xret = XINT (x) - window_box_left (w, TEXT_AREA);
5284 yret = wy - WINDOW_HEADER_LINE_HEIGHT (w);
5284 } 5285 }
5286 /* For mode line and header line clicks, return X, Y relative to
5287 the left window edge. Use mode_line_string to look for a
5288 string on the click position. */
5285 else if (part == ON_MODE_LINE || part == ON_HEADER_LINE) 5289 else if (part == ON_MODE_LINE || part == ON_HEADER_LINE)
5286 { 5290 {
5287 /* Mode line or header line. Look for a string under
5288 the mouse that may have a `local-map' property. */
5289 Lisp_Object string; 5291 Lisp_Object string;
5290 EMACS_INT charpos; 5292 EMACS_INT charpos;
5291 5293
5292 posn = part == ON_MODE_LINE ? Qmode_line : Qheader_line; 5294 posn = (part == ON_MODE_LINE) ? Qmode_line : Qheader_line;
5293 rx = wx, ry = wy; 5295 /* Note that mode_line_string takes COL, ROW as pixels and
5294 string = mode_line_string (w, part, &rx, &ry, &charpos, 5296 converts them to characters. */
5297 col = wx;
5298 row = wy;
5299 string = mode_line_string (w, part, &col, &row, &charpos,
5295 &object, &dx, &dy, &width, &height); 5300 &object, &dx, &dy, &width, &height);
5296 if (STRINGP (string)) 5301 if (STRINGP (string))
5297 string_info = Fcons (string, make_number (charpos)); 5302 string_info = Fcons (string, make_number (charpos));
5298 if (w == XWINDOW (selected_window) 5303 textpos = (w == XWINDOW (selected_window)
5299 && current_buffer == XBUFFER (w->buffer)) 5304 && current_buffer == XBUFFER (w->buffer))
5300 textpos = PT; 5305 ? PT : XMARKER (w->pointm)->charpos;
5301 else 5306
5302 textpos = XMARKER (w->pointm)->charpos; 5307 xret = wx;
5303 } 5308 yret = wy;
5304 else if (part == ON_VERTICAL_BORDER)
5305 {
5306 posn = Qvertical_line;
5307 wx = -1;
5308 dx = 0;
5309 width = 1;
5310 } 5309 }
5310 /* For fringes and margins, Y is relative to the area's (and the
5311 window's) top edge, while X is meaningless. */
5311 else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) 5312 else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN)
5312 { 5313 {
5313 Lisp_Object string; 5314 Lisp_Object string;
5314 EMACS_INT charpos; 5315 EMACS_INT charpos;
5315 5316
5316 posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; 5317 posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin;
5317 rx = wx, ry = wy; 5318 col = wx;
5318 string = marginal_area_string (w, part, &rx, &ry, &charpos, 5319 row = wy;
5320 string = marginal_area_string (w, part, &col, &row, &charpos,
5319 &object, &dx, &dy, &width, &height); 5321 &object, &dx, &dy, &width, &height);
5320 if (STRINGP (string)) 5322 if (STRINGP (string))
5321 string_info = Fcons (string, make_number (charpos)); 5323 string_info = Fcons (string, make_number (charpos));
5322 if (part == ON_LEFT_MARGIN) 5324 yret = wy - WINDOW_HEADER_LINE_HEIGHT (w);
5323 wx = 0;
5324 else
5325 wx = window_box_right_offset (w, TEXT_AREA) - 1;
5326 } 5325 }
5327 else if (part == ON_LEFT_FRINGE) 5326 else if (part == ON_LEFT_FRINGE)
5328 { 5327 {
5329 posn = Qleft_fringe; 5328 posn = Qleft_fringe;
5330 rx = 0; 5329 col = 0;
5331 dx = wx; 5330 dx = wx
5332 wx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) 5331 - (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
5333 ? 0 5332 ? 0 : window_box_width (w, LEFT_MARGIN_AREA));
5334 : window_box_width (w, LEFT_MARGIN_AREA)); 5333 dy = yret = wy - WINDOW_HEADER_LINE_HEIGHT (w);
5335 dx -= wx;
5336 } 5334 }
5337 else if (part == ON_RIGHT_FRINGE) 5335 else if (part == ON_RIGHT_FRINGE)
5338 { 5336 {
5339 posn = Qright_fringe; 5337 posn = Qright_fringe;
5340 rx = 0; 5338 col = 0;
5341 dx = wx; 5339 dx = wx
5342 wx = (window_box_width (w, LEFT_MARGIN_AREA) 5340 - window_box_width (w, LEFT_MARGIN_AREA)
5343 + window_box_width (w, TEXT_AREA) 5341 - window_box_width (w, TEXT_AREA)
5344 + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) 5342 - (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
5345 ? window_box_width (w, RIGHT_MARGIN_AREA) 5343 ? window_box_width (w, RIGHT_MARGIN_AREA)
5346 : 0)); 5344 : 0);
5347 dx -= wx; 5345 dy = yret = wy - WINDOW_HEADER_LINE_HEIGHT (w);
5348 } 5346 }
5349 else 5347 else if (part == ON_VERTICAL_BORDER)
5350 { 5348 {
5351 /* Note: We have no special posn for part == ON_SCROLL_BAR. */ 5349 posn = Qvertical_line;
5352 wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); 5350 width = 1;
5351 dx = 0;
5352 dy = yret = wy;
5353 } 5353 }
5354 /* Nothing special for part == ON_SCROLL_BAR. */
5354 5355
5356 /* For clicks in the text area, fringes, or margins, call
5357 buffer_posn_from_coords to extract TEXTPOS, the buffer
5358 position nearest to the click. */
5355 if (textpos < 0) 5359 if (textpos < 0)
5356 { 5360 {
5357 Lisp_Object string2, object2 = Qnil; 5361 Lisp_Object string2, object2 = Qnil;
5358 struct display_pos p; 5362 struct display_pos p;
5359 int dx2, dy2; 5363 int dx2, dy2;
5360 int width2, height2; 5364 int width2, height2;
5361 string2 = buffer_posn_from_coords (w, &wx, &wy, &p, 5365 /* The pixel X coordinate passed to buffer_posn_from_coords
5366 is the X coordinate relative to the text area for
5367 text-area clicks, zero otherwise. */
5368 int x2 = (part == ON_TEXT) ? xret : 0;
5369 int y2 = wy;
5370
5371 string2 = buffer_posn_from_coords (w, &x2, &y2, &p,
5362 &object2, &dx2, &dy2, 5372 &object2, &dx2, &dy2,
5363 &width2, &height2); 5373 &width2, &height2);
5364 textpos = CHARPOS (p.pos); 5374 textpos = CHARPOS (p.pos);
5365 if (rx < 0) rx = wx; 5375 if (col < 0) col = x2;
5366 if (ry < 0) ry = wy; 5376 if (row < 0) row = y2;
5367 if (dx < 0) dx = dx2; 5377 if (dx < 0) dx = dx2;
5368 if (dy < 0) dy = dy2; 5378 if (dy < 0) dy = dy2;
5369 if (width < 0) width = width2; 5379 if (width < 0) width = width2;
@@ -5394,34 +5404,27 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y,
5394#endif 5404#endif
5395 5405
5396 /* Object info */ 5406 /* Object info */
5397 extra_info = Fcons (object, 5407 extra_info
5398 Fcons (Fcons (make_number (dx), 5408 = list3 (object,
5399 make_number (dy)), 5409 Fcons (make_number (dx), make_number (dy)),
5400 Fcons (Fcons (make_number (width), 5410 Fcons (make_number (width), make_number (height)));
5401 make_number (height)),
5402 Qnil)));
5403 5411
5404 /* String info */ 5412 /* String info */
5405 extra_info = Fcons (string_info, 5413 extra_info = Fcons (string_info,
5406 Fcons (make_number (textpos), 5414 Fcons (make_number (textpos),
5407 Fcons (Fcons (make_number (rx), 5415 Fcons (Fcons (make_number (col),
5408 make_number (ry)), 5416 make_number (row)),
5409 extra_info))); 5417 extra_info)));
5410 } 5418 }
5411 else if (f != 0) 5419 else if (f != 0)
5412 { 5420 XSETFRAME (window, f);
5413 XSETFRAME (window, f);
5414 }
5415 else 5421 else
5416 { 5422 window = Qnil;
5417 window = Qnil;
5418 XSETFASTINT (*x, 0);
5419 XSETFASTINT (*y, 0);
5420 }
5421 5423
5422 return Fcons (window, 5424 return Fcons (window,
5423 Fcons (posn, 5425 Fcons (posn,
5424 Fcons (Fcons (*x, *y), 5426 Fcons (Fcons (make_number (xret),
5427 make_number (yret)),
5425 Fcons (make_number (time), 5428 Fcons (make_number (time),
5426 extra_info)))); 5429 extra_info))));
5427} 5430}
@@ -5610,14 +5613,6 @@ make_lispy_event (struct input_event *event)
5610 int hpos; 5613 int hpos;
5611 int i; 5614 int i;
5612 5615
5613#if 0
5614 /* Activate the menu bar on the down event. If the
5615 up event comes in before the menu code can deal with it,
5616 just ignore it. */
5617 if (! (event->modifiers & down_modifier))
5618 return Qnil;
5619#endif
5620
5621 /* Find the menu bar item under `column'. */ 5616 /* Find the menu bar item under `column'. */
5622 item = Qnil; 5617 item = Qnil;
5623 items = FRAME_MENU_BAR_ITEMS (f); 5618 items = FRAME_MENU_BAR_ITEMS (f);
@@ -5649,7 +5644,7 @@ make_lispy_event (struct input_event *event)
5649 } 5644 }
5650#endif /* not USE_X_TOOLKIT && not USE_GTK && not HAVE_NS */ 5645#endif /* not USE_X_TOOLKIT && not USE_GTK && not HAVE_NS */
5651 5646
5652 position = make_lispy_position (f, &event->x, &event->y, 5647 position = make_lispy_position (f, event->x, event->y,
5653 event->timestamp); 5648 event->timestamp);
5654 } 5649 }
5655#ifndef USE_TOOLKIT_SCROLL_BARS 5650#ifndef USE_TOOLKIT_SCROLL_BARS
@@ -5749,23 +5744,21 @@ make_lispy_event (struct input_event *event)
5749 return Qnil; 5744 return Qnil;
5750 5745
5751 event->modifiers &= ~up_modifier; 5746 event->modifiers &= ~up_modifier;
5752#if 0 /* Formerly we treated an up with no down as a click event. */ 5747
5753 if (!CONSP (start_pos))
5754 event->modifiers |= click_modifier;
5755 else
5756#endif
5757 { 5748 {
5758 Lisp_Object down; 5749 Lisp_Object new_down, down;
5759 EMACS_INT xdiff = double_click_fuzz, ydiff = double_click_fuzz; 5750 EMACS_INT xdiff = double_click_fuzz, ydiff = double_click_fuzz;
5760 5751
5761 /* The third element of every position 5752 /* The third element of every position
5762 should be the (x,y) pair. */ 5753 should be the (x,y) pair. */
5763 down = Fcar (Fcdr (Fcdr (start_pos))); 5754 down = Fcar (Fcdr (Fcdr (start_pos)));
5755 new_down = Fcar (Fcdr (Fcdr (position)));
5756
5764 if (CONSP (down) 5757 if (CONSP (down)
5765 && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down))) 5758 && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down)))
5766 { 5759 {
5767 xdiff = XINT (event->x) - XINT (XCAR (down)); 5760 xdiff = XINT (XCAR (new_down)) - XINT (XCAR (down));
5768 ydiff = XINT (event->y) - XINT (XCDR (down)); 5761 ydiff = XINT (XCDR (new_down)) - XINT (XCDR (down));
5769 } 5762 }
5770 5763
5771 if (ignore_mouse_drag_p) 5764 if (ignore_mouse_drag_p)
@@ -5848,7 +5841,7 @@ make_lispy_event (struct input_event *event)
5848 if (! FRAME_LIVE_P (f)) 5841 if (! FRAME_LIVE_P (f))
5849 return Qnil; 5842 return Qnil;
5850 5843
5851 position = make_lispy_position (f, &event->x, &event->y, 5844 position = make_lispy_position (f, event->x, event->y,
5852 event->timestamp); 5845 event->timestamp);
5853 5846
5854 /* Set double or triple modifiers to indicate the wheel speed. */ 5847 /* Set double or triple modifiers to indicate the wheel speed. */
@@ -5868,10 +5861,8 @@ make_lispy_event (struct input_event *event)
5868 else 5861 else
5869 abort (); 5862 abort ();
5870 5863
5871 if (FRAME_WINDOW_P (f)) 5864 fuzz = FRAME_WINDOW_P (f)
5872 fuzz = double_click_fuzz; 5865 ? double_click_fuzz : double_click_fuzz / 8;
5873 else
5874 fuzz = double_click_fuzz / 8;
5875 5866
5876 if (event->modifiers & up_modifier) 5867 if (event->modifiers & up_modifier)
5877 { 5868 {
@@ -6009,7 +6000,7 @@ make_lispy_event (struct input_event *event)
6009 if (! FRAME_LIVE_P (f)) 6000 if (! FRAME_LIVE_P (f))
6010 return Qnil; 6001 return Qnil;
6011 6002
6012 position = make_lispy_position (f, &event->x, &event->y, 6003 position = make_lispy_position (f, event->x, event->y,
6013 event->timestamp); 6004 event->timestamp);
6014 6005
6015 head = modify_event_symbol (0, event->modifiers, 6006 head = modify_event_symbol (0, event->modifiers,
@@ -6092,8 +6083,8 @@ make_lispy_event (struct input_event *event)
6092 start_pos_ptr = &AREF (button_down_location, button); 6083 start_pos_ptr = &AREF (button_down_location, button);
6093 start_pos = *start_pos_ptr; 6084 start_pos = *start_pos_ptr;
6094 6085
6095 position = make_lispy_position (f, &event->x, &event->y, 6086 position = make_lispy_position (f, event->x, event->y,
6096 event->timestamp); 6087 event->timestamp);
6097 6088
6098 if (event->modifiers & down_modifier) 6089 if (event->modifiers & down_modifier)
6099 *start_pos_ptr = Fcopy_alist (position); 6090 *start_pos_ptr = Fcopy_alist (position);
@@ -6152,25 +6143,19 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa
6152 6143
6153 part_sym = *scroll_bar_parts[(int) part]; 6144 part_sym = *scroll_bar_parts[(int) part];
6154 return Fcons (Qscroll_bar_movement, 6145 return Fcons (Qscroll_bar_movement,
6155 (Fcons (Fcons (bar_window, 6146 Fcons (list5 (bar_window,
6156 Fcons (Qvertical_scroll_bar, 6147 Qvertical_scroll_bar,
6157 Fcons (Fcons (x, y), 6148 Fcons (x, y),
6158 Fcons (make_number (time), 6149 make_number (time),
6159 Fcons (part_sym, 6150 part_sym),
6160 Qnil))))), 6151 Qnil));
6161 Qnil)));
6162 } 6152 }
6163
6164 /* Or is it an ordinary mouse movement? */ 6153 /* Or is it an ordinary mouse movement? */
6165 else 6154 else
6166 { 6155 {
6167 Lisp_Object position; 6156 Lisp_Object position;
6168 6157 position = make_lispy_position (frame, x, y, time);
6169 position = make_lispy_position (frame, &x, &y, time); 6158 return list2 (Qmouse_movement, position);
6170
6171 return Fcons (Qmouse_movement,
6172 Fcons (position,
6173 Qnil));
6174 } 6159 }
6175} 6160}
6176 6161
@@ -6351,7 +6336,7 @@ apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_
6351} 6336}
6352 6337
6353 6338
6354static const char *modifier_names[] = 6339static const char *const modifier_names[] =
6355{ 6340{
6356 "up", "down", "drag", "click", "double", "triple", 0, 0, 6341 "up", "down", "drag", "click", "double", "triple", 0, 0,
6357 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6342 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -6571,7 +6556,7 @@ reorder_modifiers (Lisp_Object symbol)
6571 6556
6572static Lisp_Object 6557static Lisp_Object
6573modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object symbol_kind, 6558modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object symbol_kind,
6574 Lisp_Object name_alist_or_stem, const char **name_table, 6559 Lisp_Object name_alist_or_stem, const char *const *name_table,
6575 Lisp_Object *symbol_table, unsigned int table_size) 6560 Lisp_Object *symbol_table, unsigned int table_size)
6576{ 6561{
6577 Lisp_Object value; 6562 Lisp_Object value;
@@ -7074,10 +7059,12 @@ tty_read_avail_input (struct terminal *terminal,
7074 int n_to_read, i; 7059 int n_to_read, i;
7075 struct tty_display_info *tty = terminal->display_info.tty; 7060 struct tty_display_info *tty = terminal->display_info.tty;
7076 int nread = 0; 7061 int nread = 0;
7062#ifdef subprocesses
7077 int buffer_free = KBD_BUFFER_SIZE - kbd_buffer_nr_stored () - 1; 7063 int buffer_free = KBD_BUFFER_SIZE - kbd_buffer_nr_stored () - 1;
7078 7064
7079 if (kbd_on_hold_p () || buffer_free <= 0) 7065 if (kbd_on_hold_p () || buffer_free <= 0)
7080 return 0; 7066 return 0;
7067#endif /* subprocesses */
7081 7068
7082 if (!terminal->name) /* Don't read from a dead terminal. */ 7069 if (!terminal->name) /* Don't read from a dead terminal. */
7083 return 0; 7070 return 0;
@@ -7159,9 +7146,11 @@ tty_read_avail_input (struct terminal *terminal,
7159#endif 7146#endif
7160#endif 7147#endif
7161 7148
7149#ifdef subprocesses
7162 /* Don't read more than we can store. */ 7150 /* Don't read more than we can store. */
7163 if (n_to_read > buffer_free) 7151 if (n_to_read > buffer_free)
7164 n_to_read = buffer_free; 7152 n_to_read = buffer_free;
7153#endif /* subprocesses */
7165 7154
7166 /* Now read; for one reason or another, this will not block. 7155 /* Now read; for one reason or another, this will not block.
7167 NREAD is set to the number of chars read. */ 7156 NREAD is set to the number of chars read. */
@@ -8281,9 +8270,12 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8281 if (NILP (menu_item_eval_property (value))) 8270 if (NILP (menu_item_eval_property (value)))
8282 return 0; 8271 return 0;
8283 } 8272 }
8284 else if (EQ (key, QChelp)) 8273 else if (EQ (key, QChelp))
8285 /* `:help HELP-STRING'. */ 8274 /* `:help HELP-STRING'. */
8286 PROP (TOOL_BAR_ITEM_HELP) = value; 8275 PROP (TOOL_BAR_ITEM_HELP) = value;
8276 else if (EQ (key, QCvert_only))
8277 /* `:vert-only t/nil'. */
8278 PROP (TOOL_BAR_ITEM_VERT_ONLY) = value;
8287 else if (EQ (key, QClabel)) 8279 else if (EQ (key, QClabel))
8288 { 8280 {
8289 const char *bad_label = "!!?GARBLED ITEM?!!"; 8281 const char *bad_label = "!!?GARBLED ITEM?!!";
@@ -11100,10 +11092,10 @@ See also `current-input-mode'. */)
11100#ifndef DOS_NT 11092#ifndef DOS_NT
11101 /* this causes startup screen to be restored and messes with the mouse */ 11093 /* this causes startup screen to be restored and messes with the mouse */
11102 reset_all_sys_modes (); 11094 reset_all_sys_modes ();
11103#endif
11104 interrupt_input = new_interrupt_input; 11095 interrupt_input = new_interrupt_input;
11105#ifndef DOS_NT
11106 init_all_sys_modes (); 11096 init_all_sys_modes ();
11097#else
11098 interrupt_input = new_interrupt_input;
11107#endif 11099#endif
11108 11100
11109#ifdef POLL_FOR_INPUT 11101#ifdef POLL_FOR_INPUT
@@ -11327,7 +11319,7 @@ The `posn-' functions access elements of such lists. */)
11327 11319
11328 CHECK_LIVE_FRAME (frame_or_window); 11320 CHECK_LIVE_FRAME (frame_or_window);
11329 11321
11330 return make_lispy_position (XFRAME (frame_or_window), &x, &y, 0); 11322 return make_lispy_position (XFRAME (frame_or_window), x, y, 0);
11331} 11323}
11332 11324
11333DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_point, 0, 2, 0, 11325DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_point, 0, 2, 0,
@@ -11641,6 +11633,8 @@ syms_of_keyboard (void)
11641 staticpro (&QCradio); 11633 staticpro (&QCradio);
11642 QClabel = intern_c_string (":label"); 11634 QClabel = intern_c_string (":label");
11643 staticpro (&QClabel); 11635 staticpro (&QClabel);
11636 QCvert_only = intern_c_string (":vert-only");
11637 staticpro (&QCvert_only);
11644 11638
11645 Qmode_line = intern_c_string ("mode-line"); 11639 Qmode_line = intern_c_string ("mode-line");
11646 staticpro (&Qmode_line); 11640 staticpro (&Qmode_line);
@@ -12440,5 +12434,3 @@ mark_kboards (void)
12440 } 12434 }
12441} 12435}
12442 12436
12443/* arch-tag: 774e34d7-6d31-42f3-8397-e079a4e4c9ca
12444 (do not change this comment) */