+2014-02-27 Martin Rudalics <rudalics@gmx.at>
+
+ 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 <eliz@gnu.org>
* xdisp.c (pop_it): Restore the it->face_box_p flag which could be
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)
- 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)
+ /* 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 mode or header line? */
else if ((WINDOW_WANTS_MODELINE_P (w)
&& y >= (bottom_y
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;
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;
}
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
{
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;
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:
? WINDOW_RIGHT_FRINGE_WIDTH (w)
: 0)));
width = WINDOW_SCROLL_BAR_AREA_WIDTH (w);
- goto row_glyph;
-
- case ON_RIGHT_DIVIDER:
- gx = WINDOW_RIGHT_PIXEL_EDGE (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w);
- width = WINDOW_RIGHT_DIVIDER_WIDTH (w);
- goto row_glyph;
-
- case ON_BOTTOM_DIVIDER:
- gx = 0;
- width = WINDOW_RIGHT_PIXEL_EDGE (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w);
row_glyph:
gr = 0, gy = 0;
}
break;
+ case ON_RIGHT_DIVIDER:
+ gx = WINDOW_PIXEL_WIDTH (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w);
+ width = WINDOW_RIGHT_DIVIDER_WIDTH (w);
+ 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_PIXEL_WIDTH (w);
+ gy = WINDOW_PIXEL_HEIGHT (w) - WINDOW_BOTTOM_DIVIDER_WIDTH (w);
+ height = WINDOW_BOTTOM_DIVIDER_WIDTH (w);
+ goto add_edge;
+
default:
;
virtual_glyph:
goto store_rect;
}
+ add_edge:
gx += WINDOW_LEFT_EDGE_X (w);
gy += WINDOW_TOP_EDGE_Y (w);
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;