changeset 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 733b2505ca59
children f7b9d913406b
files src/window.c
diffstat 1 files changed, 38 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/window.c	Fri Apr 12 09:35:34 2002 +0000
+++ b/src/window.c	Fri Apr 12 09:36:21 2002 +0000
@@ -1,6 +1,6 @@
 /* Window creation, deletion and examination for GNU Emacs.
    Does not include redisplay.
-   Copyright (C) 1985,86,87,93,94,95,96,97,1998,2000, 2001
+   Copyright (C) 1985,86,87,93,94,95,96,97,1998,2000, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -58,12 +58,15 @@
   ON_VERTICAL_BORDER,
   ON_HEADER_LINE,
   ON_LEFT_FRINGE,
-  ON_RIGHT_FRINGE
+  ON_RIGHT_FRINGE,
+  ON_LEFT_MARGIN,
+  ON_RIGHT_MARGIN
 };
 
 
 Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
 Lisp_Object Qwindow_size_fixed;
+extern Lisp_Object Qleft_margin, Qright_margin;
 extern Lisp_Object Qheight, Qwidth;
 
 static int displayed_window_lines P_ ((struct window *));
@@ -509,7 +512,9 @@
       return 3.
    if it is on the window's top line, return 4;
    if it is in left or right fringe of the window,
-   return 5 or 6, and convert *X and *Y to window-relative corrdinates.
+   return 5 or 6, and convert *X and *Y to window-relative coordinates;
+   if it is in the marginal area to the left/right of the window,
+   return 7 or 8, and convert *X and *Y to window-relative coordinates.
 
    X and Y are frame relative pixel coordinates.  */
 
@@ -623,9 +628,16 @@
 	}
       else
 	{
-	  *x -= left_x;
-	  *y -= top_y;
-	  part = ON_TEXT;
+	  if (*x <= window_box_right (w, LEFT_MARGIN_AREA))
+	    part = ON_LEFT_MARGIN;
+	  else if (*x >= window_box_left (w, RIGHT_MARGIN_AREA))
+	    part = ON_RIGHT_MARGIN;
+	  else
+	    {
+	      part = ON_TEXT;
+	      *x -= left_x;
+	      *y -= top_y;
+	    }
 	}
     }
   else
@@ -653,10 +665,17 @@
 	}
       else
 	{
-	  /* Convert X and Y to window-relative pixel coordinates.  */
-	  *x -= left_x;
-	  *y -= top_y;
-	  part = ON_TEXT;
+	  if (*x <= window_box_right (w, LEFT_MARGIN_AREA))
+	    part = ON_LEFT_MARGIN;
+	  else if (*x >= window_box_left (w, RIGHT_MARGIN_AREA))
+	    part = ON_RIGHT_MARGIN;
+	  else
+	    {
+	      part = ON_TEXT;
+	      /* Convert X and Y to window-relative pixel coordinates.  */
+	      *x -= left_x;
+	      *y -= top_y;
+	    }
 	}
     }
 
@@ -678,7 +697,9 @@
 If they are in the left fringe of WINDOW, `left-fringe' is returned.
 If they are in the right fringe of WINDOW, `right-fringe' is returned.
 If they are on the border between WINDOW and its right sibling,
-  `vertical-line' is returned.  */)
+  `vertical-line' is returned.
+If they are in the windows's left or right marginal areas, `left-margin'\n\
+  or `right-margin' is returned.  */)
      (coordinates, window)
      register Lisp_Object coordinates, window;
 {
@@ -724,6 +745,12 @@
     case ON_RIGHT_FRINGE:
       return Qright_fringe;
 
+    case ON_LEFT_MARGIN:
+      return Qleft_margin;
+      
+    case ON_RIGHT_MARGIN:
+      return Qright_margin;
+
     default:
       abort ();
     }