diff options
| author | Dmitry Antipov | 2013-08-28 09:45:38 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-08-28 09:45:38 +0400 |
| commit | f60e429a1a1a0d6a51761ef12e54dde52967f085 (patch) | |
| tree | 83be6ff103b71cb7b59fa171b631437f0c6720c7 /src | |
| parent | 0acfedd3496a4a375c27215d13bf63466fdb1071 (diff) | |
| download | emacs-f60e429a1a1a0d6a51761ef12e54dde52967f085.tar.gz emacs-f60e429a1a1a0d6a51761ef12e54dde52967f085.zip | |
Redesign redisplay interface to drop global output_cursor.
* dispextern.h (struct redisplay_interface): Remove cursor_to member.
(toplevel): Remove declaration of output_cursor.
(set_output_cursor, x_cursor_to): Remove prototype.
* window.h (struct window): New member output_cursor.
(output_cursor_to): New function to replace RIF member.
* dispnew.c (redraw_overlapped_rows, update_marginal_area)
(update_text_area, set_window_cursor_after_update): Use it.
* xdisp.c (output_cursor, set_output_cursor, x_cursor_to): Remove.
(x_write_glyphs, x_insert_glyphs, x_clear_end_of_line):
* nsterm.m (ns_update_window_begin, ns_update_window_end):
* w32term.c (x_update_window_begin, x_update_window_end):
* xterm.c (x_update_window_begin, x_update_window_end):
Adjust to use per-window output cursor.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 17 | ||||
| -rw-r--r-- | src/dispextern.h | 12 | ||||
| -rw-r--r-- | src/dispnew.c | 25 | ||||
| -rw-r--r-- | src/nsterm.m | 10 | ||||
| -rw-r--r-- | src/w32term.c | 16 | ||||
| -rw-r--r-- | src/window.h | 19 | ||||
| -rw-r--r-- | src/xdisp.c | 84 | ||||
| -rw-r--r-- | src/xterm.c | 16 |
8 files changed, 75 insertions, 124 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 185619f1890..dfcad3bf120 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,20 @@ | |||
| 1 | 2013-08-28 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Redesign redisplay interface to drop global output_cursor. | ||
| 4 | * dispextern.h (struct redisplay_interface): Remove cursor_to member. | ||
| 5 | (toplevel): Remove declaration of output_cursor. | ||
| 6 | (set_output_cursor, x_cursor_to): Remove prototype. | ||
| 7 | * window.h (struct window): New member output_cursor. | ||
| 8 | (output_cursor_to): New function to replace RIF member. | ||
| 9 | * dispnew.c (redraw_overlapped_rows, update_marginal_area) | ||
| 10 | (update_text_area, set_window_cursor_after_update): Use it. | ||
| 11 | * xdisp.c (output_cursor, set_output_cursor, x_cursor_to): Remove. | ||
| 12 | (x_write_glyphs, x_insert_glyphs, x_clear_end_of_line): | ||
| 13 | * nsterm.m (ns_update_window_begin, ns_update_window_end): | ||
| 14 | * w32term.c (x_update_window_begin, x_update_window_end): | ||
| 15 | * xterm.c (x_update_window_begin, x_update_window_end): | ||
| 16 | Adjust to use per-window output cursor. | ||
| 17 | |||
| 1 | 2013-08-27 Paul Eggert <eggert@cs.ucla.edu> | 18 | 2013-08-27 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 19 | ||
| 3 | Simplify SELECT_TYPE-related code. | 20 | Simplify SELECT_TYPE-related code. |
diff --git a/src/dispextern.h b/src/dispextern.h index a5cb66f7d5e..2d44dca3861 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2790,11 +2790,6 @@ struct redisplay_interface | |||
| 2790 | void (*update_window_end_hook) (struct window *w, bool cursor_on_p, | 2790 | void (*update_window_end_hook) (struct window *w, bool cursor_on_p, |
| 2791 | bool mouse_face_overwritten_p); | 2791 | bool mouse_face_overwritten_p); |
| 2792 | 2792 | ||
| 2793 | /* Move cursor to row/column position VPOS/HPOS, pixel coordinates | ||
| 2794 | Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y | ||
| 2795 | are window-relative pixel positions. */ | ||
| 2796 | void (*cursor_to) (struct window *w, int vpos, int hpos, int y, int x); | ||
| 2797 | |||
| 2798 | /* Flush the display of frame F. For X, this is XFlush. */ | 2793 | /* Flush the display of frame F. For X, this is XFlush. */ |
| 2799 | void (*flush_display) (struct frame *f); | 2794 | void (*flush_display) (struct frame *f); |
| 2800 | 2795 | ||
| @@ -3232,9 +3227,6 @@ extern void x_insert_glyphs (struct window *, struct glyph_row *, | |||
| 3232 | struct glyph *, enum glyph_row_area, int); | 3227 | struct glyph *, enum glyph_row_area, int); |
| 3233 | extern void x_clear_end_of_line (struct window *, struct glyph_row *, | 3228 | extern void x_clear_end_of_line (struct window *, struct glyph_row *, |
| 3234 | enum glyph_row_area, int); | 3229 | enum glyph_row_area, int); |
| 3235 | |||
| 3236 | extern struct cursor_pos output_cursor; | ||
| 3237 | |||
| 3238 | extern void x_fix_overlapping_area (struct window *, struct glyph_row *, | 3230 | extern void x_fix_overlapping_area (struct window *, struct glyph_row *, |
| 3239 | enum glyph_row_area, int); | 3231 | enum glyph_row_area, int); |
| 3240 | extern void draw_phys_cursor_glyph (struct window *, | 3232 | extern void draw_phys_cursor_glyph (struct window *, |
| @@ -3244,10 +3236,6 @@ extern void get_phys_cursor_geometry (struct window *, struct glyph_row *, | |||
| 3244 | struct glyph *, int *, int *, int *); | 3236 | struct glyph *, int *, int *, int *); |
| 3245 | extern void erase_phys_cursor (struct window *); | 3237 | extern void erase_phys_cursor (struct window *); |
| 3246 | extern void display_and_set_cursor (struct window *, bool, int, int, int, int); | 3238 | extern void display_and_set_cursor (struct window *, bool, int, int, int, int); |
| 3247 | |||
| 3248 | extern void set_output_cursor (struct cursor_pos *); | ||
| 3249 | extern void x_cursor_to (struct window *, int, int, int, int); | ||
| 3250 | |||
| 3251 | extern void x_update_cursor (struct frame *, bool); | 3239 | extern void x_update_cursor (struct frame *, bool); |
| 3252 | extern void x_clear_cursor (struct window *); | 3240 | extern void x_clear_cursor (struct window *); |
| 3253 | extern void x_draw_vertical_border (struct window *w); | 3241 | extern void x_draw_vertical_border (struct window *w); |
diff --git a/src/dispnew.c b/src/dispnew.c index 1c80facd422..349689e57f5 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -3223,8 +3223,8 @@ redraw_overlapped_rows (struct window *w, int yb) | |||
| 3223 | 3223 | ||
| 3224 | for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area) | 3224 | for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area) |
| 3225 | { | 3225 | { |
| 3226 | FRAME_RIF (f)->cursor_to (w, i, 0, row->y, | 3226 | output_cursor_to (w, i, 0, row->y, |
| 3227 | area == TEXT_AREA ? row->x : 0); | 3227 | area == TEXT_AREA ? row->x : 0); |
| 3228 | if (row->used[area]) | 3228 | if (row->used[area]) |
| 3229 | FRAME_RIF (f)->write_glyphs (w, row, row->glyphs[area], | 3229 | FRAME_RIF (f)->write_glyphs (w, row, row->glyphs[area], |
| 3230 | area, row->used[area]); | 3230 | area, row->used[area]); |
| @@ -3481,7 +3481,7 @@ update_window (struct window *w, bool force_p) | |||
| 3481 | /* End the update of window W. Don't set the cursor if we | 3481 | /* End the update of window W. Don't set the cursor if we |
| 3482 | paused updating the display because in this case, | 3482 | paused updating the display because in this case, |
| 3483 | set_window_cursor_after_update hasn't been called, and | 3483 | set_window_cursor_after_update hasn't been called, and |
| 3484 | output_cursor doesn't contain the cursor location. */ | 3484 | W->output_cursor doesn't contain the cursor location. */ |
| 3485 | rif->update_window_end_hook (w, !paused_p, mouse_face_overwritten_p); | 3485 | rif->update_window_end_hook (w, !paused_p, mouse_face_overwritten_p); |
| 3486 | } | 3486 | } |
| 3487 | else | 3487 | else |
| @@ -3511,7 +3511,7 @@ update_marginal_area (struct window *w, struct glyph_row *updated_row, | |||
| 3511 | /* Set cursor to start of glyphs, write them, and clear to the end | 3511 | /* Set cursor to start of glyphs, write them, and clear to the end |
| 3512 | of the area. I don't think that something more sophisticated is | 3512 | of the area. I don't think that something more sophisticated is |
| 3513 | necessary here, since marginal areas will not be the default. */ | 3513 | necessary here, since marginal areas will not be the default. */ |
| 3514 | rif->cursor_to (w, vpos, 0, desired_row->y, 0); | 3514 | output_cursor_to (w, vpos, 0, desired_row->y, 0); |
| 3515 | if (desired_row->used[area]) | 3515 | if (desired_row->used[area]) |
| 3516 | rif->write_glyphs (w, updated_row, desired_row->glyphs[area], | 3516 | rif->write_glyphs (w, updated_row, desired_row->glyphs[area], |
| 3517 | area, desired_row->used[area]); | 3517 | area, desired_row->used[area]); |
| @@ -3549,7 +3549,7 @@ update_text_area (struct window *w, struct glyph_row *updated_row, int vpos) | |||
| 3549 | && !(current_row->mode_line_p && vpos > 0)) | 3549 | && !(current_row->mode_line_p && vpos > 0)) |
| 3550 | || current_row->x != desired_row->x) | 3550 | || current_row->x != desired_row->x) |
| 3551 | { | 3551 | { |
| 3552 | rif->cursor_to (w, vpos, 0, desired_row->y, desired_row->x); | 3552 | output_cursor_to (w, vpos, 0, desired_row->y, desired_row->x); |
| 3553 | 3553 | ||
| 3554 | if (desired_row->used[TEXT_AREA]) | 3554 | if (desired_row->used[TEXT_AREA]) |
| 3555 | rif->write_glyphs (w, updated_row, desired_row->glyphs[TEXT_AREA], | 3555 | rif->write_glyphs (w, updated_row, desired_row->glyphs[TEXT_AREA], |
| @@ -3692,7 +3692,7 @@ update_text_area (struct window *w, struct glyph_row *updated_row, int vpos) | |||
| 3692 | break; | 3692 | break; |
| 3693 | } | 3693 | } |
| 3694 | 3694 | ||
| 3695 | rif->cursor_to (w, vpos, start_hpos, desired_row->y, start_x); | 3695 | output_cursor_to (w, vpos, start_hpos, desired_row->y, start_x); |
| 3696 | rif->write_glyphs (w, updated_row, start, | 3696 | rif->write_glyphs (w, updated_row, start, |
| 3697 | TEXT_AREA, i - start_hpos); | 3697 | TEXT_AREA, i - start_hpos); |
| 3698 | changed_p = 1; | 3698 | changed_p = 1; |
| @@ -3702,7 +3702,7 @@ update_text_area (struct window *w, struct glyph_row *updated_row, int vpos) | |||
| 3702 | /* Write the rest. */ | 3702 | /* Write the rest. */ |
| 3703 | if (i < desired_row->used[TEXT_AREA]) | 3703 | if (i < desired_row->used[TEXT_AREA]) |
| 3704 | { | 3704 | { |
| 3705 | rif->cursor_to (w, vpos, i, desired_row->y, x); | 3705 | output_cursor_to (w, vpos, i, desired_row->y, x); |
| 3706 | rif->write_glyphs (w, updated_row, desired_glyph, | 3706 | rif->write_glyphs (w, updated_row, desired_glyph, |
| 3707 | TEXT_AREA, desired_row->used[TEXT_AREA] - i); | 3707 | TEXT_AREA, desired_row->used[TEXT_AREA] - i); |
| 3708 | changed_p = 1; | 3708 | changed_p = 1; |
| @@ -3724,8 +3724,8 @@ update_text_area (struct window *w, struct glyph_row *updated_row, int vpos) | |||
| 3724 | { | 3724 | { |
| 3725 | /* If old row extends to the end of the text area, clear. */ | 3725 | /* If old row extends to the end of the text area, clear. */ |
| 3726 | if (i >= desired_row->used[TEXT_AREA]) | 3726 | if (i >= desired_row->used[TEXT_AREA]) |
| 3727 | rif->cursor_to (w, vpos, i, desired_row->y, | 3727 | output_cursor_to (w, vpos, i, desired_row->y, |
| 3728 | desired_row->pixel_width); | 3728 | desired_row->pixel_width); |
| 3729 | rif->clear_end_of_line (w, updated_row, TEXT_AREA, -1); | 3729 | rif->clear_end_of_line (w, updated_row, TEXT_AREA, -1); |
| 3730 | changed_p = 1; | 3730 | changed_p = 1; |
| 3731 | } | 3731 | } |
| @@ -3736,8 +3736,8 @@ update_text_area (struct window *w, struct glyph_row *updated_row, int vpos) | |||
| 3736 | int xlim; | 3736 | int xlim; |
| 3737 | 3737 | ||
| 3738 | if (i >= desired_row->used[TEXT_AREA]) | 3738 | if (i >= desired_row->used[TEXT_AREA]) |
| 3739 | rif->cursor_to (w, vpos, i, desired_row->y, | 3739 | output_cursor_to (w, vpos, i, desired_row->y, |
| 3740 | desired_row->pixel_width); | 3740 | desired_row->pixel_width); |
| 3741 | 3741 | ||
| 3742 | /* If cursor is displayed at the end of the line, make sure | 3742 | /* If cursor is displayed at the end of the line, make sure |
| 3743 | it's cleared. Nowadays we don't have a phys_cursor_glyph | 3743 | it's cleared. Nowadays we don't have a phys_cursor_glyph |
| @@ -3836,7 +3836,6 @@ static void | |||
| 3836 | set_window_cursor_after_update (struct window *w) | 3836 | set_window_cursor_after_update (struct window *w) |
| 3837 | { | 3837 | { |
| 3838 | struct frame *f = XFRAME (w->frame); | 3838 | struct frame *f = XFRAME (w->frame); |
| 3839 | struct redisplay_interface *rif = FRAME_RIF (f); | ||
| 3840 | int cx, cy, vpos, hpos; | 3839 | int cx, cy, vpos, hpos; |
| 3841 | 3840 | ||
| 3842 | /* Not intended for frame matrix updates. */ | 3841 | /* Not intended for frame matrix updates. */ |
| @@ -3908,7 +3907,7 @@ set_window_cursor_after_update (struct window *w) | |||
| 3908 | Horizontal position is -1 when cursor is on the left fringe. */ | 3907 | Horizontal position is -1 when cursor is on the left fringe. */ |
| 3909 | hpos = clip_to_bounds (-1, hpos, w->current_matrix->matrix_w - 1); | 3908 | hpos = clip_to_bounds (-1, hpos, w->current_matrix->matrix_w - 1); |
| 3910 | vpos = clip_to_bounds (0, vpos, w->current_matrix->nrows - 1); | 3909 | vpos = clip_to_bounds (0, vpos, w->current_matrix->nrows - 1); |
| 3911 | rif->cursor_to (w, vpos, hpos, cy, cx); | 3910 | output_cursor_to (w, vpos, hpos, cy, cx); |
| 3912 | } | 3911 | } |
| 3913 | 3912 | ||
| 3914 | 3913 | ||
diff --git a/src/nsterm.m b/src/nsterm.m index 01ee2319ddf..921c3a5ce05 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -720,7 +720,7 @@ ns_update_window_begin (struct window *w) | |||
| 720 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | 720 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 721 | 721 | ||
| 722 | NSTRACE (ns_update_window_begin); | 722 | NSTRACE (ns_update_window_begin); |
| 723 | set_output_cursor (&w->cursor); | 723 | w->output_cursor = w->cursor; |
| 724 | 724 | ||
| 725 | block_input (); | 725 | block_input (); |
| 726 | 726 | ||
| @@ -756,8 +756,8 @@ ns_update_window_end (struct window *w, bool cursor_on_p, | |||
| 756 | 756 | ||
| 757 | if (cursor_on_p) | 757 | if (cursor_on_p) |
| 758 | display_and_set_cursor (w, 1, | 758 | display_and_set_cursor (w, 1, |
| 759 | output_cursor.hpos, output_cursor.vpos, | 759 | w->output_cursor.hpos, w->output_cursor.vpos, |
| 760 | output_cursor.x, output_cursor.y); | 760 | w->output_cursor.x, w->output_cursor.y); |
| 761 | 761 | ||
| 762 | if (draw_window_fringes (w, 1)) | 762 | if (draw_window_fringes (w, 1)) |
| 763 | x_draw_vertical_border (w); | 763 | x_draw_vertical_border (w); |
| @@ -1989,9 +1989,6 @@ ns_clear_frame (struct frame *f) | |||
| 1989 | 1989 | ||
| 1990 | mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); | 1990 | mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); |
| 1991 | 1991 | ||
| 1992 | output_cursor.hpos = output_cursor.vpos = 0; | ||
| 1993 | output_cursor.x = -1; | ||
| 1994 | |||
| 1995 | r = [view bounds]; | 1992 | r = [view bounds]; |
| 1996 | 1993 | ||
| 1997 | block_input (); | 1994 | block_input (); |
| @@ -3978,7 +3975,6 @@ static struct redisplay_interface ns_redisplay_interface = | |||
| 3978 | ns_after_update_window_line, | 3975 | ns_after_update_window_line, |
| 3979 | ns_update_window_begin, | 3976 | ns_update_window_begin, |
| 3980 | ns_update_window_end, | 3977 | ns_update_window_end, |
| 3981 | x_cursor_to, | ||
| 3982 | ns_flush, | 3978 | ns_flush, |
| 3983 | 0, /* flush_display_optional */ | 3979 | 0, /* flush_display_optional */ |
| 3984 | x_clear_window_mouse_face, | 3980 | x_clear_window_mouse_face, |
diff --git a/src/w32term.c b/src/w32term.c index ba3aadd0b49..394d348c97f 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -576,8 +576,7 @@ x_update_begin (struct frame *f) | |||
| 576 | } | 576 | } |
| 577 | 577 | ||
| 578 | 578 | ||
| 579 | /* Start update of window W. Set output_cursor to the cursor | 579 | /* Start update of window W. */ |
| 580 | position of W. */ | ||
| 581 | 580 | ||
| 582 | static void | 581 | static void |
| 583 | x_update_window_begin (struct window *w) | 582 | x_update_window_begin (struct window *w) |
| @@ -591,7 +590,7 @@ x_update_window_begin (struct window *w) | |||
| 591 | SendMessage (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0); | 590 | SendMessage (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0); |
| 592 | } | 591 | } |
| 593 | 592 | ||
| 594 | set_output_cursor (&w->cursor); | 593 | w->output_cursor = w->cursor; |
| 595 | 594 | ||
| 596 | block_input (); | 595 | block_input (); |
| 597 | 596 | ||
| @@ -683,9 +682,9 @@ x_update_window_end (struct window *w, bool cursor_on_p, | |||
| 683 | block_input (); | 682 | block_input (); |
| 684 | 683 | ||
| 685 | if (cursor_on_p) | 684 | if (cursor_on_p) |
| 686 | display_and_set_cursor (w, 1, output_cursor.hpos, | 685 | display_and_set_cursor (w, 1, |
| 687 | output_cursor.vpos, | 686 | w->output_cursor.hpos, w->output_cursor.vpos, |
| 688 | output_cursor.x, output_cursor.y); | 687 | w->output_cursor.x, w->output_cursor.y); |
| 689 | 688 | ||
| 690 | if (draw_window_fringes (w, 1)) | 689 | if (draw_window_fringes (w, 1)) |
| 691 | x_draw_vertical_border (w); | 690 | x_draw_vertical_border (w); |
| @@ -2651,11 +2650,7 @@ x_clear_frame (struct frame *f) | |||
| 2651 | /* Clearing the frame will erase any cursor, so mark them all as no | 2650 | /* Clearing the frame will erase any cursor, so mark them all as no |
| 2652 | longer visible. */ | 2651 | longer visible. */ |
| 2653 | mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); | 2652 | mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); |
| 2654 | output_cursor.hpos = output_cursor.vpos = 0; | ||
| 2655 | output_cursor.x = -1; | ||
| 2656 | 2653 | ||
| 2657 | /* We don't set the output cursor here because there will always | ||
| 2658 | follow an explicit cursor_to. */ | ||
| 2659 | block_input (); | 2654 | block_input (); |
| 2660 | 2655 | ||
| 2661 | w32_clear_window (f); | 2656 | w32_clear_window (f); |
| @@ -6321,7 +6316,6 @@ static struct redisplay_interface w32_redisplay_interface = | |||
| 6321 | x_after_update_window_line, | 6316 | x_after_update_window_line, |
| 6322 | x_update_window_begin, | 6317 | x_update_window_begin, |
| 6323 | x_update_window_end, | 6318 | x_update_window_end, |
| 6324 | x_cursor_to, | ||
| 6325 | x_flush, | 6319 | x_flush, |
| 6326 | 0, /* flush_display_optional */ | 6320 | 0, /* flush_display_optional */ |
| 6327 | x_clear_window_mouse_face, | 6321 | x_clear_window_mouse_face, |
diff --git a/src/window.h b/src/window.h index de77dcabc85..3e37fa9d983 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -236,6 +236,9 @@ struct window | |||
| 236 | /* Where the cursor actually is. */ | 236 | /* Where the cursor actually is. */ |
| 237 | struct cursor_pos phys_cursor; | 237 | struct cursor_pos phys_cursor; |
| 238 | 238 | ||
| 239 | /* Internally used for redisplay purposes. */ | ||
| 240 | struct cursor_pos output_cursor; | ||
| 241 | |||
| 239 | /* Vertical cursor position as of last update that completed | 242 | /* Vertical cursor position as of last update that completed |
| 240 | without pause. This is the position of last_point. */ | 243 | without pause. This is the position of last_point. */ |
| 241 | int last_cursor_vpos; | 244 | int last_cursor_vpos; |
| @@ -956,6 +959,22 @@ extern void init_window (void); | |||
| 956 | extern void syms_of_window (void); | 959 | extern void syms_of_window (void); |
| 957 | extern void keys_of_window (void); | 960 | extern void keys_of_window (void); |
| 958 | 961 | ||
| 962 | /* Move cursor to row/column position VPOS/HPOS, pixel coordinates | ||
| 963 | Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y | ||
| 964 | are window-relative pixel positions. This is always done during | ||
| 965 | window update, so the position is the future output cursor position | ||
| 966 | for currently updated window W. */ | ||
| 967 | |||
| 968 | WINDOW_INLINE void | ||
| 969 | output_cursor_to (struct window *w, int vpos, int hpos, int y, int x) | ||
| 970 | { | ||
| 971 | eassert (w); | ||
| 972 | w->output_cursor.hpos = hpos; | ||
| 973 | w->output_cursor.vpos = vpos; | ||
| 974 | w->output_cursor.x = x; | ||
| 975 | w->output_cursor.y = y; | ||
| 976 | } | ||
| 977 | |||
| 959 | INLINE_HEADER_END | 978 | INLINE_HEADER_END |
| 960 | 979 | ||
| 961 | #endif /* not WINDOW_H_INCLUDED */ | 980 | #endif /* not WINDOW_H_INCLUDED */ |
diff --git a/src/xdisp.c b/src/xdisp.c index 46992d2f396..44a8630bab4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -11445,62 +11445,6 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run) | |||
| 11445 | return hooks_run; | 11445 | return hooks_run; |
| 11446 | } | 11446 | } |
| 11447 | 11447 | ||
| 11448 | |||
| 11449 | |||
| 11450 | /*********************************************************************** | ||
| 11451 | Output Cursor | ||
| 11452 | ***********************************************************************/ | ||
| 11453 | |||
| 11454 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 11455 | |||
| 11456 | /* EXPORT: | ||
| 11457 | Nominal cursor position -- where to draw output. | ||
| 11458 | HPOS and VPOS are window relative glyph matrix coordinates. | ||
| 11459 | X and Y are window relative pixel coordinates. */ | ||
| 11460 | |||
| 11461 | struct cursor_pos output_cursor; | ||
| 11462 | |||
| 11463 | |||
| 11464 | /* EXPORT: | ||
| 11465 | Set the global variable output_cursor to CURSOR. All cursor | ||
| 11466 | positions are relative to currently updated window. */ | ||
| 11467 | |||
| 11468 | void | ||
| 11469 | set_output_cursor (struct cursor_pos *cursor) | ||
| 11470 | { | ||
| 11471 | output_cursor.hpos = cursor->hpos; | ||
| 11472 | output_cursor.vpos = cursor->vpos; | ||
| 11473 | output_cursor.x = cursor->x; | ||
| 11474 | output_cursor.y = cursor->y; | ||
| 11475 | } | ||
| 11476 | |||
| 11477 | |||
| 11478 | /* EXPORT for RIF: | ||
| 11479 | Set a nominal cursor position. | ||
| 11480 | |||
| 11481 | HPOS and VPOS are column/row positions in a window glyph matrix. | ||
| 11482 | X and Y are window text area relative pixel positions. | ||
| 11483 | |||
| 11484 | This is always done during window update, so the position is the | ||
| 11485 | future output cursor position for currently updated window W. | ||
| 11486 | NOTE: W is used only to check whether this function is called | ||
| 11487 | in a consistent manner via the redisplay interface. */ | ||
| 11488 | |||
| 11489 | void | ||
| 11490 | x_cursor_to (struct window *w, int vpos, int hpos, int y, int x) | ||
| 11491 | { | ||
| 11492 | eassert (w); | ||
| 11493 | |||
| 11494 | /* Set the output cursor. */ | ||
| 11495 | output_cursor.hpos = hpos; | ||
| 11496 | output_cursor.vpos = vpos; | ||
| 11497 | output_cursor.x = x; | ||
| 11498 | output_cursor.y = y; | ||
| 11499 | } | ||
| 11500 | |||
| 11501 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 11502 | |||
| 11503 | |||
| 11504 | /*********************************************************************** | 11448 | /*********************************************************************** |
| 11505 | Tool-bars | 11449 | Tool-bars |
| 11506 | ***********************************************************************/ | 11450 | ***********************************************************************/ |
| @@ -25790,7 +25734,7 @@ x_write_glyphs (struct window *w, struct glyph_row *updated_row, | |||
| 25790 | /* Write glyphs. */ | 25734 | /* Write glyphs. */ |
| 25791 | 25735 | ||
| 25792 | hpos = start - updated_row->glyphs[updated_area]; | 25736 | hpos = start - updated_row->glyphs[updated_area]; |
| 25793 | x = draw_glyphs (w, output_cursor.x, | 25737 | x = draw_glyphs (w, w->output_cursor.x, |
| 25794 | updated_row, updated_area, | 25738 | updated_row, updated_area, |
| 25795 | hpos, hpos + len, | 25739 | hpos, hpos + len, |
| 25796 | DRAW_NORMAL_TEXT, 0); | 25740 | DRAW_NORMAL_TEXT, 0); |
| @@ -25798,7 +25742,7 @@ x_write_glyphs (struct window *w, struct glyph_row *updated_row, | |||
| 25798 | /* Invalidate old phys cursor if the glyph at its hpos is redrawn. */ | 25742 | /* Invalidate old phys cursor if the glyph at its hpos is redrawn. */ |
| 25799 | if (updated_area == TEXT_AREA | 25743 | if (updated_area == TEXT_AREA |
| 25800 | && w->phys_cursor_on_p | 25744 | && w->phys_cursor_on_p |
| 25801 | && w->phys_cursor.vpos == output_cursor.vpos | 25745 | && w->phys_cursor.vpos == w->output_cursor.vpos |
| 25802 | && chpos >= hpos | 25746 | && chpos >= hpos |
| 25803 | && chpos < hpos + len) | 25747 | && chpos < hpos + len) |
| 25804 | w->phys_cursor_on_p = 0; | 25748 | w->phys_cursor_on_p = 0; |
| @@ -25806,8 +25750,8 @@ x_write_glyphs (struct window *w, struct glyph_row *updated_row, | |||
| 25806 | unblock_input (); | 25750 | unblock_input (); |
| 25807 | 25751 | ||
| 25808 | /* Advance the output cursor. */ | 25752 | /* Advance the output cursor. */ |
| 25809 | output_cursor.hpos += len; | 25753 | w->output_cursor.hpos += len; |
| 25810 | output_cursor.x = x; | 25754 | w->output_cursor.x = x; |
| 25811 | } | 25755 | } |
| 25812 | 25756 | ||
| 25813 | 25757 | ||
| @@ -25840,25 +25784,25 @@ x_insert_glyphs (struct window *w, struct glyph_row *updated_row, | |||
| 25840 | 25784 | ||
| 25841 | /* Get the width of the region to shift right. */ | 25785 | /* Get the width of the region to shift right. */ |
| 25842 | shifted_region_width = (window_box_width (w, updated_area) | 25786 | shifted_region_width = (window_box_width (w, updated_area) |
| 25843 | - output_cursor.x | 25787 | - w->output_cursor.x |
| 25844 | - shift_by_width); | 25788 | - shift_by_width); |
| 25845 | 25789 | ||
| 25846 | /* Shift right. */ | 25790 | /* Shift right. */ |
| 25847 | frame_x = window_box_left (w, updated_area) + output_cursor.x; | 25791 | frame_x = window_box_left (w, updated_area) + w->output_cursor.x; |
| 25848 | frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, output_cursor.y); | 25792 | frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, w->output_cursor.y); |
| 25849 | 25793 | ||
| 25850 | FRAME_RIF (f)->shift_glyphs_for_insert (f, frame_x, frame_y, shifted_region_width, | 25794 | FRAME_RIF (f)->shift_glyphs_for_insert (f, frame_x, frame_y, shifted_region_width, |
| 25851 | line_height, shift_by_width); | 25795 | line_height, shift_by_width); |
| 25852 | 25796 | ||
| 25853 | /* Write the glyphs. */ | 25797 | /* Write the glyphs. */ |
| 25854 | hpos = start - row->glyphs[updated_area]; | 25798 | hpos = start - row->glyphs[updated_area]; |
| 25855 | draw_glyphs (w, output_cursor.x, row, updated_area, | 25799 | draw_glyphs (w, w->output_cursor.x, row, updated_area, |
| 25856 | hpos, hpos + len, | 25800 | hpos, hpos + len, |
| 25857 | DRAW_NORMAL_TEXT, 0); | 25801 | DRAW_NORMAL_TEXT, 0); |
| 25858 | 25802 | ||
| 25859 | /* Advance the output cursor. */ | 25803 | /* Advance the output cursor. */ |
| 25860 | output_cursor.hpos += len; | 25804 | w->output_cursor.hpos += len; |
| 25861 | output_cursor.x += shift_by_width; | 25805 | w->output_cursor.x += shift_by_width; |
| 25862 | unblock_input (); | 25806 | unblock_input (); |
| 25863 | } | 25807 | } |
| 25864 | 25808 | ||
| @@ -25897,16 +25841,16 @@ x_clear_end_of_line (struct window *w, struct glyph_row *updated_row, | |||
| 25897 | else | 25841 | else |
| 25898 | to_x = min (to_x, max_x); | 25842 | to_x = min (to_x, max_x); |
| 25899 | 25843 | ||
| 25900 | to_y = min (max_y, output_cursor.y + updated_row->height); | 25844 | to_y = min (max_y, w->output_cursor.y + updated_row->height); |
| 25901 | 25845 | ||
| 25902 | /* Notice if the cursor will be cleared by this operation. */ | 25846 | /* Notice if the cursor will be cleared by this operation. */ |
| 25903 | if (!updated_row->full_width_p) | 25847 | if (!updated_row->full_width_p) |
| 25904 | notice_overwritten_cursor (w, updated_area, | 25848 | notice_overwritten_cursor (w, updated_area, |
| 25905 | output_cursor.x, -1, | 25849 | w->output_cursor.x, -1, |
| 25906 | updated_row->y, | 25850 | updated_row->y, |
| 25907 | MATRIX_ROW_BOTTOM_Y (updated_row)); | 25851 | MATRIX_ROW_BOTTOM_Y (updated_row)); |
| 25908 | 25852 | ||
| 25909 | from_x = output_cursor.x; | 25853 | from_x = w->output_cursor.x; |
| 25910 | 25854 | ||
| 25911 | /* Translate to frame coordinates. */ | 25855 | /* Translate to frame coordinates. */ |
| 25912 | if (updated_row->full_width_p) | 25856 | if (updated_row->full_width_p) |
| @@ -25922,7 +25866,7 @@ x_clear_end_of_line (struct window *w, struct glyph_row *updated_row, | |||
| 25922 | } | 25866 | } |
| 25923 | 25867 | ||
| 25924 | min_y = WINDOW_HEADER_LINE_HEIGHT (w); | 25868 | min_y = WINDOW_HEADER_LINE_HEIGHT (w); |
| 25925 | from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y)); | 25869 | from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, w->output_cursor.y)); |
| 25926 | to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y); | 25870 | to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y); |
| 25927 | 25871 | ||
| 25928 | /* Prevent inadvertently clearing to end of the X window. */ | 25872 | /* Prevent inadvertently clearing to end of the X window. */ |
diff --git a/src/xterm.c b/src/xterm.c index 777f13e431c..b7a98dbc5c1 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -551,8 +551,7 @@ x_update_begin (struct frame *f) | |||
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | 553 | ||
| 554 | /* Start update of window W. Set output_cursor to the cursor | 554 | /* Start update of window W. */ |
| 555 | position of W. */ | ||
| 556 | 555 | ||
| 557 | static void | 556 | static void |
| 558 | x_update_window_begin (struct window *w) | 557 | x_update_window_begin (struct window *w) |
| @@ -560,7 +559,7 @@ x_update_window_begin (struct window *w) | |||
| 560 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 559 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 561 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | 560 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 562 | 561 | ||
| 563 | set_output_cursor (&w->cursor); | 562 | w->output_cursor = w->cursor; |
| 564 | 563 | ||
| 565 | block_input (); | 564 | block_input (); |
| 566 | 565 | ||
| @@ -618,9 +617,9 @@ x_update_window_end (struct window *w, bool cursor_on_p, | |||
| 618 | block_input (); | 617 | block_input (); |
| 619 | 618 | ||
| 620 | if (cursor_on_p) | 619 | if (cursor_on_p) |
| 621 | display_and_set_cursor (w, 1, output_cursor.hpos, | 620 | display_and_set_cursor (w, 1, |
| 622 | output_cursor.vpos, | 621 | w->output_cursor.hpos, w->output_cursor.vpos, |
| 623 | output_cursor.x, output_cursor.y); | 622 | w->output_cursor.x, w->output_cursor.y); |
| 624 | 623 | ||
| 625 | if (draw_window_fringes (w, 1)) | 624 | if (draw_window_fringes (w, 1)) |
| 626 | x_draw_vertical_border (w); | 625 | x_draw_vertical_border (w); |
| @@ -2983,11 +2982,7 @@ x_clear_frame (struct frame *f) | |||
| 2983 | /* Clearing the frame will erase any cursor, so mark them all as no | 2982 | /* Clearing the frame will erase any cursor, so mark them all as no |
| 2984 | longer visible. */ | 2983 | longer visible. */ |
| 2985 | mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); | 2984 | mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); |
| 2986 | output_cursor.hpos = output_cursor.vpos = 0; | ||
| 2987 | output_cursor.x = -1; | ||
| 2988 | 2985 | ||
| 2989 | /* We don't set the output cursor here because there will always | ||
| 2990 | follow an explicit cursor_to. */ | ||
| 2991 | block_input (); | 2986 | block_input (); |
| 2992 | 2987 | ||
| 2993 | XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); | 2988 | XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); |
| @@ -10448,7 +10443,6 @@ static struct redisplay_interface x_redisplay_interface = | |||
| 10448 | x_after_update_window_line, | 10443 | x_after_update_window_line, |
| 10449 | x_update_window_begin, | 10444 | x_update_window_begin, |
| 10450 | x_update_window_end, | 10445 | x_update_window_end, |
| 10451 | x_cursor_to, | ||
| 10452 | x_flush, | 10446 | x_flush, |
| 10453 | #ifdef XFlush | 10447 | #ifdef XFlush |
| 10454 | x_flush, | 10448 | x_flush, |