diff options
| author | Jason Rumney | 2003-06-01 21:48:53 +0000 |
|---|---|---|
| committer | Jason Rumney | 2003-06-01 21:48:53 +0000 |
| commit | 87d386ff8aa5e10f7b7f84fb89fc07cbdc203c69 (patch) | |
| tree | 602c179c0ed30d171db787b76b7cf88178039a8c /src | |
| parent | 8006e4bbcb8a7014cd7f3c5d5840b811a6472ceb (diff) | |
| download | emacs-87d386ff8aa5e10f7b7f84fb89fc07cbdc203c69.tar.gz emacs-87d386ff8aa5e10f7b7f84fb89fc07cbdc203c69.zip | |
Make last change compile on MSVC
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 352 |
1 files changed, 176 insertions, 176 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 14390fc9be9..a09db16bc6d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -5429,183 +5429,183 @@ make_lispy_event (event) | |||
| 5429 | Lisp_Object window; | 5429 | Lisp_Object window; |
| 5430 | Lisp_Object head; | 5430 | Lisp_Object head; |
| 5431 | 5431 | ||
| 5432 | /* Build the position as appropriate for this mouse click. */ | ||
| 5433 | enum window_part part; | ||
| 5434 | struct frame *f = XFRAME (event->frame_or_window); | ||
| 5435 | Lisp_Object posn; | ||
| 5436 | Lisp_Object string_info = Qnil; | ||
| 5437 | int row, column; | ||
| 5438 | int wx, wy; | ||
| 5432 | position = Qnil; | 5439 | position = Qnil; |
| 5433 | /* Build the position as appropriate for this mouse click. */ | 5440 | |
| 5434 | enum window_part part; | 5441 | /* Ignore wheel events that were made on frame that have been |
| 5435 | struct frame *f = XFRAME (event->frame_or_window); | 5442 | deleted. */ |
| 5436 | Lisp_Object posn; | 5443 | if (! FRAME_LIVE_P (f)) |
| 5437 | Lisp_Object string_info = Qnil; | 5444 | return Qnil; |
| 5438 | int row, column; | 5445 | |
| 5439 | int wx, wy; | 5446 | /* EVENT->x and EVENT->y are frame-relative pixel |
| 5440 | 5447 | coordinates at this place. Under old redisplay, COLUMN | |
| 5441 | /* Ignore wheel events that were made on frame that have been | 5448 | and ROW are set to frame relative glyph coordinates |
| 5442 | deleted. */ | 5449 | which are then used to determine whether this click is |
| 5443 | if (! FRAME_LIVE_P (f)) | 5450 | in a menu (non-toolkit version). */ |
| 5444 | return Qnil; | 5451 | pixel_to_glyph_coords (f, XINT (event->x), XINT (event->y), |
| 5445 | 5452 | &column, &row, NULL, 1); | |
| 5446 | /* EVENT->x and EVENT->y are frame-relative pixel | 5453 | |
| 5447 | coordinates at this place. Under old redisplay, COLUMN | 5454 | /* Set `window' to the window under frame pixel coordinates |
| 5448 | and ROW are set to frame relative glyph coordinates | 5455 | event->x/event->y. */ |
| 5449 | which are then used to determine whether this click is | 5456 | window = window_from_coordinates (f, XINT (event->x), |
| 5450 | in a menu (non-toolkit version). */ | 5457 | XINT (event->y), |
| 5451 | pixel_to_glyph_coords (f, XINT (event->x), XINT (event->y), | 5458 | &part, &wx, &wy, 0); |
| 5452 | &column, &row, NULL, 1); | 5459 | |
| 5453 | 5460 | if (!WINDOWP (window)) | |
| 5454 | /* Set `window' to the window under frame pixel coordinates | 5461 | { |
| 5455 | event->x/event->y. */ | 5462 | window = event->frame_or_window; |
| 5456 | window = window_from_coordinates (f, XINT (event->x), | 5463 | posn = Qnil; |
| 5457 | XINT (event->y), | 5464 | } |
| 5458 | &part, &wx, &wy, 0); | 5465 | else |
| 5459 | 5466 | { | |
| 5460 | if (!WINDOWP (window)) | 5467 | /* It's a click in window window at frame coordinates |
| 5461 | { | 5468 | event->x/ event->y. */ |
| 5462 | window = event->frame_or_window; | 5469 | struct window *w = XWINDOW (window); |
| 5463 | posn = Qnil; | 5470 | |
| 5464 | } | 5471 | /* Set event coordinates to window-relative coordinates |
| 5465 | else | 5472 | for constructing the Lisp event below. */ |
| 5466 | { | 5473 | XSETINT (event->x, wx); |
| 5467 | /* It's a click in window window at frame coordinates | 5474 | XSETINT (event->y, wy); |
| 5468 | event->x/ event->y. */ | 5475 | |
| 5469 | struct window *w = XWINDOW (window); | 5476 | if (part == ON_MODE_LINE || part == ON_HEADER_LINE) |
| 5470 | 5477 | { | |
| 5471 | /* Set event coordinates to window-relative coordinates | 5478 | /* Mode line or header line. Look for a string under |
| 5472 | for constructing the Lisp event below. */ | 5479 | the mouse that may have a `local-map' property. */ |
| 5473 | XSETINT (event->x, wx); | 5480 | Lisp_Object string; |
| 5474 | XSETINT (event->y, wy); | 5481 | int charpos; |
| 5475 | 5482 | ||
| 5476 | if (part == ON_MODE_LINE || part == ON_HEADER_LINE) | 5483 | posn = part == ON_MODE_LINE ? Qmode_line : Qheader_line; |
| 5477 | { | 5484 | string = mode_line_string (w, wx, wy, part, &charpos); |
| 5478 | /* Mode line or header line. Look for a string under | 5485 | if (STRINGP (string)) |
| 5479 | the mouse that may have a `local-map' property. */ | 5486 | string_info = Fcons (string, make_number (charpos)); |
| 5480 | Lisp_Object string; | 5487 | } |
| 5481 | int charpos; | 5488 | else if (part == ON_VERTICAL_BORDER) |
| 5482 | 5489 | posn = Qvertical_line; | |
| 5483 | posn = part == ON_MODE_LINE ? Qmode_line : Qheader_line; | 5490 | else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) |
| 5484 | string = mode_line_string (w, wx, wy, part, &charpos); | 5491 | { |
| 5485 | if (STRINGP (string)) | 5492 | int charpos; |
| 5486 | string_info = Fcons (string, make_number (charpos)); | 5493 | Lisp_Object object = marginal_area_string (w, wx, wy, part, |
| 5487 | } | 5494 | &charpos); |
| 5488 | else if (part == ON_VERTICAL_BORDER) | 5495 | posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; |
| 5489 | posn = Qvertical_line; | 5496 | if (STRINGP (object)) |
| 5490 | else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) | 5497 | string_info = Fcons (object, make_number (charpos)); |
| 5491 | { | 5498 | } |
| 5492 | int charpos; | 5499 | else |
| 5493 | Lisp_Object object = marginal_area_string (w, wx, wy, part, | 5500 | { |
| 5494 | &charpos); | 5501 | Lisp_Object object; |
| 5495 | posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; | 5502 | struct display_pos p; |
| 5496 | if (STRINGP (object)) | 5503 | buffer_posn_from_coords (w, &wx, &wy, &object, &p); |
| 5497 | string_info = Fcons (object, make_number (charpos)); | 5504 | posn = make_number (CHARPOS (p.pos)); |
| 5498 | } | 5505 | if (STRINGP (object)) |
| 5499 | else | 5506 | string_info |
| 5500 | { | 5507 | = Fcons (object, |
| 5501 | Lisp_Object object; | 5508 | make_number (CHARPOS (p.string_pos))); |
| 5502 | struct display_pos p; | 5509 | } |
| 5503 | buffer_posn_from_coords (w, &wx, &wy, &object, &p); | 5510 | } |
| 5504 | posn = make_number (CHARPOS (p.pos)); | 5511 | |
| 5505 | if (STRINGP (object)) | 5512 | position |
| 5506 | string_info | 5513 | = Fcons (window, |
| 5507 | = Fcons (object, | 5514 | Fcons (posn, |
| 5508 | make_number (CHARPOS (p.string_pos))); | 5515 | Fcons (Fcons (event->x, event->y), |
| 5509 | } | 5516 | Fcons (make_number (event->timestamp), |
| 5510 | } | 5517 | (NILP (string_info) |
| 5511 | 5518 | ? Qnil | |
| 5512 | position | 5519 | : Fcons (string_info, Qnil)))))); |
| 5513 | = Fcons (window, | 5520 | |
| 5514 | Fcons (posn, | 5521 | /* Set double or triple modifiers to indicate the wheel speed. */ |
| 5515 | Fcons (Fcons (event->x, event->y), | 5522 | { |
| 5516 | Fcons (make_number (event->timestamp), | 5523 | /* On window-system frames, use the value of |
| 5517 | (NILP (string_info) | 5524 | double-click-fuzz as is. On other frames, interpret it |
| 5518 | ? Qnil | 5525 | as a multiple of 1/8 characters. */ |
| 5519 | : Fcons (string_info, Qnil)))))); | 5526 | struct frame *f; |
| 5520 | 5527 | int fuzz; | |
| 5521 | /* Set double or triple modifiers to indicate the wheel speed. */ | 5528 | int is_double; |
| 5522 | { | 5529 | |
| 5523 | /* On window-system frames, use the value of | 5530 | if (WINDOWP (event->frame_or_window)) |
| 5524 | double-click-fuzz as is. On other frames, interpret it | 5531 | f = XFRAME (XWINDOW (event->frame_or_window)->frame); |
| 5525 | as a multiple of 1/8 characters. */ | 5532 | else if (FRAMEP (event->frame_or_window)) |
| 5526 | struct frame *f; | 5533 | f = XFRAME (event->frame_or_window); |
| 5527 | int fuzz; | 5534 | else |
| 5528 | int is_double; | 5535 | abort (); |
| 5529 | 5536 | ||
| 5530 | if (WINDOWP (event->frame_or_window)) | 5537 | if (FRAME_WINDOW_P (f)) |
| 5531 | f = XFRAME (XWINDOW (event->frame_or_window)->frame); | 5538 | fuzz = double_click_fuzz; |
| 5532 | else if (FRAMEP (event->frame_or_window)) | 5539 | else |
| 5533 | f = XFRAME (event->frame_or_window); | 5540 | fuzz = double_click_fuzz / 8; |
| 5534 | else | 5541 | |
| 5535 | abort (); | 5542 | is_double = (last_mouse_button < 0 |
| 5536 | 5543 | && (abs (XINT (event->x) - last_mouse_x) <= fuzz) | |
| 5537 | if (FRAME_WINDOW_P (f)) | 5544 | && (abs (XINT (event->y) - last_mouse_y) <= fuzz) |
| 5538 | fuzz = double_click_fuzz; | 5545 | && button_down_time != 0 |
| 5539 | else | 5546 | && (EQ (Vdouble_click_time, Qt) |
| 5540 | fuzz = double_click_fuzz / 8; | 5547 | || (INTEGERP (Vdouble_click_time) |
| 5541 | 5548 | && ((int)(event->timestamp - button_down_time) | |
| 5542 | is_double = (last_mouse_button < 0 | 5549 | < XINT (Vdouble_click_time))))); |
| 5543 | && (abs (XINT (event->x) - last_mouse_x) <= fuzz) | 5550 | if (is_double) |
| 5544 | && (abs (XINT (event->y) - last_mouse_y) <= fuzz) | 5551 | { |
| 5545 | && button_down_time != 0 | 5552 | double_click_count++; |
| 5546 | && (EQ (Vdouble_click_time, Qt) | 5553 | event->modifiers |= ((double_click_count > 2) |
| 5547 | || (INTEGERP (Vdouble_click_time) | 5554 | ? triple_modifier |
| 5548 | && ((int)(event->timestamp - button_down_time) | 5555 | : double_modifier); |
| 5549 | < XINT (Vdouble_click_time))))); | 5556 | } |
| 5550 | if (is_double) | 5557 | else |
| 5551 | { | 5558 | { |
| 5552 | double_click_count++; | 5559 | double_click_count = 1; |
| 5553 | event->modifiers |= ((double_click_count > 2) | 5560 | event->modifiers |= click_modifier; |
| 5554 | ? triple_modifier | 5561 | } |
| 5555 | : double_modifier); | 5562 | |
| 5556 | } | 5563 | button_down_time = event->timestamp; |
| 5557 | else | 5564 | /* Use a negative value to distinguish wheel from mouse button. */ |
| 5558 | { | 5565 | last_mouse_button = -1; |
| 5559 | double_click_count = 1; | 5566 | last_mouse_x = XINT (event->x); |
| 5560 | event->modifiers |= click_modifier; | 5567 | last_mouse_y = XINT (event->y); |
| 5561 | } | 5568 | } |
| 5562 | 5569 | ||
| 5563 | button_down_time = event->timestamp; | 5570 | { |
| 5564 | /* Use a negative value to distinguish wheel from mouse button. */ | 5571 | int symbol_num; |
| 5565 | last_mouse_button = -1; | 5572 | |
| 5566 | last_mouse_x = XINT (event->x); | 5573 | if (event->modifiers & up_modifier) |
| 5567 | last_mouse_y = XINT (event->y); | 5574 | { |
| 5568 | } | 5575 | /* Emit a wheel-up event. */ |
| 5569 | 5576 | event->modifiers &= ~up_modifier; | |
| 5570 | { | 5577 | symbol_num = 0; |
| 5571 | int symbol_num; | 5578 | } |
| 5572 | 5579 | else if (event->modifiers & down_modifier) | |
| 5573 | if (event->modifiers & up_modifier) | 5580 | { |
| 5574 | { | 5581 | /* Emit a wheel-down event. */ |
| 5575 | /* Emit a wheel-up event. */ | 5582 | event->modifiers &= ~down_modifier; |
| 5576 | event->modifiers &= ~up_modifier; | 5583 | symbol_num = 1; |
| 5577 | symbol_num = 0; | 5584 | } |
| 5578 | } | 5585 | else |
| 5579 | else if (event->modifiers & down_modifier) | 5586 | /* Every wheel event should either have the down_modifier or |
| 5580 | { | 5587 | the up_modifier set. */ |
| 5581 | /* Emit a wheel-down event. */ | 5588 | abort (); |
| 5582 | event->modifiers &= ~down_modifier; | 5589 | |
| 5583 | symbol_num = 1; | 5590 | /* Get the symbol we should use for the wheel event. */ |
| 5584 | } | 5591 | head = modify_event_symbol (symbol_num, |
| 5585 | else | 5592 | event->modifiers, |
| 5586 | /* Every wheel event should either have the down_modifier or | 5593 | Qmouse_click, |
| 5587 | the up_modifier set. */ | 5594 | Qnil, |
| 5588 | abort (); | 5595 | lispy_wheel_names, |
| 5589 | 5596 | &wheel_syms, | |
| 5590 | /* Get the symbol we should use for the wheel event. */ | 5597 | ASIZE (wheel_syms)); |
| 5591 | head = modify_event_symbol (symbol_num, | 5598 | } |
| 5592 | event->modifiers, | 5599 | |
| 5593 | Qmouse_click, | 5600 | if (event->modifiers & (double_modifier | triple_modifier)) |
| 5594 | Qnil, | 5601 | return Fcons (head, |
| 5595 | lispy_wheel_names, | 5602 | Fcons (position, |
| 5596 | &wheel_syms, | 5603 | Fcons (make_number (double_click_count), |
| 5597 | ASIZE (wheel_syms)); | 5604 | Qnil))); |
| 5598 | } | 5605 | else |
| 5599 | 5606 | return Fcons (head, | |
| 5600 | if (event->modifiers & (double_modifier | triple_modifier)) | 5607 | Fcons (position, |
| 5601 | return Fcons (head, | 5608 | Qnil)); |
| 5602 | Fcons (position, | ||
| 5603 | Fcons (make_number (double_click_count), | ||
| 5604 | Qnil))); | ||
| 5605 | else | ||
| 5606 | return Fcons (head, | ||
| 5607 | Fcons (position, | ||
| 5608 | Qnil)); | ||
| 5609 | } | 5609 | } |
| 5610 | 5610 | ||
| 5611 | 5611 | ||