emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106088: Rewrite and delabelize verti


From: martin rudalics
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106088: Rewrite and delabelize vertical border check. (Bug#5357) (Bug#9618)
Date: Sat, 15 Oct 2011 12:12:00 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106088
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Sat 2011-10-15 12:12:00 +0200
message:
  Rewrite and delabelize vertical border check.  (Bug#5357) (Bug#9618)
  
  * window.c (coordinates_in_window): Rewrite and delabelize
  vertical border check.  (Bug#5357) (Bug#9618)
modified:
  src/ChangeLog
  src/window.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-10-14 17:44:39 +0000
+++ b/src/ChangeLog     2011-10-15 10:12:00 +0000
@@ -1,3 +1,8 @@
+2011-10-15  Martin Rudalics  <address@hidden>
+
+       * window.c (coordinates_in_window): Rewrite and delabelize
+       vertical border check.  (Bug#5357) (Bug#9618)
+
 2011-10-14  Stefan Monnier  <address@hidden>
 
        * xterm.c (frame_highlight, frame_unhighlight): Ignore unexplained

=== modified file 'src/window.c'
--- a/src/window.c      2011-09-24 22:51:36 +0000
+++ b/src/window.c      2011-10-15 10:12:00 +0000
@@ -919,22 +919,45 @@
 coordinates_in_window (register struct window *w, int x, int y)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
-  int left_x, right_x;
   enum window_part part;
   int ux = FRAME_COLUMN_WIDTH (f);
-  int x0 = WINDOW_LEFT_EDGE_X (w);
-  int x1 = WINDOW_RIGHT_EDGE_X (w);
+  int left_x = WINDOW_LEFT_EDGE_X (w);
+  int right_x = WINDOW_RIGHT_EDGE_X (w);
+  int top_y = WINDOW_TOP_EDGE_Y (w);
+  int bottom_y = WINDOW_BOTTOM_EDGE_Y (w);
   /* The width of the area where the vertical line can be dragged.
      (Between mode lines for instance.  */
   int grabbable_width = ux;
   int lmargin_width, rmargin_width, text_left, text_right;
-  int top_y = WINDOW_TOP_EDGE_Y (w);
-  int bottom_y = WINDOW_BOTTOM_EDGE_Y (w);
 
-  /* Outside any interesting row?  */
-  if (y < top_y || y >= bottom_y)
+  /* Outside any interesting row or column?  */
+  if (y < top_y || y >= bottom_y || x < left_x || x >= right_x)
     return ON_NOTHING;
 
+  /* On the mode line or header line?   */
+  if ((WINDOW_WANTS_MODELINE_P (w)
+       && y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)
+       && (part = ON_MODE_LINE))
+      || (WINDOW_WANTS_HEADER_LINE_P (w)
+         && y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)
+         && (part = ON_HEADER_LINE)))
+    {
+      /* If it's under/over the scroll bar portion of the mode/header
+        line, say it's on the vertical line.  That's to be able to
+        resize windows horizontally in case we're using toolkit scroll
+        bars.  Note: If scrollbars are on the left, the window that
+        must be eventually resized is that on the left of WINDOW.  */
+      if ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)
+          && !WINDOW_LEFTMOST_P (w)
+          && eabs (x - left_x) < grabbable_width)
+         || (!WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)
+             && !WINDOW_RIGHTMOST_P (w)
+             && eabs (x - right_x) < grabbable_width))
+       return ON_VERTICAL_BORDER;
+      else
+       return part;
+    }
+
   /* In what's below, we subtract 1 when computing right_x because we
      want the rightmost pixel, which is given by left_pixel+width-1.  */
   if (w->pseudo_window_p)
@@ -948,50 +971,6 @@
       right_x = WINDOW_BOX_RIGHT_EDGE_X (w) - 1;
     }
 
-  /* On the mode line or header line?  If it's near the start of
-     the mode or header line of window that's has a horizontal
-     sibling, say it's on the vertical line.  That's to be able
-     to resize windows horizontally in case we're using toolkit
-     scroll bars.  */
-
-  if (WINDOW_WANTS_MODELINE_P (w)
-      && y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w))
-    {
-      part = ON_MODE_LINE;
-
-    header_vertical_border_check:
-      /* We're somewhere on the mode line.  We consider the place
-        between mode lines of horizontally adjacent mode lines
-        as the vertical border.  If scroll bars on the left,
-        return the right window.  */
-      if ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)
-          || WINDOW_RIGHTMOST_P (w))
-         && !WINDOW_LEFTMOST_P (w)
-         && eabs (x - x0) < grabbable_width)
-       return ON_VERTICAL_BORDER;
-
-      /* Make sure we're not at the rightmost position of a
-        mode-/header-line and there's yet another window on the
-        right.  (Bug#1372)  */
-      else if ((WINDOW_RIGHTMOST_P (w) || x < x1)
-              && eabs (x - x1) < grabbable_width)
-       return ON_VERTICAL_BORDER;
-
-      if (x < x0 || x >= x1)
-       return ON_NOTHING;
-
-      return part;
-    }
-
-  if (WINDOW_WANTS_HEADER_LINE_P (w)
-      && y < top_y + CURRENT_HEADER_LINE_HEIGHT (w))
-    {
-      part = ON_HEADER_LINE;
-      goto header_vertical_border_check;
-    }
-
-  if (x < x0 || x >= x1) return ON_NOTHING;
-
   /* Outside any interesting column?  */
   if (x < left_x || x > right_x)
     return ON_SCROLL_BAR;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]