]> git.eshelyaron.com Git - emacs.git/commitdiff
(coordinates_in_window): Handle computations for
authorGerd Moellmann <gerd@gnu.org>
Fri, 1 Dec 2000 20:45:45 +0000 (20:45 +0000)
committerGerd Moellmann <gerd@gnu.org>
Fri, 1 Dec 2000 20:45:45 +0000 (20:45 +0000)
positions on the vertical bar and fringes differently for
window-system frames.  Consider some pixels near the vertical bar
as on the bar if the frame doesn't have vertical scroll bars.
Associate positions between mode or header lines with the
right window, the left one.

src/ChangeLog
src/window.c

index b8a419b2acbb3a77ca0fbe59574f2758f2d017fc..9c98f9d31f634110383bb40182009aec9d111785 100644 (file)
@@ -1,3 +1,12 @@
+2000-12-01  Gerd Moellmann  <gerd@gnu.org>
+
+       * window.c (coordinates_in_window): Handle computations for
+       positions on the vertical bar and fringes differently for
+       window-system frames.  Consider some pixels near the vertical bar
+       as on the bar if the frame doesn't have vertical scroll bars.
+       Associate positions between mode or header lines with the
+       right window, the left one.
+
 2000-12-01  Jason Rumney  <jasonr@gnu.org>
 
        * w32term.c (w32_clear_window): Avoid clearing an invalid frame.
index 676156c221bd2822272866d15d44c0856d9d7c6e..2460e00bf5c044e057d055f9d44f7191c16b4caa 100644 (file)
@@ -538,8 +538,9 @@ coordinates_in_window (w, x, y)
   if (WINDOW_WANTS_MODELINE_P (w)
       && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w))
     {
-      if (XFASTINT (w->left) > 0
-         && (abs (*x - XFASTINT (w->left) * CANON_X_UNIT (f))
+      if (!WINDOW_RIGHTMOST_P (w)
+         && (abs (*x - ((XFASTINT (w->left) + XFASTINT (w->width))
+                        * CANON_X_UNIT (f)))
              < CANON_X_UNIT (f) / 2))
        return ON_VERTICAL_BORDER;
       return ON_MODE_LINE;
@@ -548,33 +549,56 @@ coordinates_in_window (w, x, y)
   if (WINDOW_WANTS_HEADER_LINE_P (w)
       && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w))
     {
-      if (XFASTINT (w->left) > 0
-         && (abs (*x - XFASTINT (w->left) * CANON_X_UNIT (f))
+      if (!WINDOW_RIGHTMOST_P (w)
+         && (abs (*x - ((XFASTINT (w->left) + XFASTINT (w->width))
+                        * CANON_X_UNIT (f)))
              < CANON_X_UNIT (f) / 2))
        return ON_VERTICAL_BORDER;
       return ON_HEADER_LINE;
     }
-  
-  /* Need to say "*x > right_x" rather than >=, since on character
-     terminals, the vertical line's x coordinate is right_x.  */
-  if (*x < left_x || *x > right_x)
+
+  if (FRAME_WINDOW_P (f))
     {
-      /* Other lines than the mode line don't include flags areas and
-        scroll bars on the left.  */
+      if (!w->pseudo_window_p
+         && !FRAME_HAS_VERTICAL_SCROLL_BARS (f)
+         && !WINDOW_RIGHTMOST_P (w)
+         && (abs (*x - right_x - flags_area_width) < CANON_X_UNIT (f) / 2))
+       return ON_VERTICAL_BORDER;
+
+      if (*x < left_x || *x > right_x)
+       {
+         /* Other lines than the mode line don't include flags areas and
+            scroll bars on the left.  */
       
-      /* Convert X and Y to window-relative pixel coordinates.  */
-      *x -= left_x;
-      *y -= top_y;
-      return *x < left_x ? ON_LEFT_FRINGE : ON_RIGHT_FRINGE;
+         /* Convert X and Y to window-relative pixel coordinates.  */
+         *x -= left_x;
+         *y -= top_y;
+         return *x < left_x ? ON_LEFT_FRINGE : ON_RIGHT_FRINGE;
+       }
     }
+  else
+    {
+      /* Need to say "*x > right_x" rather than >=, since on character
+        terminals, the vertical line's x coordinate is right_x.  */
+      if (*x < left_x || *x > right_x)
+       {
+         /* Other lines than the mode line don't include flags areas and
+            scroll bars on the left.  */
+      
+         /* Convert X and Y to window-relative pixel coordinates.  */
+         *x -= left_x;
+         *y -= top_y;
+         return *x < left_x ? ON_LEFT_FRINGE : ON_RIGHT_FRINGE;
+       }
   
-  /* Here, too, "*x > right_x" is because of character terminals.  */
-  if (!w->pseudo_window_p
-      && !WINDOW_RIGHTMOST_P (w)
-      && *x > right_x - CANON_X_UNIT (f))
-    /* On the border on the right side of the window?  Assume that
-       this area begins at RIGHT_X minus a canonical char width.  */
-    return ON_VERTICAL_BORDER;
+      /* Here, too, "*x > right_x" is because of character terminals.  */
+      if (!w->pseudo_window_p
+         && !WINDOW_RIGHTMOST_P (w)
+         && *x > right_x - CANON_X_UNIT (f))
+       /* On the border on the right side of the window?  Assume that
+          this area begins at RIGHT_X minus a canonical char width.  */
+       return ON_VERTICAL_BORDER;
+    }
   
   /* Convert X and Y to window-relative pixel coordinates.  */
   *x -= left_x;