emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r116586: More fixes for mouse glyph calculations (Bu


From: Martin Rudalics
Subject: [Emacs-diffs] trunk r116586: More fixes for mouse glyph calculations (Bug#16647).
Date: Thu, 27 Feb 2014 19:22:35 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116586
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Thu 2014-02-27 20:22:10 +0100
message:
  More fixes for mouse glyph calculations (Bug#16647).
  
  More fixes for mouse glyph calculations (Bug#16647).
  * window.c (coordinates_in_window): In intersection of
  horizontal and vertical window dividers prefer the horizontal
  one.  Add some extra parens to last fix.
  (window_relative_x_coord): Return x-coordinate for header and
  mode line too.
  * xdisp.c (remember_mouse_glyph): In text area don't extend
  glyph into mode line to show the vertical drag cursor there
  immediately.  Subdivide mouse glyphs in right fringes to show a
  horizontal drag cursor as soon as we enter the "grabbable width"
  portion.  Handle vertical border case separately.  Do not
  subdivide window divider areas.
  (note_mouse_highlight): On bottom divider of bottommost windows
  show vertical drag cursor only when the minibuffer window can be
  resized.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/window.c                   window.c-20091113204419-o5vbwnq5f7feedwu-231
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-02-27 17:42:00 +0000
+++ b/src/ChangeLog     2014-02-27 19:22:10 +0000
@@ -1,3 +1,21 @@
+2014-02-27  Martin Rudalics  <address@hidden>
+
+       More fixes for mouse glyph calculations (Bug#16647).
+       * window.c (coordinates_in_window): In intersection of
+       horizontal and vertical window dividers prefer the horizontal
+       one.  Add some extra parens to last fix.
+       (window_relative_x_coord): Return x-coordinate for header and
+       mode line too.
+       * xdisp.c (remember_mouse_glyph): In text area don't extend
+       glyph into mode line to show the vertical drag cursor there
+       immediately.  Subdivide mouse glyphs in right fringes to show a
+       horizontal drag cursor as soon as we enter the "grabbable width"
+       portion.  Handle vertical border case separately.  Do not
+       subdivide window divider areas.
+       (note_mouse_highlight): On bottom divider of bottommost windows
+       show vertical drag cursor only when the minibuffer window can be
+       resized.
+
 2014-02-27  Eli Zaretskii  <address@hidden>
 
        * xdisp.c (pop_it): Restore the it->face_box_p flag which could be

=== modified file 'src/window.c'
--- a/src/window.c      2014-02-26 08:07:34 +0000
+++ b/src/window.c      2014-02-27 19:22:10 +0000
@@ -1266,18 +1266,18 @@
   if (y < top_y || y >= bottom_y || x < left_x || x >= right_x)
     return ON_NOTHING;
 
-  /* On vertical window divider (which prevails horizontal
-     dividers)?  */
-  if (!WINDOW_RIGHTMOST_P (w)
-      && WINDOW_RIGHT_DIVIDER_WIDTH (w) > 0
-      && x >= right_x - WINDOW_RIGHT_DIVIDER_WIDTH (w)
-      && x <= right_x)
+  /* On the horizontal window divider (which prevails the vertical
+     divider)?  */
+  if (WINDOW_BOTTOM_DIVIDER_WIDTH (w) > 0
+      && y >= (bottom_y - WINDOW_BOTTOM_DIVIDER_WIDTH (w))
+      && y <= bottom_y)
+    return ON_BOTTOM_DIVIDER;
+  /* On vertical window divider?  */
+  else if (!WINDOW_RIGHTMOST_P (w)
+          && WINDOW_RIGHT_DIVIDER_WIDTH (w) > 0
+          && x >= right_x - WINDOW_RIGHT_DIVIDER_WIDTH (w)
+          && x <= right_x)
     return ON_RIGHT_DIVIDER;
-  /* On the horizontal window divider?  */
-  else if (WINDOW_BOTTOM_DIVIDER_WIDTH (w) > 0
-          && y >= (bottom_y - WINDOW_BOTTOM_DIVIDER_WIDTH (w))
-          && y <= bottom_y)
-    return ON_BOTTOM_DIVIDER;
   /* On the mode or header line?   */
   else if ((WINDOW_WANTS_MODELINE_P (w)
            && y >= (bottom_y
@@ -1295,12 +1295,12 @@
         bars.  Note: If scrollbars are on the left, the window that
         must be eventually resized is that on the left of WINDOW.  */
       if ((WINDOW_RIGHT_DIVIDER_WIDTH (w) == 0)
-         && (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))
+         && ((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;
@@ -1386,6 +1386,8 @@
     case ON_TEXT:
       return x - window_box_left (w, TEXT_AREA);
 
+    case ON_HEADER_LINE:
+    case ON_MODE_LINE:
     case ON_LEFT_FRINGE:
       return x - left_x;
 

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2014-02-27 17:42:00 +0000
+++ b/src/xdisp.c       2014-02-27 19:22:10 +0000
@@ -2419,7 +2419,13 @@
            }
 
          if (part != ON_MODE_LINE && part != ON_HEADER_LINE)
-           gx += window_box_left_offset (w, area);
+           {
+             gx += window_box_left_offset (w, area);
+             /* Don't expand over the modeline to make sure the vertical
+                drag cursor is shown early enough.  */
+             height = min (height,
+                           max (0, WINDOW_BOX_HEIGHT_NO_MODE_LINE (w) - gy));
+           }
        }
       else
        {
@@ -2427,6 +2433,10 @@
          gx = (x / width) * width;
          y -= gy;
          gy += (y / height) * height;
+         if (part != ON_MODE_LINE && part != ON_HEADER_LINE)
+           /* See comment above.  */
+           height = min (height,
+                         max (0, WINDOW_BOX_HEIGHT_NO_MODE_LINE (w) - gy));
        }
       break;
 
@@ -2441,7 +2451,22 @@
       gx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
            ? window_box_right_offset (w, RIGHT_MARGIN_AREA)
            : window_box_right_offset (w, TEXT_AREA));
-      width = WINDOW_RIGHT_FRINGE_WIDTH (w);
+      if (WINDOW_RIGHT_DIVIDER_WIDTH (w) == 0
+         && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)
+         && !WINDOW_RIGHTMOST_P (w))
+       if (gx < WINDOW_PIXEL_WIDTH (w) - width)
+         /* Make sure the vertical border can get her own glyph to the
+            right of the one we build here.  */
+         width = WINDOW_RIGHT_FRINGE_WIDTH (w) - width;
+       else
+         width = WINDOW_PIXEL_WIDTH (w) - gx;
+      else
+       width = WINDOW_RIGHT_FRINGE_WIDTH (w);
+
+      goto row_glyph;
+
+    case ON_VERTICAL_BORDER:
+      gx = WINDOW_PIXEL_WIDTH (w) - width;
       goto row_glyph;
 
     case ON_SCROLL_BAR:
@@ -2452,35 +2477,40 @@
                  ? WINDOW_RIGHT_FRINGE_WIDTH (w)
                  : 0)));
       width = WINDOW_SCROLL_BAR_AREA_WIDTH (w);
-      goto row_glyph;
+
+    row_glyph:
+      gr = 0, gy = 0;
+      for (; r <= end_row && r->enabled_p; ++r)
+       if (r->y + r->height > y)
+         {
+           gr = r; gy = r->y;
+           break;
+         }
+
+      if (gr && gy <= y)
+       height = gr->height;
+      else
+       {
+         /* Use nominal line height at end of window.  */
+         y -= gy;
+         gy += (y / height) * height;
+       }
+      break;
 
     case ON_RIGHT_DIVIDER:
-      gx = WINDOW_RIGHT_PIXEL_EDGE (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w);
+      gx = WINDOW_PIXEL_WIDTH (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w);
       width = WINDOW_RIGHT_DIVIDER_WIDTH (w);
-      goto row_glyph;
+      gy = 0;
+      /* The bottom divider prevails. */
+      height = WINDOW_PIXEL_HEIGHT (w) - WINDOW_BOTTOM_DIVIDER_WIDTH (w);
+      goto add_edge;;
 
     case ON_BOTTOM_DIVIDER:
       gx = 0;
-      width = WINDOW_RIGHT_PIXEL_EDGE (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w);
-
-    row_glyph:
-      gr = 0, gy = 0;
-      for (; r <= end_row && r->enabled_p; ++r)
-       if (r->y + r->height > y)
-         {
-           gr = r; gy = r->y;
-           break;
-         }
-
-      if (gr && gy <= y)
-       height = gr->height;
-      else
-       {
-         /* Use nominal line height at end of window.  */
-         y -= gy;
-         gy += (y / height) * height;
-       }
-      break;
+      width = WINDOW_PIXEL_WIDTH (w);
+      gy = WINDOW_PIXEL_HEIGHT (w) - WINDOW_BOTTOM_DIVIDER_WIDTH (w);
+      height = WINDOW_BOTTOM_DIVIDER_WIDTH (w);
+      goto add_edge;
 
     default:
       ;
@@ -2502,6 +2532,7 @@
       goto store_rect;
     }
 
+ add_edge:
   gx += WINDOW_LEFT_EDGE_X (w);
   gy += WINDOW_TOP_EDGE_Y (w);
 
@@ -28682,10 +28713,15 @@
       help_echo_string = build_string ("drag-mouse-1: resize");
     }
   else if (part == ON_BOTTOM_DIVIDER)
-    {
-      cursor = FRAME_X_OUTPUT (f)->vertical_drag_cursor;
-      help_echo_string = build_string ("drag-mouse-1: resize");
-    }
+    if (! WINDOW_BOTTOMMOST_P (w)
+       || minibuf_level
+       || NILP (Vresize_mini_windows))
+      {
+       cursor = FRAME_X_OUTPUT (f)->vertical_drag_cursor;
+       help_echo_string = build_string ("drag-mouse-1: resize");
+      }
+    else
+      cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
   else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE
           || part == ON_SCROLL_BAR)
     cursor = FRAME_X_OUTPUT (f)->nontext_cursor;


reply via email to

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