aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Rudalics2014-02-27 20:22:10 +0100
committerMartin Rudalics2014-02-27 20:22:10 +0100
commit653b6ea317969d0e78f13e7e84e970c4032a298a (patch)
tree95a0f100e7b903165885279434a06ac69431e8e2 /src
parent11de63ede082fe5913f9714f4bba05ac6e6b984c (diff)
downloademacs-653b6ea317969d0e78f13e7e84e970c4032a298a.tar.gz
emacs-653b6ea317969d0e78f13e7e84e970c4032a298a.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog18
-rw-r--r--src/window.c36
-rw-r--r--src/xdisp.c68
3 files changed, 89 insertions, 33 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5850431cf93..9ec638374f5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,21 @@
12014-02-27 Martin Rudalics <rudalics@gmx.at>
2
3 More fixes for mouse glyph calculations (Bug#16647).
4 * window.c (coordinates_in_window): In intersection of
5 horizontal and vertical window dividers prefer the horizontal
6 one. Add some extra parens to last fix.
7 (window_relative_x_coord): Return x-coordinate for header and
8 mode line too.
9 * xdisp.c (remember_mouse_glyph): In text area don't extend
10 glyph into mode line to show the vertical drag cursor there
11 immediately. Subdivide mouse glyphs in right fringes to show a
12 horizontal drag cursor as soon as we enter the "grabbable width"
13 portion. Handle vertical border case separately. Do not
14 subdivide window divider areas.
15 (note_mouse_highlight): On bottom divider of bottommost windows
16 show vertical drag cursor only when the minibuffer window can be
17 resized.
18
12014-02-27 Eli Zaretskii <eliz@gnu.org> 192014-02-27 Eli Zaretskii <eliz@gnu.org>
2 20
3 * xdisp.c (pop_it): Restore the it->face_box_p flag which could be 21 * xdisp.c (pop_it): Restore the it->face_box_p flag which could be
diff --git a/src/window.c b/src/window.c
index 2fb0dcaadaa..b2a6ff4ff2d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1266,18 +1266,18 @@ coordinates_in_window (register struct window *w, int x, int y)
1266 if (y < top_y || y >= bottom_y || x < left_x || x >= right_x) 1266 if (y < top_y || y >= bottom_y || x < left_x || x >= right_x)
1267 return ON_NOTHING; 1267 return ON_NOTHING;
1268 1268
1269 /* On vertical window divider (which prevails horizontal 1269 /* On the horizontal window divider (which prevails the vertical
1270 dividers)? */ 1270 divider)? */
1271 if (!WINDOW_RIGHTMOST_P (w) 1271 if (WINDOW_BOTTOM_DIVIDER_WIDTH (w) > 0
1272 && WINDOW_RIGHT_DIVIDER_WIDTH (w) > 0 1272 && y >= (bottom_y - WINDOW_BOTTOM_DIVIDER_WIDTH (w))
1273 && x >= right_x - WINDOW_RIGHT_DIVIDER_WIDTH (w) 1273 && y <= bottom_y)
1274 && x <= right_x)
1275 return ON_RIGHT_DIVIDER;
1276 /* On the horizontal window divider? */
1277 else if (WINDOW_BOTTOM_DIVIDER_WIDTH (w) > 0
1278 && y >= (bottom_y - WINDOW_BOTTOM_DIVIDER_WIDTH (w))
1279 && y <= bottom_y)
1280 return ON_BOTTOM_DIVIDER; 1274 return ON_BOTTOM_DIVIDER;
1275 /* On vertical window divider? */
1276 else if (!WINDOW_RIGHTMOST_P (w)
1277 && WINDOW_RIGHT_DIVIDER_WIDTH (w) > 0
1278 && x >= right_x - WINDOW_RIGHT_DIVIDER_WIDTH (w)
1279 && x <= right_x)
1280 return ON_RIGHT_DIVIDER;
1281 /* On the mode or header line? */ 1281 /* On the mode or header line? */
1282 else if ((WINDOW_WANTS_MODELINE_P (w) 1282 else if ((WINDOW_WANTS_MODELINE_P (w)
1283 && y >= (bottom_y 1283 && y >= (bottom_y
@@ -1295,12 +1295,12 @@ coordinates_in_window (register struct window *w, int x, int y)
1295 bars. Note: If scrollbars are on the left, the window that 1295 bars. Note: If scrollbars are on the left, the window that
1296 must be eventually resized is that on the left of WINDOW. */ 1296 must be eventually resized is that on the left of WINDOW. */
1297 if ((WINDOW_RIGHT_DIVIDER_WIDTH (w) == 0) 1297 if ((WINDOW_RIGHT_DIVIDER_WIDTH (w) == 0)
1298 && (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) 1298 && ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)
1299 && !WINDOW_LEFTMOST_P (w) 1299 && !WINDOW_LEFTMOST_P (w)
1300 && eabs (x - left_x) < grabbable_width) 1300 && eabs (x - left_x) < grabbable_width)
1301 || (!WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) 1301 || (!WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)
1302 && !WINDOW_RIGHTMOST_P (w) 1302 && !WINDOW_RIGHTMOST_P (w)
1303 && eabs (x - right_x) < grabbable_width)) 1303 && eabs (x - right_x) < grabbable_width)))
1304 return ON_VERTICAL_BORDER; 1304 return ON_VERTICAL_BORDER;
1305 else 1305 else
1306 return part; 1306 return part;
@@ -1386,6 +1386,8 @@ window_relative_x_coord (struct window *w, enum window_part part, int x)
1386 case ON_TEXT: 1386 case ON_TEXT:
1387 return x - window_box_left (w, TEXT_AREA); 1387 return x - window_box_left (w, TEXT_AREA);
1388 1388
1389 case ON_HEADER_LINE:
1390 case ON_MODE_LINE:
1389 case ON_LEFT_FRINGE: 1391 case ON_LEFT_FRINGE:
1390 return x - left_x; 1392 return x - left_x;
1391 1393
diff --git a/src/xdisp.c b/src/xdisp.c
index 203fd303c4a..33c99cd596b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2419,7 +2419,13 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
2419 } 2419 }
2420 2420
2421 if (part != ON_MODE_LINE && part != ON_HEADER_LINE) 2421 if (part != ON_MODE_LINE && part != ON_HEADER_LINE)
2422 gx += window_box_left_offset (w, area); 2422 {
2423 gx += window_box_left_offset (w, area);
2424 /* Don't expand over the modeline to make sure the vertical
2425 drag cursor is shown early enough. */
2426 height = min (height,
2427 max (0, WINDOW_BOX_HEIGHT_NO_MODE_LINE (w) - gy));
2428 }
2423 } 2429 }
2424 else 2430 else
2425 { 2431 {
@@ -2427,6 +2433,10 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
2427 gx = (x / width) * width; 2433 gx = (x / width) * width;
2428 y -= gy; 2434 y -= gy;
2429 gy += (y / height) * height; 2435 gy += (y / height) * height;
2436 if (part != ON_MODE_LINE && part != ON_HEADER_LINE)
2437 /* See comment above. */
2438 height = min (height,
2439 max (0, WINDOW_BOX_HEIGHT_NO_MODE_LINE (w) - gy));
2430 } 2440 }
2431 break; 2441 break;
2432 2442
@@ -2441,7 +2451,22 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
2441 gx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) 2451 gx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
2442 ? window_box_right_offset (w, RIGHT_MARGIN_AREA) 2452 ? window_box_right_offset (w, RIGHT_MARGIN_AREA)
2443 : window_box_right_offset (w, TEXT_AREA)); 2453 : window_box_right_offset (w, TEXT_AREA));
2444 width = WINDOW_RIGHT_FRINGE_WIDTH (w); 2454 if (WINDOW_RIGHT_DIVIDER_WIDTH (w) == 0
2455 && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)
2456 && !WINDOW_RIGHTMOST_P (w))
2457 if (gx < WINDOW_PIXEL_WIDTH (w) - width)
2458 /* Make sure the vertical border can get her own glyph to the
2459 right of the one we build here. */
2460 width = WINDOW_RIGHT_FRINGE_WIDTH (w) - width;
2461 else
2462 width = WINDOW_PIXEL_WIDTH (w) - gx;
2463 else
2464 width = WINDOW_RIGHT_FRINGE_WIDTH (w);
2465
2466 goto row_glyph;
2467
2468 case ON_VERTICAL_BORDER:
2469 gx = WINDOW_PIXEL_WIDTH (w) - width;
2445 goto row_glyph; 2470 goto row_glyph;
2446 2471
2447 case ON_SCROLL_BAR: 2472 case ON_SCROLL_BAR:
@@ -2452,16 +2477,6 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
2452 ? WINDOW_RIGHT_FRINGE_WIDTH (w) 2477 ? WINDOW_RIGHT_FRINGE_WIDTH (w)
2453 : 0))); 2478 : 0)));
2454 width = WINDOW_SCROLL_BAR_AREA_WIDTH (w); 2479 width = WINDOW_SCROLL_BAR_AREA_WIDTH (w);
2455 goto row_glyph;
2456
2457 case ON_RIGHT_DIVIDER:
2458 gx = WINDOW_RIGHT_PIXEL_EDGE (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w);
2459 width = WINDOW_RIGHT_DIVIDER_WIDTH (w);
2460 goto row_glyph;
2461
2462 case ON_BOTTOM_DIVIDER:
2463 gx = 0;
2464 width = WINDOW_RIGHT_PIXEL_EDGE (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w);
2465 2480
2466 row_glyph: 2481 row_glyph:
2467 gr = 0, gy = 0; 2482 gr = 0, gy = 0;
@@ -2482,6 +2497,21 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
2482 } 2497 }
2483 break; 2498 break;
2484 2499
2500 case ON_RIGHT_DIVIDER:
2501 gx = WINDOW_PIXEL_WIDTH (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w);
2502 width = WINDOW_RIGHT_DIVIDER_WIDTH (w);
2503 gy = 0;
2504 /* The bottom divider prevails. */
2505 height = WINDOW_PIXEL_HEIGHT (w) - WINDOW_BOTTOM_DIVIDER_WIDTH (w);
2506 goto add_edge;;
2507
2508 case ON_BOTTOM_DIVIDER:
2509 gx = 0;
2510 width = WINDOW_PIXEL_WIDTH (w);
2511 gy = WINDOW_PIXEL_HEIGHT (w) - WINDOW_BOTTOM_DIVIDER_WIDTH (w);
2512 height = WINDOW_BOTTOM_DIVIDER_WIDTH (w);
2513 goto add_edge;
2514
2485 default: 2515 default:
2486 ; 2516 ;
2487 virtual_glyph: 2517 virtual_glyph:
@@ -2502,6 +2532,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
2502 goto store_rect; 2532 goto store_rect;
2503 } 2533 }
2504 2534
2535 add_edge:
2505 gx += WINDOW_LEFT_EDGE_X (w); 2536 gx += WINDOW_LEFT_EDGE_X (w);
2506 gy += WINDOW_TOP_EDGE_Y (w); 2537 gy += WINDOW_TOP_EDGE_Y (w);
2507 2538
@@ -28682,10 +28713,15 @@ note_mouse_highlight (struct frame *f, int x, int y)
28682 help_echo_string = build_string ("drag-mouse-1: resize"); 28713 help_echo_string = build_string ("drag-mouse-1: resize");
28683 } 28714 }
28684 else if (part == ON_BOTTOM_DIVIDER) 28715 else if (part == ON_BOTTOM_DIVIDER)
28685 { 28716 if (! WINDOW_BOTTOMMOST_P (w)
28686 cursor = FRAME_X_OUTPUT (f)->vertical_drag_cursor; 28717 || minibuf_level
28687 help_echo_string = build_string ("drag-mouse-1: resize"); 28718 || NILP (Vresize_mini_windows))
28688 } 28719 {
28720 cursor = FRAME_X_OUTPUT (f)->vertical_drag_cursor;
28721 help_echo_string = build_string ("drag-mouse-1: resize");
28722 }
28723 else
28724 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
28689 else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE 28725 else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE
28690 || part == ON_SCROLL_BAR) 28726 || part == ON_SCROLL_BAR)
28691 cursor = FRAME_X_OUTPUT (f)->nontext_cursor; 28727 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;