Mercurial > emacs
comparison src/window.c @ 44535:ee637a721e86
(window_part): Add ON_LEFT_MARGIN, ON_RIGHT_MARGIN.
(Qleft_margin, Qright_margin): Declare.
(coordinates_in_window, (Fcoordinates_in_window_p): Deal with
margins.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 12 Apr 2002 09:36:21 +0000 |
parents | 6bcf9f9c10df |
children | 1bb925387b48 |
comparison
equal
deleted
inserted
replaced
44534:733b2505ca59 | 44535:ee637a721e86 |
---|---|
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. |
7 | 7 |
8 GNU Emacs is free software; you can redistribute it and/or modify | 8 GNU Emacs is free software; you can redistribute it and/or modify |
56 ON_TEXT, | 56 ON_TEXT, |
57 ON_MODE_LINE, | 57 ON_MODE_LINE, |
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 *)); |
70 static struct window *decode_window P_ ((Lisp_Object)); | 73 static struct window *decode_window P_ ((Lisp_Object)); |
71 static Lisp_Object select_window_1 P_ ((Lisp_Object, int)); | 74 static Lisp_Object select_window_1 P_ ((Lisp_Object, int)); |
507 if it is on the window's modeline, return 2; | 510 if it is on the window's modeline, return 2; |
508 if it is on the border between the window and its right sibling, | 511 if it is on the border between the window and its right sibling, |
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 |
516 static enum window_part | 521 static enum window_part |
517 coordinates_in_window (w, x, y) | 522 coordinates_in_window (w, x, y) |
621 *y -= top_y; | 626 *y -= top_y; |
622 part = *x < left_x ? ON_LEFT_FRINGE : ON_RIGHT_FRINGE; | 627 part = *x < left_x ? ON_LEFT_FRINGE : ON_RIGHT_FRINGE; |
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 |
632 { | 644 { |
633 /* Need to say "*x > right_x" rather than >=, since on character | 645 /* Need to say "*x > right_x" rather than >=, since on character |
651 this area begins at RIGHT_X minus a canonical char width. */ | 663 this area begins at RIGHT_X minus a canonical char width. */ |
652 part = ON_VERTICAL_BORDER; | 664 part = ON_VERTICAL_BORDER; |
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 |
663 return part; | 682 return part; |
664 } | 683 } |
676 If they are in the mode line of WINDOW, `mode-line' is returned. | 695 If they are in the mode line of WINDOW, `mode-line' is returned. |
677 If they are in the top mode line of WINDOW, `header-line' is returned. | 696 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 { |
685 struct window *w; | 706 struct window *w; |
686 struct frame *f; | 707 struct frame *f; |
721 case ON_LEFT_FRINGE: | 742 case ON_LEFT_FRINGE: |
722 return Qleft_fringe; | 743 return Qleft_fringe; |
723 | 744 |
724 case ON_RIGHT_FRINGE: | 745 case ON_RIGHT_FRINGE: |
725 return Qright_fringe; | 746 return Qright_fringe; |
747 | |
748 case ON_LEFT_MARGIN: | |
749 return Qleft_margin; | |
750 | |
751 case ON_RIGHT_MARGIN: | |
752 return Qright_margin; | |
726 | 753 |
727 default: | 754 default: |
728 abort (); | 755 abort (); |
729 } | 756 } |
730 } | 757 } |