aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2006-05-27 22:37:39 +0000
committerKim F. Storm2006-05-27 22:37:39 +0000
commite8f6b0db19708c117c820c6e504fbf4932462247 (patch)
treefd9c78a4b80c1b5288554f272aab172614b99f2e /src
parent11d2f3e76d1807e71ef56b4c63fa698b630a3ab1 (diff)
downloademacs-e8f6b0db19708c117c820c6e504fbf4932462247.tar.gz
emacs-e8f6b0db19708c117c820c6e504fbf4932462247.zip
(x_draw_stretch_glyph_string): Fix problems with invisible
cursor and erasing cursor on partially visible stretch glyph on left. (x_draw_hollow_cursor): Compute x via get_phys_cursor_geometry.
Diffstat (limited to 'src')
-rw-r--r--src/macterm.c36
-rw-r--r--src/w32term.c35
-rw-r--r--src/xterm.c36
3 files changed, 80 insertions, 27 deletions
diff --git a/src/macterm.c b/src/macterm.c
index 1f25b022f38..9a2d6e2a35d 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -3529,19 +3529,28 @@ x_draw_stretch_glyph_string (s)
3529 { 3529 {
3530 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor 3530 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
3531 as wide as the stretch glyph. */ 3531 as wide as the stretch glyph. */
3532 int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width); 3532 int width, background_width = s->background_width;
3533 int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
3534
3535 if (x < left_x)
3536 {
3537 background_width -= left_x - x;
3538 x = left_x;
3539 }
3540 width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
3533 3541
3534 /* Draw cursor. */ 3542 /* Draw cursor. */
3535 x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); 3543 x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
3536 3544
3537 /* Clear rest using the GC of the original non-cursor face. */ 3545 /* Clear rest using the GC of the original non-cursor face. */
3538 if (width < s->background_width) 3546 if (width < background_width)
3539 { 3547 {
3540 int x = s->x + width, y = s->y; 3548 int y = s->y;
3541 int w = s->background_width - width, h = s->height; 3549 int w = background_width - width, h = s->height;
3542 Rect r; 3550 Rect r;
3543 GC gc; 3551 GC gc;
3544 3552
3553 x += width;
3545 if (s->row->mouse_face_p 3554 if (s->row->mouse_face_p
3546 && cursor_in_mouse_face_p (s->w)) 3555 && cursor_in_mouse_face_p (s->w))
3547 { 3556 {
@@ -3568,8 +3577,18 @@ x_draw_stretch_glyph_string (s)
3568 } 3577 }
3569 } 3578 }
3570 else if (!s->background_filled_p) 3579 else if (!s->background_filled_p)
3571 x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, 3580 {
3572 s->height); 3581 int background_width = s->background_width;
3582 int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
3583
3584 if (x < left_x)
3585 {
3586 background_width -= left_x - x;
3587 x = left_x;
3588 }
3589 if (background_width > 0)
3590 x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
3591 }
3573 3592
3574 s->background_filled_p = 1; 3593 s->background_filled_p = 1;
3575} 3594}
@@ -5396,8 +5415,7 @@ x_draw_hollow_cursor (w, row)
5396 return; 5415 return;
5397 5416
5398 /* Compute frame-relative coordinates for phys cursor. */ 5417 /* Compute frame-relative coordinates for phys cursor. */
5399 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 5418 get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h);
5400 y = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
5401 wd = w->phys_cursor_width; 5419 wd = w->phys_cursor_width;
5402 5420
5403 /* The foreground of cursor_gc is typically the same as the normal 5421 /* The foreground of cursor_gc is typically the same as the normal
diff --git a/src/w32term.c b/src/w32term.c
index 2b5c9da39b6..1b2b5a30503 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -2389,20 +2389,29 @@ x_draw_stretch_glyph_string (s)
2389 { 2389 {
2390 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor 2390 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
2391 as wide as the stretch glyph. */ 2391 as wide as the stretch glyph. */
2392 int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width); 2392 int width, background_width = s->background_width;
2393 int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
2394
2395 if (x < left_x)
2396 {
2397 background_width -= left_x - x;
2398 x = left_x;
2399 }
2400 width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
2393 2401
2394 /* Draw cursor. */ 2402 /* Draw cursor. */
2395 x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); 2403 x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
2396 2404
2397 /* Clear rest using the GC of the original non-cursor face. */ 2405 /* Clear rest using the GC of the original non-cursor face. */
2398 if (width < s->background_width) 2406 if (width < background_width)
2399 { 2407 {
2400 XGCValues *gc = s->face->gc; 2408 XGCValues *gc = s->face->gc;
2401 int x = s->x + width, y = s->y; 2409 int y = s->y;
2402 int w = s->background_width - width, h = s->height; 2410 int w = background_width - width, h = s->height;
2403 RECT r; 2411 RECT r;
2404 HDC hdc = s->hdc; 2412 HDC hdc = s->hdc;
2405 2413
2414 x += width;
2406 if (s->row->mouse_face_p 2415 if (s->row->mouse_face_p
2407 && cursor_in_mouse_face_p (s->w)) 2416 && cursor_in_mouse_face_p (s->w))
2408 { 2417 {
@@ -2431,8 +2440,17 @@ x_draw_stretch_glyph_string (s)
2431 } 2440 }
2432 } 2441 }
2433 else if (!s->background_filled_p) 2442 else if (!s->background_filled_p)
2434 x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, 2443 {
2435 s->height); 2444 int background_width = s->background_width;
2445 int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
2446
2447 if (x < left_x)
2448 {
2449 background_width -= left_x - x;
2450 x = left_x;
2451 }
2452 if (background_width > 0)
2453 x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
2436 2454
2437 s->background_filled_p = 1; 2455 s->background_filled_p = 1;
2438} 2456}
@@ -4942,8 +4960,7 @@ x_draw_hollow_cursor (w, row)
4942 return; 4960 return;
4943 4961
4944 /* Compute frame-relative coordinates for phys cursor. */ 4962 /* Compute frame-relative coordinates for phys cursor. */
4945 rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 4963 get_phys_cursor_geometry (w, row, cursor_glyph, &rect.left, &rect.top, &h);
4946 rect.top = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
4947 rect.bottom = rect.top + h; 4964 rect.bottom = rect.top + h;
4948 rect.right = rect.left + w->phys_cursor_width; 4965 rect.right = rect.left + w->phys_cursor_width;
4949 4966
diff --git a/src/xterm.c b/src/xterm.c
index f14f281a634..6624fa79df1 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2531,19 +2531,28 @@ x_draw_stretch_glyph_string (s)
2531 { 2531 {
2532 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor 2532 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
2533 as wide as the stretch glyph. */ 2533 as wide as the stretch glyph. */
2534 int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width); 2534 int width, background_width = s->background_width;
2535 int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
2536
2537 if (x < left_x)
2538 {
2539 background_width -= left_x - x;
2540 x = left_x;
2541 }
2542 width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
2535 2543
2536 /* Draw cursor. */ 2544 /* Draw cursor. */
2537 x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); 2545 x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
2538 2546
2539 /* Clear rest using the GC of the original non-cursor face. */ 2547 /* Clear rest using the GC of the original non-cursor face. */
2540 if (width < s->background_width) 2548 if (width < background_width)
2541 { 2549 {
2542 int x = s->x + width, y = s->y; 2550 int y = s->y;
2543 int w = s->background_width - width, h = s->height; 2551 int w = background_width - width, h = s->height;
2544 XRectangle r; 2552 XRectangle r;
2545 GC gc; 2553 GC gc;
2546 2554
2555 x += width;
2547 if (s->row->mouse_face_p 2556 if (s->row->mouse_face_p
2548 && cursor_in_mouse_face_p (s->w)) 2557 && cursor_in_mouse_face_p (s->w))
2549 { 2558 {
@@ -2574,8 +2583,18 @@ x_draw_stretch_glyph_string (s)
2574 } 2583 }
2575 } 2584 }
2576 else if (!s->background_filled_p) 2585 else if (!s->background_filled_p)
2577 x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, 2586 {
2578 s->height); 2587 int background_width = s->background_width;
2588 int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
2589
2590 if (x < left_x)
2591 {
2592 background_width -= left_x - x;
2593 x = left_x;
2594 }
2595 if (background_width > 0)
2596 x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
2597 }
2579 2598
2580 s->background_filled_p = 1; 2599 s->background_filled_p = 1;
2581} 2600}
@@ -7155,8 +7174,7 @@ x_draw_hollow_cursor (w, row)
7155 return; 7174 return;
7156 7175
7157 /* Compute frame-relative coordinates for phys cursor. */ 7176 /* Compute frame-relative coordinates for phys cursor. */
7158 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 7177 get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h);
7159 y = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
7160 wd = w->phys_cursor_width; 7178 wd = w->phys_cursor_width;
7161 7179
7162 /* The foreground of cursor_gc is typically the same as the normal 7180 /* The foreground of cursor_gc is typically the same as the normal