aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c54
1 files changed, 22 insertions, 32 deletions
diff --git a/src/window.c b/src/window.c
index 3e2c3c30d1c..65966edb6da 100644
--- a/src/window.c
+++ b/src/window.c
@@ -48,21 +48,6 @@ Boston, MA 02111-1307, USA. */
48#include "macterm.h" 48#include "macterm.h"
49#endif 49#endif
50 50
51/* Values returned from coordinates_in_window. */
52
53enum window_part
54{
55 ON_NOTHING,
56 ON_TEXT,
57 ON_MODE_LINE,
58 ON_VERTICAL_BORDER,
59 ON_HEADER_LINE,
60 ON_LEFT_FRINGE,
61 ON_RIGHT_FRINGE,
62 ON_LEFT_MARGIN,
63 ON_RIGHT_MARGIN
64};
65
66 51
67Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; 52Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
68Lisp_Object Qwindow_size_fixed; 53Lisp_Object Qwindow_size_fixed;
@@ -507,19 +492,21 @@ and BOTTOM is one more than the bottommost row used by WINDOW
507} 492}
508 493
509/* Test if the character at column *X, row *Y is within window W. 494/* Test if the character at column *X, row *Y is within window W.
510 If it is not, return 0; 495 If it is not, return ON_NOTHING;
511 if it is in the window's text area, 496 if it is in the window's text area,
512 set *x and *y to its location relative to the upper left corner 497 set *x and *y to its location relative to the upper left corner
513 of the window, and 498 of the window, and
514 return 1; 499 return ON_TEXT;
515 if it is on the window's modeline, return 2; 500 if it is on the window's modeline, return ON_MODE_LINE;
516 if it is on the border between the window and its right sibling, 501 if it is on the border between the window and its right sibling,
517 return 3. 502 return ON_VERTICAL_BORDER.
518 if it is on the window's top line, return 4; 503 if it is on the window's top line, return ON_HEADER_LINE;
519 if it is in left or right fringe of the window, 504 if it is in left or right fringe of the window,
520 return 5 or 6, and convert *X and *Y to window-relative coordinates; 505 return ON_LEFT_FRINGE or ON_RIGHT_FRINGE, and convert *X and *Y
506 to window-relative coordinates;
521 if it is in the marginal area to the left/right of the window, 507 if it is in the marginal area to the left/right of the window,
522 return 7 or 8, and convert *X and *Y to window-relative coordinates. 508 return ON_LEFT_MARGIN or ON_RIGHT_MARGIN, and convert *X and *Y
509 to window-relative coordinates.
523 510
524 X and Y are frame relative pixel coordinates. */ 511 X and Y are frame relative pixel coordinates. */
525 512
@@ -786,7 +773,8 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\
786struct check_window_data 773struct check_window_data
787{ 774{
788 Lisp_Object *window; 775 Lisp_Object *window;
789 int *x, *y, *part; 776 int *x, *y;
777 enum window_part *part;
790}; 778};
791 779
792static int 780static int
@@ -801,7 +789,7 @@ check_window_containing (w, user_data)
801 found = coordinates_in_window (w, cw->x, cw->y); 789 found = coordinates_in_window (w, cw->x, cw->y);
802 if (found != ON_NOTHING) 790 if (found != ON_NOTHING)
803 { 791 {
804 *cw->part = found - 1; 792 *cw->part = found;
805 XSETWINDOW (*cw->window, w); 793 XSETWINDOW (*cw->window, w);
806 continue_p = 0; 794 continue_p = 0;
807 } 795 }
@@ -811,10 +799,9 @@ check_window_containing (w, user_data)
811 799
812 800
813/* Find the window containing frame-relative pixel position X/Y and 801/* Find the window containing frame-relative pixel position X/Y and
814 return it as a Lisp_Object. If X, Y is on the window's modeline, 802 return it as a Lisp_Object. If X, Y is on one of the window's
815 set *PART to 1; if it is on the separating line between the window 803 special `window_part' elements, set *PART to the id of that element.
816 and its right sibling, set it to 2; otherwise set it to 0. If 804 If there is no window under X, Y return nil and leave *PART
817 there is no window under X, Y return nil and leave *PART
818 unmodified. TOOL_BAR_P non-zero means detect tool-bar windows. 805 unmodified. TOOL_BAR_P non-zero means detect tool-bar windows.
819 806
820 This function was previously implemented with a loop cycling over 807 This function was previously implemented with a loop cycling over
@@ -830,11 +817,15 @@ Lisp_Object
830window_from_coordinates (f, x, y, part, tool_bar_p) 817window_from_coordinates (f, x, y, part, tool_bar_p)
831 struct frame *f; 818 struct frame *f;
832 int x, y; 819 int x, y;
833 int *part; 820 enum window_part *part;
834 int tool_bar_p; 821 int tool_bar_p;
835{ 822{
836 Lisp_Object window; 823 Lisp_Object window;
837 struct check_window_data cw; 824 struct check_window_data cw;
825 enum window_part dummy;
826
827 if (part == 0)
828 part = &dummy;
838 829
839 window = Qnil; 830 window = Qnil;
840 cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part; 831 cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part;
@@ -849,7 +840,7 @@ window_from_coordinates (f, x, y, part, tool_bar_p)
849 && (coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y) 840 && (coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y)
850 != ON_NOTHING)) 841 != ON_NOTHING))
851 { 842 {
852 *part = 0; 843 *part = ON_TEXT;
853 window = f->tool_bar_window; 844 window = f->tool_bar_window;
854 } 845 }
855 846
@@ -864,7 +855,6 @@ column 0. */)
864 (x, y, frame) 855 (x, y, frame)
865 Lisp_Object x, y, frame; 856 Lisp_Object x, y, frame;
866{ 857{
867 int part;
868 struct frame *f; 858 struct frame *f;
869 859
870 if (NILP (frame)) 860 if (NILP (frame))
@@ -879,7 +869,7 @@ column 0. */)
879 return window_from_coordinates (f, 869 return window_from_coordinates (f,
880 PIXEL_X_FROM_CANON_X (f, x), 870 PIXEL_X_FROM_CANON_X (f, x),
881 PIXEL_Y_FROM_CANON_Y (f, y), 871 PIXEL_Y_FROM_CANON_Y (f, y),
882 &part, 0); 872 0, 0);
883} 873}
884 874
885DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, 875DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0,