changeset 66019:26e41053c306

(make_lispy_position): Fix buffer calculations for mouse click or movement in right fringe and the margins.
author Kim F. Storm <storm@cua.dk>
date Tue, 11 Oct 2005 15:07:28 +0000
parents 7810bc0b0259
children 337b118104a5
files src/keyboard.c
diffstat 1 files changed, 29 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Tue Oct 11 15:07:07 2005 +0000
+++ b/src/keyboard.c	Tue Oct 11 15:07:28 2005 +0000
@@ -5090,21 +5090,37 @@
 					 &object, &dx, &dy, &width, &height);
 	  if (STRINGP (string))
 	    string_info = Fcons (string, make_number (charpos));
-	}
-      else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE)
-	{
-	  posn = (part == ON_LEFT_FRINGE) ? Qleft_fringe : Qright_fringe;
+	  if (part == ON_LEFT_MARGIN)
+	    wx = 0;
+	  else
+	    wx = window_box_right_offset (w, TEXT_AREA) - 1;
+	}
+      else if (part == ON_LEFT_FRINGE)
+	{
+	  posn = Qleft_fringe;
 	  rx = 0;
 	  dx = wx;
-	  wx = (part == ON_LEFT_FRINGE) ? 0 : window_box_width (w, TEXT_AREA);
-	  if (part == ON_RIGHT_FRINGE)
-	    dx -= (window_box_width (w, LEFT_MARGIN_AREA)
-		   + window_box_width (w, TEXT_AREA)
-		   + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
-		      ? window_box_width (w, RIGHT_MARGIN_AREA)
-		      : 0));
-	  else if (!WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w))
-	    dx -= window_box_width (w, LEFT_MARGIN_AREA);
+	  wx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
+		? 0
+		: window_box_width (w, LEFT_MARGIN_AREA));
+	  dx -= wx;
+	}
+      else if (part == ON_RIGHT_FRINGE)
+	{
+	  posn = Qright_fringe;
+	  rx = 0;
+	  dx = wx;
+	  wx = (window_box_width (w, LEFT_MARGIN_AREA)
+		+ window_box_width (w, TEXT_AREA)
+		+ (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
+		   ? window_box_width (w, RIGHT_MARGIN_AREA)
+		   : 0));
+	  dx -= wx;
+	}
+      else
+	{
+	  /* Note: We have no special posn for part == ON_SCROLL_BAR.  */
+	  wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx);
 	}
 
       if (textpos < 0)
@@ -5113,7 +5129,6 @@
 	  struct display_pos p;
 	  int dx2, dy2;
 	  int width2, height2;
-	  wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx);
 	  string2 = buffer_posn_from_coords (w, &wx, &wy, &p,
 					     &object2, &dx2, &dy2,
 					     &width2, &height2);