aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2003-01-22 23:04:27 +0000
committerJason Rumney2003-01-22 23:04:27 +0000
commita18bb28da6bd731b1d5e80c683cc1dff67e0a120 (patch)
treea2535a23728a01cead797944ce761fe370b69ca9 /src
parent623cdbf20f4ab6c49f98aef73cd3c7dfa879d8a6 (diff)
downloademacs-a18bb28da6bd731b1d5e80c683cc1dff67e0a120.tar.gz
emacs-a18bb28da6bd731b1d5e80c683cc1dff67e0a120.zip
* w32term.c (x_draw_glyph_string_foreground)
(x_draw_composite_glyph_string_foreground): Implement overstriking. * w32term.c (x_write_glyphs): Clear phys_cursor_on_p if current phys_cursor's hpos is overwritten. This is still not completely correct, as it doesn't really make sense to use hpos at all to get the cursor glyph (as that is relative to the width of the characters on the line, which may have changed during the update). * w32term.c (notice_overwritten_cursor): Handle the special case of the cursor being in the first blank non-text line at the end of a window. * w32term.c (x_draw_hollow_cursor, x_draw_bar_cursor) (x_draw_phys_cursor_glyph): Set phys_cursor_width here. Compute from the x position returned by x_draw_glyphs. * w32term.c (note_mode_line_or_margin_highlight): Renamed from note_mode_line_highlight and extended. * w32term.c (last_window): New variable. (w32_read_socket) <WM_MOUSEMOVE>: Generate SELECT_WINDOW_EVENTs. (note_mouse_movement): Remove reimplemented code in #if 0.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog37
-rw-r--r--src/w32term.c269
2 files changed, 199 insertions, 107 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 87b647e11a2..aa933ee815e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,40 @@
12003-01-22 Jason Rumney <jasonr@gnu.org>
2
3 Sync changes with xterm.c and xfns.c.
4
5 * w32term.c (x_draw_glyph_string_foreground)
6 (x_draw_composite_glyph_string_foreground): Implement overstriking.
7
8 * w32term.c (x_write_glyphs): Clear phys_cursor_on_p if current
9 phys_cursor's hpos is overwritten. This is still not completely
10 correct, as it doesn't really make sense to use hpos at all to
11 get the cursor glyph (as that is relative to the width of the
12 characters on the line, which may have changed during the update).
13
14 * w32term.c (notice_overwritten_cursor): Handle the special case
15 of the cursor being in the first blank non-text line at the
16 end of a window.
17
18 * w32term.c (x_draw_hollow_cursor, x_draw_bar_cursor)
19 (x_draw_phys_cursor_glyph): Set phys_cursor_width here.
20 Compute from the x position returned by x_draw_glyphs.
21
22 (x_display_and_set_cursor): Don't set phys_cursor_width here,
23 except for NO_CURSOR and system caret, to make phys_cursor_width
24 contain what its name suggests.
25 (notice_overwritten_cursor): Consider the cursor image erased if
26 the output area intersects the cursor image in y-direction.
27
28 * w32term.c (note_mode_line_or_margin_highlight): Renamed from
29 note_mode_line_highlight and extended.
30
31 * w32term.c (last_window): New variable.
32 (w32_read_socket) <WM_MOUSEMOVE>: Generate SELECT_WINDOW_EVENTs.
33 (note_mouse_movement): Remove reimplemented code in #if 0.
34
35 * w32fns.c (x_set_cursor_type): Set cursor_type_changed,
36 not update_mode_lines, and always set it to 1.
37
12003-01-21 Jason Rumney <jasonr@gnu.org> 382003-01-21 Jason Rumney <jasonr@gnu.org>
2 39
3 * w32fns.c (IDC_HAND): Define it if system headers don't. 40 * w32fns.c (IDC_HAND): Define it if system headers don't.
diff --git a/src/w32term.c b/src/w32term.c
index dd12c5b871d..23929905334 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -176,6 +176,9 @@ static int any_help_event_p;
176 176
177int mouse_autoselect_window; 177int mouse_autoselect_window;
178 178
179/* Last window where we saw the mouse. Used by mouse-autoselect-window. */
180static Lisp_Object last_window;
181
179/* Non-zero means draw block and hollow cursor as wide as the glyph 182/* Non-zero means draw block and hollow cursor as wide as the glyph
180 under it. For example, if a block cursor is over a tab, it will be 183 under it. For example, if a block cursor is over a tab, it will be
181 drawn as wide as that tab on the display. */ 184 drawn as wide as that tab on the display. */
@@ -361,7 +364,8 @@ static int fast_find_string_pos P_ ((struct window *, int, Lisp_Object,
361static void set_output_cursor P_ ((struct cursor_pos *)); 364static void set_output_cursor P_ ((struct cursor_pos *));
362static struct glyph *x_y_to_hpos_vpos P_ ((struct window *, int, int, 365static struct glyph *x_y_to_hpos_vpos P_ ((struct window *, int, int,
363 int *, int *, int *, int)); 366 int *, int *, int *, int));
364static void note_mode_line_highlight P_ ((struct window *, int, int)); 367static void note_mode_line_or_margin_highlight P_ ((struct window *, int,
368 int, int));
365static void note_mouse_highlight P_ ((struct frame *, int, int)); 369static void note_mouse_highlight P_ ((struct frame *, int, int));
366static void note_tool_bar_highlight P_ ((struct frame *f, int, int)); 370static void note_tool_bar_highlight P_ ((struct frame *f, int, int));
367static void w32_handle_tool_bar_click P_ ((struct frame *, 371static void w32_handle_tool_bar_click P_ ((struct frame *,
@@ -3508,6 +3512,13 @@ x_draw_glyph_string_foreground (s)
3508 3512
3509 /* Draw text with TextOut and friends. */ 3513 /* Draw text with TextOut and friends. */
3510 w32_text_out (s, x, s->ybase - boff, s->char2b, s->nchars); 3514 w32_text_out (s, x, s->ybase - boff, s->char2b, s->nchars);
3515
3516 if (s->face->overstrike)
3517 {
3518 /* For overstriking (to simulate bold-face), draw the
3519 characters again shifted to the right by one pixel. */
3520 w32_text_out (s, x + 1, s->ybase - boff, s->char2b, s->nchars);
3521 }
3511 } 3522 }
3512 if (s->font && s->font->hfont) 3523 if (s->font && s->font->hfont)
3513 SelectObject (s->hdc, old_font); 3524 SelectObject (s->hdc, old_font);
@@ -3554,10 +3565,17 @@ x_draw_composite_glyph_string_foreground (s)
3554 else 3565 else
3555 { 3566 {
3556 for (i = 0; i < s->nchars; i++, ++s->gidx) 3567 for (i = 0; i < s->nchars; i++, ++s->gidx)
3557 w32_text_out (s, x + s->cmp->offsets[s->gidx * 2], 3568 {
3558 s->ybase - s->cmp->offsets[s->gidx * 2 + 1], 3569 w32_text_out (s, x + s->cmp->offsets[s->gidx * 2],
3559 s->char2b + i, 1); 3570 s->ybase - s->cmp->offsets[s->gidx * 2 + 1],
3571 s->char2b + i, 1);
3572 if (s->face->overstrike)
3573 w32_text_out (s, x + s->cmp->offsets[s->gidx * 2] + 1,
3574 s->ybase - s->cmp->offsets[s->gidx * 2 + 1],
3575 s->char2b + i, 1);
3576 }
3560 } 3577 }
3578
3561 if (s->font && s->font->hfont) 3579 if (s->font && s->font->hfont)
3562 SelectObject (s->hdc, old_font); 3580 SelectObject (s->hdc, old_font);
3563} 3581}
@@ -5181,6 +5199,14 @@ x_write_glyphs (start, len)
5181 hpos, hpos + len, 5199 hpos, hpos + len,
5182 DRAW_NORMAL_TEXT, 0); 5200 DRAW_NORMAL_TEXT, 0);
5183 5201
5202 /* Invalidate old phys cursor if the glyph at its hpos is redrawn. */
5203 if (updated_area == TEXT_AREA
5204 && updated_window->phys_cursor_on_p
5205 && updated_window->phys_cursor.vpos == output_cursor.vpos
5206 && updated_window->phys_cursor.hpos >= hpos
5207 && updated_window->phys_cursor.hpos < hpos + len)
5208 updated_window->phys_cursor_on_p = 0;
5209
5184 UNBLOCK_INPUT; 5210 UNBLOCK_INPUT;
5185 5211
5186 /* Advance the output cursor. */ 5212 /* Advance the output cursor. */
@@ -6339,28 +6365,6 @@ note_mouse_movement (frame, msg)
6339 memcpy (&last_mouse_motion_event, msg, sizeof (last_mouse_motion_event)); 6365 memcpy (&last_mouse_motion_event, msg, sizeof (last_mouse_motion_event));
6340 XSETFRAME (last_mouse_motion_frame, frame); 6366 XSETFRAME (last_mouse_motion_frame, frame);
6341 6367
6342#if 0 /* Calling Lisp asynchronously is not safe. */
6343 if (mouse_autoselect_window)
6344 {
6345 int area;
6346 Lisp_Object window;
6347 static Lisp_Object last_window;
6348
6349 window = window_from_coordinates (frame, mouse_x, mouse_y, &area, 0);
6350
6351 /* Window will be selected only when it is not selected now and
6352 last mouse movement event was not in it. Minibuffer window
6353 will be selected iff it is active. */
6354 if (!EQ (window, last_window)
6355 && !EQ (window, selected_window)
6356 && (!MINI_WINDOW_P (XWINDOW (window))
6357 || (EQ (window, minibuf_window) && minibuf_level > 0)))
6358 Fselect_window (window);
6359
6360 last_window=window;
6361 }
6362#endif
6363
6364 if (msg->hwnd != FRAME_W32_WINDOW (frame)) 6368 if (msg->hwnd != FRAME_W32_WINDOW (frame))
6365 { 6369 {
6366 frame->mouse_moved = 1; 6370 frame->mouse_moved = 1;
@@ -6501,79 +6505,54 @@ frame_to_window_pixel_xy (w, x, y)
6501} 6505}
6502 6506
6503 6507
6504/* Take proper action when mouse has moved to the mode or header line of 6508/* Take proper action when mouse has moved to the mode or header line
6505 window W, x-position X. MODE_LINE_P non-zero means mouse is on the 6509 or marginal area of window W, x-position X and y-position Y. Area
6506 mode line. X is relative to the start of the text display area of 6510 is 1, 3, 6 or 7 for the mode line, header line, left and right
6507 W, so the width of fringes and scroll bars must be subtracted 6511 marginal area respectively. X is relative to the start of the text
6508 to get a position relative to the start of the mode line. */ 6512 display area of W, so the width of bitmap areas and scroll bars
6513 must be subtracted to get a position relative to the start of the
6514 mode line. */
6509 6515
6510static void 6516static void
6511note_mode_line_highlight (w, x, mode_line_p) 6517note_mode_line_or_margin_highlight (w, x, y, portion)
6512 struct window *w; 6518 struct window *w;
6513 int x, mode_line_p; 6519 int x, y, portion;
6514{ 6520{
6515 struct frame *f = XFRAME (w->frame); 6521 struct frame *f = XFRAME (w->frame);
6516 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); 6522 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
6517 Cursor cursor = dpyinfo->vertical_scroll_bar_cursor; 6523 Cursor cursor = dpyinfo->vertical_scroll_bar_cursor;
6518 struct glyph_row *row; 6524 int charpos;
6525 Lisp_Object string, help, map, pos;
6519 6526
6520 if (mode_line_p) 6527 if (portion == 1 || portion == 3)
6521 row = MATRIX_MODE_LINE_ROW (w->current_matrix); 6528 string = mode_line_string (w, x, y, portion == 1, &charpos);
6522 else 6529 else
6523 row = MATRIX_HEADER_LINE_ROW (w->current_matrix); 6530 string = marginal_area_string (w, x, y, portion, &charpos);
6524 6531
6525 if (row->enabled_p) 6532 if (STRINGP (string))
6526 { 6533 {
6527 struct glyph *glyph, *end; 6534 pos = make_number (charpos);
6528 Lisp_Object help, map;
6529 int x0;
6530 6535
6531 /* Find the glyph under X. */ 6536 /* If we're on a string with `help-echo' text property, arrange
6532 glyph = row->glyphs[TEXT_AREA]; 6537 for the help to be displayed. This is done by setting the
6533 end = glyph + row->used[TEXT_AREA]; 6538 global variable help_echo to the help string. */
6534 x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f) 6539 help = Fget_text_property (pos, Qhelp_echo, string);
6535 + FRAME_X_LEFT_FRINGE_WIDTH (f)); 6540 if (!NILP (help))
6536
6537 while (glyph < end
6538 && x >= x0 + glyph->pixel_width)
6539 { 6541 {
6540 x0 += glyph->pixel_width; 6542 help_echo = help;
6541 ++glyph; 6543 XSETWINDOW (help_echo_window, w);
6544 help_echo_object = string;
6545 help_echo_pos = charpos;
6542 } 6546 }
6543 6547
6544 if (glyph < end 6548 /* Change the mouse pointer according to what is under X/Y. */
6545 && STRINGP (glyph->object) 6549 map = Fget_text_property (pos, Qlocal_map, string);
6546 && STRING_INTERVALS (glyph->object) 6550 if (!KEYMAPP (map))
6547 && glyph->charpos >= 0 6551 map = Fget_text_property (pos, Qkeymap, string);
6548 && glyph->charpos < SCHARS (glyph->object)) 6552 if (KEYMAPP (map))
6549 { 6553 cursor = f->output_data.w32->nontext_cursor;
6550 /* If we're on a string with `help-echo' text property,
6551 arrange for the help to be displayed. This is done by
6552 setting the global variable help_echo to the help string. */
6553 help = Fget_text_property (make_number (glyph->charpos),
6554 Qhelp_echo, glyph->object);
6555 if (!NILP (help))
6556 {
6557 help_echo = help;
6558 XSETWINDOW (help_echo_window, w);
6559 help_echo_object = glyph->object;
6560 help_echo_pos = glyph->charpos;
6561 }
6562
6563 /* Change the mouse pointer according to what is under X/Y. */
6564 map = Fget_text_property (make_number (glyph->charpos),
6565 Qlocal_map, glyph->object);
6566 if (KEYMAPP (map))
6567 cursor = f->output_data.w32->nontext_cursor;
6568 else
6569 {
6570 map = Fget_text_property (make_number (glyph->charpos),
6571 Qkeymap, glyph->object);
6572 if (KEYMAPP (map))
6573 cursor = f->output_data.w32->nontext_cursor;
6574 }
6575 }
6576 } 6554 }
6555
6577 w32_define_cursor (FRAME_W32_WINDOW (f), cursor); 6556 w32_define_cursor (FRAME_W32_WINDOW (f), cursor);
6578} 6557}
6579 6558
@@ -6643,9 +6622,9 @@ note_mouse_highlight (f, x, y)
6643 } 6622 }
6644 6623
6645 /* Mouse is on the mode or header line? */ 6624 /* Mouse is on the mode or header line? */
6646 if (portion == 1 || portion == 3) 6625 if (portion == 1 || portion == 3 || portion == 6 || portion == 7)
6647 { 6626 {
6648 note_mode_line_highlight (w, x, portion == 1); 6627 note_mode_line_or_margin_highlight (w, x, y, portion);
6649 return; 6628 return;
6650 } 6629 }
6651 6630
@@ -8805,7 +8784,38 @@ w32_read_socket (sd, bufp, numchars, expected)
8805 } 8784 }
8806 8785
8807 if (f) 8786 if (f)
8808 note_mouse_movement (f, &msg.msg); 8787 {
8788 /* Generate SELECT_WINDOW_EVENTs when needed. */
8789 if (mouse_autoselect_window)
8790 {
8791 Lisp_Object window;
8792 int area;
8793 int x = LOWORD (msg.msg.lParam);
8794 int y = HIWORD (msg.msg.lParam);
8795
8796 window = window_from_coordinates (f,
8797 x, y,
8798 &area, 0);
8799
8800 /* Window will be selected only when it is not
8801 selected now and last mouse movement event was
8802 not in it. Minibuffer window will be selected
8803 iff it is active. */
8804 if (WINDOWP(window)
8805 && !EQ (window, last_window)
8806 && !EQ (window, selected_window)
8807 && numchars > 0)
8808 {
8809 bufp->kind = SELECT_WINDOW_EVENT;
8810 bufp->frame_or_window = window;
8811 bufp->arg = Qnil;
8812 ++bufp, ++count, --numchars;
8813 }
8814
8815 last_window=window;
8816 }
8817 note_mouse_movement (f, &msg.msg);
8818 }
8809 else 8819 else
8810 { 8820 {
8811 /* If we move outside the frame, then we're 8821 /* If we move outside the frame, then we're
@@ -9165,6 +9175,14 @@ w32_read_socket (sd, bufp, numchars, expected)
9165 break; 9175 break;
9166 9176
9167 case WM_SETFOCUS: 9177 case WM_SETFOCUS:
9178 /* TODO: Port this change:
9179 2002-06-28 Jan D. <jan.h.d@swipnet.se>
9180 * xterm.h (struct x_output): Add focus_state.
9181 * xterm.c (x_focus_changed): New function.
9182 (x_detect_focus_change): New function.
9183 (XTread_socket): Call x_detect_focus_change for FocusIn/FocusOut
9184 EnterNotify and LeaveNotify to track X focus changes.
9185 */
9168 f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd); 9186 f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd);
9169 9187
9170 dpyinfo->w32_focus_event_frame = f; 9188 dpyinfo->w32_focus_event_frame = f;
@@ -9398,11 +9416,12 @@ w32_read_socket (sd, bufp, numchars, expected)
9398 Text Cursor 9416 Text Cursor
9399 ***********************************************************************/ 9417 ***********************************************************************/
9400 9418
9401/* Notice if the text cursor of window W has been overwritten by a 9419/* Notice when the text cursor of window W has been completely
9402 drawing operation that outputs glyphs starting at START_X and 9420 overwritten by a drawing operation that outputs glyphs in AREA
9403 ending at END_X in the line given by output_cursor.vpos. 9421 starting at X0 and ending at X1 in the line starting at Y0 and
9404 Coordinates are area-relative. END_X < 0 means all the rest 9422 ending at Y1. X coordinates are area-relative. X1 < 0 means all
9405 of the line after START_X has been written. */ 9423 the rest of the line after X0 has been written. Y coordinates
9424 are window-relative. */
9406 9425
9407static void 9426static void
9408notice_overwritten_cursor (w, area, x0, x1, y0, y1) 9427notice_overwritten_cursor (w, area, x0, x1, y0, y1)
@@ -9410,13 +9429,36 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1)
9410 enum glyph_row_area area; 9429 enum glyph_row_area area;
9411 int x0, x1, y0, y1; 9430 int x0, x1, y0, y1;
9412{ 9431{
9413 if (area == TEXT_AREA 9432 if (area == TEXT_AREA && w->phys_cursor_on_p)
9414 && w->phys_cursor_on_p 9433 {
9415 && y0 <= w->phys_cursor.y 9434 int cx0 = w->phys_cursor.x;
9416 && y1 >= w->phys_cursor.y + w->phys_cursor_height 9435 int cx1 = cx0 + w->phys_cursor_width;
9417 && x0 <= w->phys_cursor.x 9436 int cy0 = w->phys_cursor.y;
9418 && (x1 < 0 || x1 > w->phys_cursor.x)) 9437 int cy1 = cy0 + w->phys_cursor_height;
9419 w->phys_cursor_on_p = 0; 9438
9439 if (x0 <= cx0 && (x1 < 0 || x1 >= cx1))
9440 {
9441 /* The cursor image will be completely removed from the
9442 screen if the output area intersects the cursor area in
9443 y-direction. When we draw in [y0 y1[, and some part of
9444 the cursor is at y < y0, that part must have been drawn
9445 before. When scrolling, the cursor is erased before
9446 actually scrolling, so we don't come here. When not
9447 scrolling, the rows above the old cursor row must have
9448 changed, and in this case these rows must have written
9449 over the cursor image.
9450
9451 Likewise if part of the cursor is below y1, with the
9452 exception of the cursor being in the first blank row at
9453 the buffer and window end because update_text_area
9454 doesn't draw that row. (Except when it does, but
9455 that's handled in update_text_area.) */
9456
9457 if (((y0 >= cy0 && y0 < cy1) || (y1 > cy0 && y1 < cy1))
9458 && w->current_matrix->rows[w->phys_cursor.vpos].displays_text_p)
9459 w->phys_cursor_on_p = 0;
9460 }
9461 }
9420} 9462}
9421 9463
9422 9464
@@ -9495,12 +9537,15 @@ x_draw_hollow_cursor (w, row)
9495 if (cursor_glyph->type == STRETCH_GLYPH 9537 if (cursor_glyph->type == STRETCH_GLYPH
9496 && !x_stretch_cursor_p) 9538 && !x_stretch_cursor_p)
9497 wd = min (CANON_X_UNIT (f), wd); 9539 wd = min (CANON_X_UNIT (f), wd);
9540 w->phys_cursor_width = wd;
9498 9541
9499 rect.right = rect.left + wd; 9542 rect.right = rect.left + wd;
9500 hdc = get_frame_dc (f); 9543 hdc = get_frame_dc (f);
9544 /* Set clipping, draw the rectangle, and reset clipping again. */
9545 w32_clip_to_row (w, row, hdc, 0);
9501 FrameRect (hdc, &rect, hb); 9546 FrameRect (hdc, &rect, hb);
9502 DeleteObject (hb); 9547 DeleteObject (hb);
9503 9548 w32_set_clip_rectangle (hdc, NULL);
9504 release_frame_dc (f, hdc); 9549 release_frame_dc (f, hdc);
9505} 9550}
9506 9551
@@ -9545,10 +9590,6 @@ x_draw_bar_cursor (w, row, width, kind)
9545 COLORREF cursor_color = f->output_data.w32->cursor_pixel; 9590 COLORREF cursor_color = f->output_data.w32->cursor_pixel;
9546 struct face *face = FACE_FROM_ID (f, cursor_glyph->face_id); 9591 struct face *face = FACE_FROM_ID (f, cursor_glyph->face_id);
9547 9592
9548 if (width < 0)
9549 width = FRAME_CURSOR_WIDTH (f);
9550 width = min (cursor_glyph->pixel_width, width);
9551
9552 /* If the glyph's background equals the color we normally draw 9593 /* If the glyph's background equals the color we normally draw
9553 the bar cursor in, the bar cursor in its normal color is 9594 the bar cursor in, the bar cursor in its normal color is
9554 invisible. Use the glyph's foreground color instead in this 9595 invisible. Use the glyph's foreground color instead in this
@@ -9558,6 +9599,14 @@ x_draw_bar_cursor (w, row, width, kind)
9558 cursor_color = face->foreground; 9599 cursor_color = face->foreground;
9559 9600
9560 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 9601 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
9602
9603 if (width < 0)
9604 width = FRAME_CURSOR_WIDTH (f);
9605 width = min (cursor_glyph->pixel_width, width);
9606
9607 w->phys_cursor_width = width;
9608
9609
9561 hdc = get_frame_dc (f); 9610 hdc = get_frame_dc (f);
9562 w32_clip_to_row (w, row, hdc, 0); 9611 w32_clip_to_row (w, row, hdc, 0);
9563 9612
@@ -9574,6 +9623,8 @@ x_draw_bar_cursor (w, row, width, kind)
9574 row->height - width), 9623 row->height - width),
9575 cursor_glyph->pixel_width, width); 9624 cursor_glyph->pixel_width, width);
9576 } 9625 }
9626
9627 w32_set_clip_rectangle (hdc, NULL);
9577 release_frame_dc (f, hdc); 9628 release_frame_dc (f, hdc);
9578 } 9629 }
9579} 9630}
@@ -9607,11 +9658,15 @@ x_draw_phys_cursor_glyph (w, row, hl)
9607 if (w->phys_cursor.hpos < row->used[TEXT_AREA]) 9658 if (w->phys_cursor.hpos < row->used[TEXT_AREA])
9608 { 9659 {
9609 int on_p = w->phys_cursor_on_p; 9660 int on_p = w->phys_cursor_on_p;
9610 x_draw_glyphs (w, w->phys_cursor.x, row, TEXT_AREA, 9661 int x1;
9611 w->phys_cursor.hpos, w->phys_cursor.hpos + 1, 9662 x1 = x_draw_glyphs (w, w->phys_cursor.x, row, TEXT_AREA,
9612 hl, 0); 9663 w->phys_cursor.hpos, w->phys_cursor.hpos + 1,
9664 hl, 0);
9613 w->phys_cursor_on_p = on_p; 9665 w->phys_cursor_on_p = on_p;
9614 9666
9667 if (hl == DRAW_CURSOR)
9668 w->phys_cursor_width = x1 - w->phys_cursor.x;
9669
9615 /* When we erase the cursor, and ROW is overlapped by other 9670 /* When we erase the cursor, and ROW is overlapped by other
9616 rows, make sure that these overlapping parts of other rows 9671 rows, make sure that these overlapping parts of other rows
9617 are redrawn. */ 9672 are redrawn. */
@@ -9846,7 +9901,6 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
9846 else 9901 else
9847 { 9902 {
9848 w->phys_cursor_type = new_cursor_type; 9903 w->phys_cursor_type = new_cursor_type;
9849 w->phys_cursor_width = new_cursor_width;
9850 } 9904 }
9851 9905
9852 w->phys_cursor_on_p = 1; 9906 w->phys_cursor_on_p = 1;
@@ -9895,6 +9949,7 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
9895 break; 9949 break;
9896 9950
9897 case NO_CURSOR: 9951 case NO_CURSOR:
9952 w->phys_cursor_width = 0;
9898 break; 9953 break;
9899 9954
9900 default: 9955 default: