diff options
| author | Gerd Moellmann | 2002-04-12 09:36:21 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2002-04-12 09:36:21 +0000 |
| commit | 49b996e77a0d0cd5cf438624821d3ac5dd760e57 (patch) | |
| tree | a6087c75a4eb28dcc785ebfcaaffe50b4230ae8b /src | |
| parent | 7d60ad8af0c9bdf88cad876323b170b7d6ea0580 (diff) | |
| download | emacs-49b996e77a0d0cd5cf438624821d3ac5dd760e57.tar.gz emacs-49b996e77a0d0cd5cf438624821d3ac5dd760e57.zip | |
(window_part): Add ON_LEFT_MARGIN, ON_RIGHT_MARGIN.
(Qleft_margin, Qright_margin): Declare.
(coordinates_in_window, (Fcoordinates_in_window_p): Deal with
margins.
Diffstat (limited to 'src')
| -rw-r--r-- | src/window.c | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/src/window.c b/src/window.c index 3535e50673e..21fb9d53e59 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Window creation, deletion and examination for GNU Emacs. | 1 | /* Window creation, deletion and examination for GNU Emacs. |
| 2 | Does not include redisplay. | 2 | Does not include redisplay. |
| 3 | Copyright (C) 1985,86,87,93,94,95,96,97,1998,2000, 2001 | 3 | Copyright (C) 1985,86,87,93,94,95,96,97,1998,2000, 2001, 2002 |
| 4 | Free Software Foundation, Inc. | 4 | Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | This file is part of GNU Emacs. | 6 | This file is part of GNU Emacs. |
| @@ -58,12 +58,15 @@ enum window_part | |||
| 58 | ON_VERTICAL_BORDER, | 58 | ON_VERTICAL_BORDER, |
| 59 | ON_HEADER_LINE, | 59 | ON_HEADER_LINE, |
| 60 | ON_LEFT_FRINGE, | 60 | ON_LEFT_FRINGE, |
| 61 | ON_RIGHT_FRINGE | 61 | ON_RIGHT_FRINGE, |
| 62 | ON_LEFT_MARGIN, | ||
| 63 | ON_RIGHT_MARGIN | ||
| 62 | }; | 64 | }; |
| 63 | 65 | ||
| 64 | 66 | ||
| 65 | Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; | 67 | Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; |
| 66 | Lisp_Object Qwindow_size_fixed; | 68 | Lisp_Object Qwindow_size_fixed; |
| 69 | extern Lisp_Object Qleft_margin, Qright_margin; | ||
| 67 | extern Lisp_Object Qheight, Qwidth; | 70 | extern Lisp_Object Qheight, Qwidth; |
| 68 | 71 | ||
| 69 | static int displayed_window_lines P_ ((struct window *)); | 72 | static int displayed_window_lines P_ ((struct window *)); |
| @@ -509,7 +512,9 @@ and BOTTOM is one more than the bottommost row used by WINDOW | |||
| 509 | return 3. | 512 | return 3. |
| 510 | if it is on the window's top line, return 4; | 513 | if it is on the window's top line, return 4; |
| 511 | if it is in left or right fringe of the window, | 514 | if it is in left or right fringe of the window, |
| 512 | return 5 or 6, and convert *X and *Y to window-relative corrdinates. | 515 | return 5 or 6, and convert *X and *Y to window-relative coordinates; |
| 516 | if it is in the marginal area to the left/right of the window, | ||
| 517 | return 7 or 8, and convert *X and *Y to window-relative coordinates. | ||
| 513 | 518 | ||
| 514 | X and Y are frame relative pixel coordinates. */ | 519 | X and Y are frame relative pixel coordinates. */ |
| 515 | 520 | ||
| @@ -623,9 +628,16 @@ coordinates_in_window (w, x, y) | |||
| 623 | } | 628 | } |
| 624 | else | 629 | else |
| 625 | { | 630 | { |
| 626 | *x -= left_x; | 631 | if (*x <= window_box_right (w, LEFT_MARGIN_AREA)) |
| 627 | *y -= top_y; | 632 | part = ON_LEFT_MARGIN; |
| 628 | part = ON_TEXT; | 633 | else if (*x >= window_box_left (w, RIGHT_MARGIN_AREA)) |
| 634 | part = ON_RIGHT_MARGIN; | ||
| 635 | else | ||
| 636 | { | ||
| 637 | part = ON_TEXT; | ||
| 638 | *x -= left_x; | ||
| 639 | *y -= top_y; | ||
| 640 | } | ||
| 629 | } | 641 | } |
| 630 | } | 642 | } |
| 631 | else | 643 | else |
| @@ -653,10 +665,17 @@ coordinates_in_window (w, x, y) | |||
| 653 | } | 665 | } |
| 654 | else | 666 | else |
| 655 | { | 667 | { |
| 656 | /* Convert X and Y to window-relative pixel coordinates. */ | 668 | if (*x <= window_box_right (w, LEFT_MARGIN_AREA)) |
| 657 | *x -= left_x; | 669 | part = ON_LEFT_MARGIN; |
| 658 | *y -= top_y; | 670 | else if (*x >= window_box_left (w, RIGHT_MARGIN_AREA)) |
| 659 | part = ON_TEXT; | 671 | part = ON_RIGHT_MARGIN; |
| 672 | else | ||
| 673 | { | ||
| 674 | part = ON_TEXT; | ||
| 675 | /* Convert X and Y to window-relative pixel coordinates. */ | ||
| 676 | *x -= left_x; | ||
| 677 | *y -= top_y; | ||
| 678 | } | ||
| 660 | } | 679 | } |
| 661 | } | 680 | } |
| 662 | 681 | ||
| @@ -678,7 +697,9 @@ If they are in the top mode line of WINDOW, `header-line' is returned. | |||
| 678 | If they are in the left fringe of WINDOW, `left-fringe' is returned. | 697 | If they are in the left fringe of WINDOW, `left-fringe' is returned. |
| 679 | If they are in the right fringe of WINDOW, `right-fringe' is returned. | 698 | If they are in the right fringe of WINDOW, `right-fringe' is returned. |
| 680 | If they are on the border between WINDOW and its right sibling, | 699 | If they are on the border between WINDOW and its right sibling, |
| 681 | `vertical-line' is returned. */) | 700 | `vertical-line' is returned. |
| 701 | If they are in the windows's left or right marginal areas, `left-margin'\n\ | ||
| 702 | or `right-margin' is returned. */) | ||
| 682 | (coordinates, window) | 703 | (coordinates, window) |
| 683 | register Lisp_Object coordinates, window; | 704 | register Lisp_Object coordinates, window; |
| 684 | { | 705 | { |
| @@ -724,6 +745,12 @@ If they are on the border between WINDOW and its right sibling, | |||
| 724 | case ON_RIGHT_FRINGE: | 745 | case ON_RIGHT_FRINGE: |
| 725 | return Qright_fringe; | 746 | return Qright_fringe; |
| 726 | 747 | ||
| 748 | case ON_LEFT_MARGIN: | ||
| 749 | return Qleft_margin; | ||
| 750 | |||
| 751 | case ON_RIGHT_MARGIN: | ||
| 752 | return Qright_margin; | ||
| 753 | |||
| 727 | default: | 754 | default: |
| 728 | abort (); | 755 | abort (); |
| 729 | } | 756 | } |