changeset 51477:3ee34a66739e

(coordinates_in_window): Convert X and Y to window relative coordinates inside mode-line and header-line parts. Convert X and Y to margin area relative coordinates inside left and right display margin parts.
author Kim F. Storm <storm@cua.dk>
date Thu, 05 Jun 2003 00:36:28 +0000
parents 056514de0e0c
children cc38ef483a77
files src/window.c
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/window.c	Thu Jun 05 00:36:09 2003 +0000
+++ b/src/window.c	Thu Jun 05 00:36:28 2003 +0000
@@ -654,6 +654,10 @@
 	    return ON_VERTICAL_BORDER;
 	}
 
+      /* Convert X and Y to window relative coordinates.
+	 Mode line starts at left edge of window.  */
+      *x -= x0;
+      *y -= top_y;
       return part;
     }
 
@@ -703,7 +707,13 @@
 	  && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
 	      ? (*x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w))
 	      : (*x < left_x + lmargin_width)))
-	return ON_LEFT_MARGIN;
+	{
+	  *x -= x0;
+	  if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w))
+	    *x -= WINDOW_LEFT_FRINGE_WIDTH (w);
+	  *y -= top_y;
+	  return ON_LEFT_MARGIN;
+	}
 
       /* Convert X and Y to window-relative pixel coordinates.  */
       *x -= left_x;
@@ -717,7 +727,13 @@
 	  && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
 	      ? (*x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w))
 	      : (*x >= right_x - rmargin_width)))
-	return ON_RIGHT_MARGIN;
+	{
+	  *x -= right_x;
+	  if (!WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w))
+	    *x -= WINDOW_RIGHT_FRINGE_WIDTH (w);
+	  *y -= top_y;
+	  return ON_RIGHT_MARGIN;
+	}
 
       /* Convert X and Y to window-relative pixel coordinates.  */
       *x -= left_x + WINDOW_LEFT_FRINGE_WIDTH (w);