diff options
| author | Dmitry Antipov | 2013-08-08 18:51:07 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-08-08 18:51:07 +0400 |
| commit | 656202640dc8857da0373ba690ea193394352ddb (patch) | |
| tree | 98e88c8e6142a2fc2b0e3fc21f7b31521f870a41 | |
| parent | 04263d23c5890d728cc62fd64873f687adff620c (diff) | |
| download | emacs-656202640dc8857da0373ba690ea193394352ddb.tar.gz emacs-656202640dc8857da0373ba690ea193394352ddb.zip | |
Redesign redisplay interface to drop global variable updated_window.
Always pass currently updated window as a parameter to update routines.
* dispextern.h (updated_window): Remove declaration.
(struct redisplay_interface): Pass window parameter to
write_glyphs, insert_glyphs, clear_end_of_line, cursor_to
and after_update_window_hook.
(x_write_glyphs, x_insert_glyphs, x_clear_end_of_line, x_cursor_to):
Adjust prototypes.
* dispnew.c (updated_window): Remove.
(redraw_overlapped_rows, update_marginal_area, update_text_area)
(update_window_line): Adjust to match redisplay interface changes.
* nsterm.m (ns_update_window_begin, ns_update_window_end)
(ns_scroll_run, ns_after_update_window_line):
* w32term.c (x_update_window_begin, x_update_window_end)
(x_after_update_window_line, x_scroll_run):
* xterm.c (x_update_window_begin, x_update_window_end)
(x_after_update_window_line, x_scroll_run):
* xdisp.c (x_write_glyphs, x_insert_glyphs, x_clear_end_of_line):
Likewise. Adjust comments where appropriate.
(x_cursor_to): Simplify because this is always called during window
update (but install debugging check anyway).
(expose_window): Check must_be_updated_p flag to see whether this
function is called during window update.
| -rw-r--r-- | src/ChangeLog | 26 | ||||
| -rw-r--r-- | src/dispextern.h | 24 | ||||
| -rw-r--r-- | src/dispnew.c | 44 | ||||
| -rw-r--r-- | src/nsterm.m | 9 | ||||
| -rw-r--r-- | src/w32term.c | 22 | ||||
| -rw-r--r-- | src/xdisp.c | 71 | ||||
| -rw-r--r-- | src/xterm.c | 23 |
7 files changed, 98 insertions, 121 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6cb69f776f1..caf7b034401 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,31 @@ | |||
| 1 | 2013-08-08 Dmitry Antipov <dmantipov@yandex.ru> | 1 | 2013-08-08 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 2 | ||
| 3 | Redesign redisplay interface to drop global variable updated_window. | ||
| 4 | Always pass currently updated window as a parameter to update routines. | ||
| 5 | * dispextern.h (updated_window): Remove declaration. | ||
| 6 | (struct redisplay_interface): Pass window parameter to | ||
| 7 | write_glyphs, insert_glyphs, clear_end_of_line, cursor_to | ||
| 8 | and after_update_window_hook. | ||
| 9 | (x_write_glyphs, x_insert_glyphs, x_clear_end_of_line, x_cursor_to): | ||
| 10 | Adjust prototypes. | ||
| 11 | * dispnew.c (updated_window): Remove. | ||
| 12 | (redraw_overlapped_rows, update_marginal_area, update_text_area) | ||
| 13 | (update_window_line): Adjust to match redisplay interface changes. | ||
| 14 | * nsterm.m (ns_update_window_begin, ns_update_window_end) | ||
| 15 | (ns_scroll_run, ns_after_update_window_line): | ||
| 16 | * w32term.c (x_update_window_begin, x_update_window_end) | ||
| 17 | (x_after_update_window_line, x_scroll_run): | ||
| 18 | * xterm.c (x_update_window_begin, x_update_window_end) | ||
| 19 | (x_after_update_window_line, x_scroll_run): | ||
| 20 | * xdisp.c (x_write_glyphs, x_insert_glyphs, x_clear_end_of_line): | ||
| 21 | Likewise. Adjust comments where appropriate. | ||
| 22 | (x_cursor_to): Simplify because this is always called during window | ||
| 23 | update (but install debugging check anyway). | ||
| 24 | (expose_window): Check must_be_updated_p flag to see whether this | ||
| 25 | function is called during window update. | ||
| 26 | |||
| 27 | 2013-08-08 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 28 | |||
| 3 | Do not reset window modification event counters excessively. | 29 | Do not reset window modification event counters excessively. |
| 4 | These leftovers and poor man's tricky methods to catch extra | 30 | These leftovers and poor man's tricky methods to catch extra |
| 5 | redisplay's attention are no longer needed. | 31 | redisplay's attention are no longer needed. |
diff --git a/src/dispextern.h b/src/dispextern.h index d747700fd66..7a4fa2ea774 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -1197,11 +1197,6 @@ extern bool fonts_changed_p; | |||
| 1197 | 1197 | ||
| 1198 | extern struct glyph space_glyph; | 1198 | extern struct glyph space_glyph; |
| 1199 | 1199 | ||
| 1200 | /* Window being updated by update_window. This is non-null as long as | ||
| 1201 | update_window has not finished, and null otherwise. */ | ||
| 1202 | |||
| 1203 | extern struct window *updated_window; | ||
| 1204 | |||
| 1205 | /* Glyph row and area updated by update_window_line. */ | 1200 | /* Glyph row and area updated by update_window_line. */ |
| 1206 | 1201 | ||
| 1207 | extern struct glyph_row *updated_row; | 1202 | extern struct glyph_row *updated_row; |
| @@ -2718,12 +2713,12 @@ struct redisplay_interface | |||
| 2718 | 2713 | ||
| 2719 | /* Write or insert LEN glyphs from STRING at the nominal output | 2714 | /* Write or insert LEN glyphs from STRING at the nominal output |
| 2720 | position. */ | 2715 | position. */ |
| 2721 | void (*write_glyphs) (struct glyph *string, int len); | 2716 | void (*write_glyphs) (struct window *w, struct glyph *string, int len); |
| 2722 | void (*insert_glyphs) (struct glyph *start, int len); | 2717 | void (*insert_glyphs) (struct window *w, struct glyph *start, int len); |
| 2723 | 2718 | ||
| 2724 | /* Clear from nominal output position to X. X < 0 means clear | 2719 | /* Clear from nominal output position to X. X < 0 means clear |
| 2725 | to right end of display. */ | 2720 | to right end of display. */ |
| 2726 | void (*clear_end_of_line) (int x); | 2721 | void (*clear_end_of_line) (struct window *w, int x); |
| 2727 | 2722 | ||
| 2728 | /* Function to call to scroll the display as described by RUN on | 2723 | /* Function to call to scroll the display as described by RUN on |
| 2729 | window W. */ | 2724 | window W. */ |
| @@ -2732,7 +2727,8 @@ struct redisplay_interface | |||
| 2732 | /* Function to call after a line in a display has been completely | 2727 | /* Function to call after a line in a display has been completely |
| 2733 | updated. Used to draw truncation marks and alike. DESIRED_ROW | 2728 | updated. Used to draw truncation marks and alike. DESIRED_ROW |
| 2734 | is the desired row which has been updated. */ | 2729 | is the desired row which has been updated. */ |
| 2735 | void (*after_update_window_line_hook) (struct glyph_row *desired_row); | 2730 | void (*after_update_window_line_hook) (struct window *w, |
| 2731 | struct glyph_row *desired_row); | ||
| 2736 | 2732 | ||
| 2737 | /* Function to call before beginning to update window W in | 2733 | /* Function to call before beginning to update window W in |
| 2738 | window-based redisplay. */ | 2734 | window-based redisplay. */ |
| @@ -2749,7 +2745,7 @@ struct redisplay_interface | |||
| 2749 | /* Move cursor to row/column position VPOS/HPOS, pixel coordinates | 2745 | /* Move cursor to row/column position VPOS/HPOS, pixel coordinates |
| 2750 | Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y | 2746 | Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y |
| 2751 | are window-relative pixel positions. */ | 2747 | are window-relative pixel positions. */ |
| 2752 | void (*cursor_to) (int vpos, int hpos, int y, int x); | 2748 | void (*cursor_to) (struct window *w, int vpos, int hpos, int y, int x); |
| 2753 | 2749 | ||
| 2754 | /* Flush the display of frame F. For X, this is XFlush. */ | 2750 | /* Flush the display of frame F. For X, this is XFlush. */ |
| 2755 | void (*flush_display) (struct frame *f); | 2751 | void (*flush_display) (struct frame *f); |
| @@ -3182,9 +3178,9 @@ extern void x_get_glyph_overhangs (struct glyph *, struct frame *, | |||
| 3182 | int *, int *); | 3178 | int *, int *); |
| 3183 | extern void x_produce_glyphs (struct it *); | 3179 | extern void x_produce_glyphs (struct it *); |
| 3184 | 3180 | ||
| 3185 | extern void x_write_glyphs (struct glyph *, int); | 3181 | extern void x_write_glyphs (struct window *, struct glyph *, int); |
| 3186 | extern void x_insert_glyphs (struct glyph *, int len); | 3182 | extern void x_insert_glyphs (struct window *, struct glyph *, int len); |
| 3187 | extern void x_clear_end_of_line (int); | 3183 | extern void x_clear_end_of_line (struct window *, int); |
| 3188 | 3184 | ||
| 3189 | extern struct cursor_pos output_cursor; | 3185 | extern struct cursor_pos output_cursor; |
| 3190 | 3186 | ||
| @@ -3200,7 +3196,7 @@ extern void display_and_set_cursor (struct window *, | |||
| 3200 | int, int, int, int, int); | 3196 | int, int, int, int, int); |
| 3201 | 3197 | ||
| 3202 | extern void set_output_cursor (struct cursor_pos *); | 3198 | extern void set_output_cursor (struct cursor_pos *); |
| 3203 | extern void x_cursor_to (int, int, int, int); | 3199 | extern void x_cursor_to (struct window *, int, int, int, int); |
| 3204 | 3200 | ||
| 3205 | extern void x_update_cursor (struct frame *, int); | 3201 | extern void x_update_cursor (struct frame *, int); |
| 3206 | extern void x_clear_cursor (struct window *); | 3202 | extern void x_clear_cursor (struct window *); |
diff --git a/src/dispnew.c b/src/dispnew.c index 2708252aa8a..519659a104c 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -135,10 +135,6 @@ struct frame *last_nonminibuf_frame; | |||
| 135 | 135 | ||
| 136 | static bool delayed_size_change; | 136 | static bool delayed_size_change; |
| 137 | 137 | ||
| 138 | /* Updated window if != 0. Set by update_window. */ | ||
| 139 | |||
| 140 | struct window *updated_window; | ||
| 141 | |||
| 142 | /* Glyph row updated in update_window_line, and area that is updated. */ | 138 | /* Glyph row updated in update_window_line, and area that is updated. */ |
| 143 | 139 | ||
| 144 | struct glyph_row *updated_row; | 140 | struct glyph_row *updated_row; |
| @@ -2286,7 +2282,7 @@ check_glyph_memory (void) | |||
| 2286 | screen. We build such a view by constructing a frame matrix from | 2282 | screen. We build such a view by constructing a frame matrix from |
| 2287 | window matrices in this section. | 2283 | window matrices in this section. |
| 2288 | 2284 | ||
| 2289 | Windows that must be updated have their must_be_update_p flag set. | 2285 | Windows that must be updated have their must_be_updated_p flag set. |
| 2290 | For all such windows, their desired matrix is made part of the | 2286 | For all such windows, their desired matrix is made part of the |
| 2291 | desired frame matrix. For other windows, their current matrix is | 2287 | desired frame matrix. For other windows, their current matrix is |
| 2292 | made part of the desired frame matrix. | 2288 | made part of the desired frame matrix. |
| @@ -3243,12 +3239,12 @@ redraw_overlapped_rows (struct window *w, int yb) | |||
| 3243 | { | 3239 | { |
| 3244 | updated_row = row; | 3240 | updated_row = row; |
| 3245 | updated_area = area; | 3241 | updated_area = area; |
| 3246 | FRAME_RIF (f)->cursor_to (i, 0, row->y, | 3242 | FRAME_RIF (f)->cursor_to (w, i, 0, row->y, |
| 3247 | area == TEXT_AREA ? row->x : 0); | 3243 | area == TEXT_AREA ? row->x : 0); |
| 3248 | if (row->used[area]) | 3244 | if (row->used[area]) |
| 3249 | FRAME_RIF (f)->write_glyphs (row->glyphs[area], | 3245 | FRAME_RIF (f)->write_glyphs (w, row->glyphs[area], |
| 3250 | row->used[area]); | 3246 | row->used[area]); |
| 3251 | FRAME_RIF (f)->clear_end_of_line (-1); | 3247 | FRAME_RIF (f)->clear_end_of_line (w, -1); |
| 3252 | } | 3248 | } |
| 3253 | 3249 | ||
| 3254 | row->overlapped_p = 0; | 3250 | row->overlapped_p = 0; |
| @@ -3534,10 +3530,10 @@ update_marginal_area (struct window *w, int area, int vpos) | |||
| 3534 | /* Set cursor to start of glyphs, write them, and clear to the end | 3530 | /* Set cursor to start of glyphs, write them, and clear to the end |
| 3535 | of the area. I don't think that something more sophisticated is | 3531 | of the area. I don't think that something more sophisticated is |
| 3536 | necessary here, since marginal areas will not be the default. */ | 3532 | necessary here, since marginal areas will not be the default. */ |
| 3537 | rif->cursor_to (vpos, 0, desired_row->y, 0); | 3533 | rif->cursor_to (w, vpos, 0, desired_row->y, 0); |
| 3538 | if (desired_row->used[area]) | 3534 | if (desired_row->used[area]) |
| 3539 | rif->write_glyphs (desired_row->glyphs[area], desired_row->used[area]); | 3535 | rif->write_glyphs (w, desired_row->glyphs[area], desired_row->used[area]); |
| 3540 | rif->clear_end_of_line (-1); | 3536 | rif->clear_end_of_line (w, -1); |
| 3541 | } | 3537 | } |
| 3542 | 3538 | ||
| 3543 | 3539 | ||
| @@ -3575,14 +3571,14 @@ update_text_area (struct window *w, int vpos) | |||
| 3575 | && !(current_row->mode_line_p && vpos > 0)) | 3571 | && !(current_row->mode_line_p && vpos > 0)) |
| 3576 | || current_row->x != desired_row->x) | 3572 | || current_row->x != desired_row->x) |
| 3577 | { | 3573 | { |
| 3578 | rif->cursor_to (vpos, 0, desired_row->y, desired_row->x); | 3574 | rif->cursor_to (w, vpos, 0, desired_row->y, desired_row->x); |
| 3579 | 3575 | ||
| 3580 | if (desired_row->used[TEXT_AREA]) | 3576 | if (desired_row->used[TEXT_AREA]) |
| 3581 | rif->write_glyphs (desired_row->glyphs[TEXT_AREA], | 3577 | rif->write_glyphs (w, desired_row->glyphs[TEXT_AREA], |
| 3582 | desired_row->used[TEXT_AREA]); | 3578 | desired_row->used[TEXT_AREA]); |
| 3583 | 3579 | ||
| 3584 | /* Clear to end of window. */ | 3580 | /* Clear to end of window. */ |
| 3585 | rif->clear_end_of_line (-1); | 3581 | rif->clear_end_of_line (w, -1); |
| 3586 | changed_p = 1; | 3582 | changed_p = 1; |
| 3587 | 3583 | ||
| 3588 | /* This erases the cursor. We do this here because | 3584 | /* This erases the cursor. We do this here because |
| @@ -3718,8 +3714,8 @@ update_text_area (struct window *w, int vpos) | |||
| 3718 | break; | 3714 | break; |
| 3719 | } | 3715 | } |
| 3720 | 3716 | ||
| 3721 | rif->cursor_to (vpos, start_hpos, desired_row->y, start_x); | 3717 | rif->cursor_to (w, vpos, start_hpos, desired_row->y, start_x); |
| 3722 | rif->write_glyphs (start, i - start_hpos); | 3718 | rif->write_glyphs (w, start, i - start_hpos); |
| 3723 | changed_p = 1; | 3719 | changed_p = 1; |
| 3724 | } | 3720 | } |
| 3725 | } | 3721 | } |
| @@ -3727,8 +3723,8 @@ update_text_area (struct window *w, int vpos) | |||
| 3727 | /* Write the rest. */ | 3723 | /* Write the rest. */ |
| 3728 | if (i < desired_row->used[TEXT_AREA]) | 3724 | if (i < desired_row->used[TEXT_AREA]) |
| 3729 | { | 3725 | { |
| 3730 | rif->cursor_to (vpos, i, desired_row->y, x); | 3726 | rif->cursor_to (w, vpos, i, desired_row->y, x); |
| 3731 | rif->write_glyphs (desired_glyph, desired_row->used[TEXT_AREA] - i); | 3727 | rif->write_glyphs (w, desired_glyph, desired_row->used[TEXT_AREA] - i); |
| 3732 | changed_p = 1; | 3728 | changed_p = 1; |
| 3733 | } | 3729 | } |
| 3734 | 3730 | ||
| @@ -3748,9 +3744,9 @@ update_text_area (struct window *w, int vpos) | |||
| 3748 | { | 3744 | { |
| 3749 | /* If old row extends to the end of the text area, clear. */ | 3745 | /* If old row extends to the end of the text area, clear. */ |
| 3750 | if (i >= desired_row->used[TEXT_AREA]) | 3746 | if (i >= desired_row->used[TEXT_AREA]) |
| 3751 | rif->cursor_to (vpos, i, desired_row->y, | 3747 | rif->cursor_to (w, vpos, i, desired_row->y, |
| 3752 | desired_row->pixel_width); | 3748 | desired_row->pixel_width); |
| 3753 | rif->clear_end_of_line (-1); | 3749 | rif->clear_end_of_line (w, -1); |
| 3754 | changed_p = 1; | 3750 | changed_p = 1; |
| 3755 | } | 3751 | } |
| 3756 | else if (desired_row->pixel_width < current_row->pixel_width) | 3752 | else if (desired_row->pixel_width < current_row->pixel_width) |
| @@ -3760,7 +3756,7 @@ update_text_area (struct window *w, int vpos) | |||
| 3760 | int xlim; | 3756 | int xlim; |
| 3761 | 3757 | ||
| 3762 | if (i >= desired_row->used[TEXT_AREA]) | 3758 | if (i >= desired_row->used[TEXT_AREA]) |
| 3763 | rif->cursor_to (vpos, i, desired_row->y, | 3759 | rif->cursor_to (w, vpos, i, desired_row->y, |
| 3764 | desired_row->pixel_width); | 3760 | desired_row->pixel_width); |
| 3765 | 3761 | ||
| 3766 | /* If cursor is displayed at the end of the line, make sure | 3762 | /* If cursor is displayed at the end of the line, make sure |
| @@ -3778,7 +3774,7 @@ update_text_area (struct window *w, int vpos) | |||
| 3778 | } | 3774 | } |
| 3779 | else | 3775 | else |
| 3780 | xlim = current_row->pixel_width; | 3776 | xlim = current_row->pixel_width; |
| 3781 | rif->clear_end_of_line (xlim); | 3777 | rif->clear_end_of_line (w, xlim); |
| 3782 | changed_p = 1; | 3778 | changed_p = 1; |
| 3783 | } | 3779 | } |
| 3784 | } | 3780 | } |
| @@ -3850,7 +3846,7 @@ update_window_line (struct window *w, int vpos, bool *mouse_face_overwritten_p) | |||
| 3850 | || desired_row->exact_window_width_line_p != current_row->exact_window_width_line_p | 3846 | || desired_row->exact_window_width_line_p != current_row->exact_window_width_line_p |
| 3851 | || (MATRIX_ROW_CONTINUATION_LINE_P (desired_row) | 3847 | || (MATRIX_ROW_CONTINUATION_LINE_P (desired_row) |
| 3852 | != MATRIX_ROW_CONTINUATION_LINE_P (current_row))) | 3848 | != MATRIX_ROW_CONTINUATION_LINE_P (current_row))) |
| 3853 | rif->after_update_window_line_hook (desired_row); | 3849 | rif->after_update_window_line_hook (w, desired_row); |
| 3854 | } | 3850 | } |
| 3855 | 3851 | ||
| 3856 | /* Update current_row from desired_row. */ | 3852 | /* Update current_row from desired_row. */ |
| @@ -3939,7 +3935,7 @@ set_window_cursor_after_update (struct window *w) | |||
| 3939 | Horizontal position is -1 when cursor is on the left fringe. */ | 3935 | Horizontal position is -1 when cursor is on the left fringe. */ |
| 3940 | hpos = clip_to_bounds (-1, hpos, w->current_matrix->matrix_w - 1); | 3936 | hpos = clip_to_bounds (-1, hpos, w->current_matrix->matrix_w - 1); |
| 3941 | vpos = clip_to_bounds (0, vpos, w->current_matrix->nrows - 1); | 3937 | vpos = clip_to_bounds (0, vpos, w->current_matrix->nrows - 1); |
| 3942 | rif->cursor_to (vpos, hpos, cy, cx); | 3938 | rif->cursor_to (w, vpos, hpos, cy, cx); |
| 3943 | } | 3939 | } |
| 3944 | 3940 | ||
| 3945 | 3941 | ||
diff --git a/src/nsterm.m b/src/nsterm.m index 3672c7656da..56572d5b9f4 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -711,9 +711,9 @@ ns_update_window_begin (struct window *w) | |||
| 711 | -------------------------------------------------------------------------- */ | 711 | -------------------------------------------------------------------------- */ |
| 712 | { | 712 | { |
| 713 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 713 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 714 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | 714 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 715 | |||
| 715 | NSTRACE (ns_update_window_begin); | 716 | NSTRACE (ns_update_window_begin); |
| 716 | updated_window = w; | ||
| 717 | set_output_cursor (&w->cursor); | 717 | set_output_cursor (&w->cursor); |
| 718 | 718 | ||
| 719 | block_input (); | 719 | block_input (); |
| @@ -770,7 +770,6 @@ ns_update_window_end (struct window *w, int cursor_on_p, | |||
| 770 | hlinfo->mouse_face_window = Qnil; | 770 | hlinfo->mouse_face_window = Qnil; |
| 771 | } | 771 | } |
| 772 | 772 | ||
| 773 | updated_window = NULL; | ||
| 774 | NSTRACE (update_window_end); | 773 | NSTRACE (update_window_end); |
| 775 | } | 774 | } |
| 776 | 775 | ||
| @@ -2084,7 +2083,6 @@ ns_scroll_run (struct window *w, struct run *run) | |||
| 2084 | 2083 | ||
| 2085 | block_input (); | 2084 | block_input (); |
| 2086 | 2085 | ||
| 2087 | updated_window = w; | ||
| 2088 | x_clear_cursor (w); | 2086 | x_clear_cursor (w); |
| 2089 | 2087 | ||
| 2090 | { | 2088 | { |
| @@ -2102,12 +2100,11 @@ ns_scroll_run (struct window *w, struct run *run) | |||
| 2102 | 2100 | ||
| 2103 | 2101 | ||
| 2104 | static void | 2102 | static void |
| 2105 | ns_after_update_window_line (struct glyph_row *desired_row) | 2103 | ns_after_update_window_line (struct window *w, struct glyph_row *desired_row) |
| 2106 | /* -------------------------------------------------------------------------- | 2104 | /* -------------------------------------------------------------------------- |
| 2107 | External (RIF): preparatory to fringe update after text was updated | 2105 | External (RIF): preparatory to fringe update after text was updated |
| 2108 | -------------------------------------------------------------------------- */ | 2106 | -------------------------------------------------------------------------- */ |
| 2109 | { | 2107 | { |
| 2110 | struct window *w = updated_window; | ||
| 2111 | struct frame *f; | 2108 | struct frame *f; |
| 2112 | int width, height; | 2109 | int width, height; |
| 2113 | 2110 | ||
diff --git a/src/w32term.c b/src/w32term.c index 56793660d90..15812f93ff5 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -577,8 +577,7 @@ x_update_begin (struct frame *f) | |||
| 577 | } | 577 | } |
| 578 | 578 | ||
| 579 | 579 | ||
| 580 | /* Start update of window W. Set the global variable updated_window | 580 | /* Start update of window W. Set output_cursor to the cursor |
| 581 | to the window being updated and set output_cursor to the cursor | ||
| 582 | position of W. */ | 581 | position of W. */ |
| 583 | 582 | ||
| 584 | static void | 583 | static void |
| @@ -593,7 +592,6 @@ x_update_window_begin (struct window *w) | |||
| 593 | SendMessage (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0); | 592 | SendMessage (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0); |
| 594 | } | 593 | } |
| 595 | 594 | ||
| 596 | updated_window = w; | ||
| 597 | set_output_cursor (&w->cursor); | 595 | set_output_cursor (&w->cursor); |
| 598 | 596 | ||
| 599 | block_input (); | 597 | block_input (); |
| @@ -664,7 +662,7 @@ w32_draw_vertical_window_border (struct window *w, int x, int y0, int y1) | |||
| 664 | } | 662 | } |
| 665 | 663 | ||
| 666 | 664 | ||
| 667 | /* End update of window W (which is equal to updated_window). | 665 | /* End update of window W. |
| 668 | 666 | ||
| 669 | Draw vertical borders between horizontally adjacent windows, and | 667 | Draw vertical borders between horizontally adjacent windows, and |
| 670 | display W's cursor if CURSOR_ON_P is non-zero. | 668 | display W's cursor if CURSOR_ON_P is non-zero. |
| @@ -714,8 +712,6 @@ x_update_window_end (struct window *w, int cursor_on_p, | |||
| 714 | { | 712 | { |
| 715 | SendMessage (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0); | 713 | SendMessage (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0); |
| 716 | } | 714 | } |
| 717 | |||
| 718 | updated_window = NULL; | ||
| 719 | } | 715 | } |
| 720 | 716 | ||
| 721 | 717 | ||
| @@ -733,9 +729,8 @@ x_update_end (struct frame *f) | |||
| 733 | } | 729 | } |
| 734 | 730 | ||
| 735 | 731 | ||
| 736 | /* This function is called from various places in xdisp.c whenever a | 732 | /* This function is called from various places in xdisp.c |
| 737 | complete update has been performed. The global variable | 733 | whenever a complete update has been performed. */ |
| 738 | updated_window is not available here. */ | ||
| 739 | 734 | ||
| 740 | static void | 735 | static void |
| 741 | w32_frame_up_to_date (struct frame *f) | 736 | w32_frame_up_to_date (struct frame *f) |
| @@ -747,15 +742,13 @@ w32_frame_up_to_date (struct frame *f) | |||
| 747 | 742 | ||
| 748 | /* Draw truncation mark bitmaps, continuation mark bitmaps, overlay | 743 | /* Draw truncation mark bitmaps, continuation mark bitmaps, overlay |
| 749 | arrow bitmaps, or clear the fringes if no bitmaps are required | 744 | arrow bitmaps, or clear the fringes if no bitmaps are required |
| 750 | before DESIRED_ROW is made current. The window being updated is | 745 | before DESIRED_ROW is made current. This function is called from |
| 751 | found in updated_window. This function is called from | ||
| 752 | update_window_line only if it is known that there are differences | 746 | update_window_line only if it is known that there are differences |
| 753 | between bitmaps to be drawn between current row and DESIRED_ROW. */ | 747 | between bitmaps to be drawn between current row and DESIRED_ROW. */ |
| 754 | 748 | ||
| 755 | static void | 749 | static void |
| 756 | x_after_update_window_line (struct glyph_row *desired_row) | 750 | x_after_update_window_line (struct window *w, struct glyph_row *desired_row) |
| 757 | { | 751 | { |
| 758 | struct window *w = updated_window; | ||
| 759 | struct frame *f; | 752 | struct frame *f; |
| 760 | int width, height; | 753 | int width, height; |
| 761 | 754 | ||
| @@ -766,7 +759,7 @@ x_after_update_window_line (struct glyph_row *desired_row) | |||
| 766 | 759 | ||
| 767 | /* When a window has disappeared, make sure that no rest of | 760 | /* When a window has disappeared, make sure that no rest of |
| 768 | full-width rows stays visible in the internal border. Could | 761 | full-width rows stays visible in the internal border. Could |
| 769 | check here if updated_window is the leftmost/rightmost window, | 762 | check here if updated window is the leftmost/rightmost window, |
| 770 | but I guess it's not worth doing since vertically split windows | 763 | but I guess it's not worth doing since vertically split windows |
| 771 | are almost never used, internal border is rarely set, and the | 764 | are almost never used, internal border is rarely set, and the |
| 772 | overhead is very small. */ | 765 | overhead is very small. */ |
| @@ -2806,7 +2799,6 @@ x_scroll_run (struct window *w, struct run *run) | |||
| 2806 | block_input (); | 2799 | block_input (); |
| 2807 | 2800 | ||
| 2808 | /* Cursor off. Will be switched on again in x_update_window_end. */ | 2801 | /* Cursor off. Will be switched on again in x_update_window_end. */ |
| 2809 | updated_window = w; | ||
| 2810 | x_clear_cursor (w); | 2802 | x_clear_cursor (w); |
| 2811 | 2803 | ||
| 2812 | { | 2804 | { |
diff --git a/src/xdisp.c b/src/xdisp.c index d2dae3406d1..ab625b9d6ec 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -11385,7 +11385,7 @@ struct cursor_pos output_cursor; | |||
| 11385 | 11385 | ||
| 11386 | /* EXPORT: | 11386 | /* EXPORT: |
| 11387 | Set the global variable output_cursor to CURSOR. All cursor | 11387 | Set the global variable output_cursor to CURSOR. All cursor |
| 11388 | positions are relative to updated_window. */ | 11388 | positions are relative to currently updated window. */ |
| 11389 | 11389 | ||
| 11390 | void | 11390 | void |
| 11391 | set_output_cursor (struct cursor_pos *cursor) | 11391 | set_output_cursor (struct cursor_pos *cursor) |
| @@ -11400,41 +11400,24 @@ set_output_cursor (struct cursor_pos *cursor) | |||
| 11400 | /* EXPORT for RIF: | 11400 | /* EXPORT for RIF: |
| 11401 | Set a nominal cursor position. | 11401 | Set a nominal cursor position. |
| 11402 | 11402 | ||
| 11403 | HPOS and VPOS are column/row positions in a window glyph matrix. X | 11403 | HPOS and VPOS are column/row positions in a window glyph matrix. |
| 11404 | and Y are window text area relative pixel positions. | 11404 | X and Y are window text area relative pixel positions. |
| 11405 | 11405 | ||
| 11406 | If this is done during an update, updated_window will contain the | 11406 | This is always done during window update, so the position is the |
| 11407 | window that is being updated and the position is the future output | 11407 | future output cursor position for currently updated window W. |
| 11408 | cursor position for that window. If updated_window is null, use | 11408 | NOTE: W is used only to check whether this function is called |
| 11409 | selected_window and display the cursor at the given position. */ | 11409 | in a consistent manner via the redisplay interface. */ |
| 11410 | 11410 | ||
| 11411 | void | 11411 | void |
| 11412 | x_cursor_to (int vpos, int hpos, int y, int x) | 11412 | x_cursor_to (struct window *w, int vpos, int hpos, int y, int x) |
| 11413 | { | 11413 | { |
| 11414 | struct window *w; | 11414 | eassert (w); |
| 11415 | |||
| 11416 | /* If updated_window is not set, work on selected_window. */ | ||
| 11417 | if (updated_window) | ||
| 11418 | w = updated_window; | ||
| 11419 | else | ||
| 11420 | w = XWINDOW (selected_window); | ||
| 11421 | 11415 | ||
| 11422 | /* Set the output cursor. */ | 11416 | /* Set the output cursor. */ |
| 11423 | output_cursor.hpos = hpos; | 11417 | output_cursor.hpos = hpos; |
| 11424 | output_cursor.vpos = vpos; | 11418 | output_cursor.vpos = vpos; |
| 11425 | output_cursor.x = x; | 11419 | output_cursor.x = x; |
| 11426 | output_cursor.y = y; | 11420 | output_cursor.y = y; |
| 11427 | |||
| 11428 | /* If not called as part of an update, really display the cursor. | ||
| 11429 | This will also set the cursor position of W. */ | ||
| 11430 | if (updated_window == NULL) | ||
| 11431 | { | ||
| 11432 | block_input (); | ||
| 11433 | display_and_set_cursor (w, 1, hpos, vpos, x, y); | ||
| 11434 | if (FRAME_RIF (SELECTED_FRAME ())->flush_display_optional) | ||
| 11435 | FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (SELECTED_FRAME ()); | ||
| 11436 | unblock_input (); | ||
| 11437 | } | ||
| 11438 | } | 11421 | } |
| 11439 | 11422 | ||
| 11440 | #endif /* HAVE_WINDOW_SYSTEM */ | 11423 | #endif /* HAVE_WINDOW_SYSTEM */ |
| @@ -25745,16 +25728,15 @@ x_produce_glyphs (struct it *it) | |||
| 25745 | /* EXPORT for RIF: | 25728 | /* EXPORT for RIF: |
| 25746 | Output LEN glyphs starting at START at the nominal cursor position. | 25729 | Output LEN glyphs starting at START at the nominal cursor position. |
| 25747 | Advance the nominal cursor over the text. The global variable | 25730 | Advance the nominal cursor over the text. The global variable |
| 25748 | updated_window contains the window being updated, updated_row is | 25731 | updated_row is the glyph row being updated, and updated_area is the |
| 25749 | the glyph row being updated, and updated_area is the area of that | 25732 | area of that row being updated. */ |
| 25750 | row being updated. */ | ||
| 25751 | 25733 | ||
| 25752 | void | 25734 | void |
| 25753 | x_write_glyphs (struct glyph *start, int len) | 25735 | x_write_glyphs (struct window *w, struct glyph *start, int len) |
| 25754 | { | 25736 | { |
| 25755 | int x, hpos, chpos = updated_window->phys_cursor.hpos; | 25737 | int x, hpos, chpos = w->phys_cursor.hpos; |
| 25756 | 25738 | ||
| 25757 | eassert (updated_window && updated_row); | 25739 | eassert (updated_row); |
| 25758 | /* When the window is hscrolled, cursor hpos can legitimately be out | 25740 | /* When the window is hscrolled, cursor hpos can legitimately be out |
| 25759 | of bounds, but we draw the cursor at the corresponding window | 25741 | of bounds, but we draw the cursor at the corresponding window |
| 25760 | margin in that case. */ | 25742 | margin in that case. */ |
| @@ -25768,18 +25750,18 @@ x_write_glyphs (struct glyph *start, int len) | |||
| 25768 | /* Write glyphs. */ | 25750 | /* Write glyphs. */ |
| 25769 | 25751 | ||
| 25770 | hpos = start - updated_row->glyphs[updated_area]; | 25752 | hpos = start - updated_row->glyphs[updated_area]; |
| 25771 | x = draw_glyphs (updated_window, output_cursor.x, | 25753 | x = draw_glyphs (w, output_cursor.x, |
| 25772 | updated_row, updated_area, | 25754 | updated_row, updated_area, |
| 25773 | hpos, hpos + len, | 25755 | hpos, hpos + len, |
| 25774 | DRAW_NORMAL_TEXT, 0); | 25756 | DRAW_NORMAL_TEXT, 0); |
| 25775 | 25757 | ||
| 25776 | /* Invalidate old phys cursor if the glyph at its hpos is redrawn. */ | 25758 | /* Invalidate old phys cursor if the glyph at its hpos is redrawn. */ |
| 25777 | if (updated_area == TEXT_AREA | 25759 | if (updated_area == TEXT_AREA |
| 25778 | && updated_window->phys_cursor_on_p | 25760 | && w->phys_cursor_on_p |
| 25779 | && updated_window->phys_cursor.vpos == output_cursor.vpos | 25761 | && w->phys_cursor.vpos == output_cursor.vpos |
| 25780 | && chpos >= hpos | 25762 | && chpos >= hpos |
| 25781 | && chpos < hpos + len) | 25763 | && chpos < hpos + len) |
| 25782 | updated_window->phys_cursor_on_p = 0; | 25764 | w->phys_cursor_on_p = 0; |
| 25783 | 25765 | ||
| 25784 | unblock_input (); | 25766 | unblock_input (); |
| 25785 | 25767 | ||
| @@ -25793,19 +25775,17 @@ x_write_glyphs (struct glyph *start, int len) | |||
| 25793 | Insert LEN glyphs from START at the nominal cursor position. */ | 25775 | Insert LEN glyphs from START at the nominal cursor position. */ |
| 25794 | 25776 | ||
| 25795 | void | 25777 | void |
| 25796 | x_insert_glyphs (struct glyph *start, int len) | 25778 | x_insert_glyphs (struct window *w, struct glyph *start, int len) |
| 25797 | { | 25779 | { |
| 25798 | struct frame *f; | 25780 | struct frame *f; |
| 25799 | struct window *w; | ||
| 25800 | int line_height, shift_by_width, shifted_region_width; | 25781 | int line_height, shift_by_width, shifted_region_width; |
| 25801 | struct glyph_row *row; | 25782 | struct glyph_row *row; |
| 25802 | struct glyph *glyph; | 25783 | struct glyph *glyph; |
| 25803 | int frame_x, frame_y; | 25784 | int frame_x, frame_y; |
| 25804 | ptrdiff_t hpos; | 25785 | ptrdiff_t hpos; |
| 25805 | 25786 | ||
| 25806 | eassert (updated_window && updated_row); | 25787 | eassert (updated_row); |
| 25807 | block_input (); | 25788 | block_input (); |
| 25808 | w = updated_window; | ||
| 25809 | f = XFRAME (WINDOW_FRAME (w)); | 25789 | f = XFRAME (WINDOW_FRAME (w)); |
| 25810 | 25790 | ||
| 25811 | /* Get the height of the line we are in. */ | 25791 | /* Get the height of the line we are in. */ |
| @@ -25847,18 +25827,17 @@ x_insert_glyphs (struct glyph *start, int len) | |||
| 25847 | (inclusive) to pixel column TO_X (exclusive). The idea is that | 25827 | (inclusive) to pixel column TO_X (exclusive). The idea is that |
| 25848 | everything from TO_X onward is already erased. | 25828 | everything from TO_X onward is already erased. |
| 25849 | 25829 | ||
| 25850 | TO_X is a pixel position relative to updated_area of | 25830 | TO_X is a pixel position relative to updated_area of currently |
| 25851 | updated_window. TO_X == -1 means clear to the end of this area. */ | 25831 | updated window W. TO_X == -1 means clear to the end of this area. */ |
| 25852 | 25832 | ||
| 25853 | void | 25833 | void |
| 25854 | x_clear_end_of_line (int to_x) | 25834 | x_clear_end_of_line (struct window *w, int to_x) |
| 25855 | { | 25835 | { |
| 25856 | struct frame *f; | 25836 | struct frame *f; |
| 25857 | struct window *w = updated_window; | ||
| 25858 | int max_x, min_y, max_y; | 25837 | int max_x, min_y, max_y; |
| 25859 | int from_x, from_y, to_y; | 25838 | int from_x, from_y, to_y; |
| 25860 | 25839 | ||
| 25861 | eassert (updated_window && updated_row); | 25840 | eassert (updated_row); |
| 25862 | f = XFRAME (w->frame); | 25841 | f = XFRAME (w->frame); |
| 25863 | 25842 | ||
| 25864 | if (updated_row->full_width_p) | 25843 | if (updated_row->full_width_p) |
| @@ -28820,7 +28799,7 @@ expose_window (struct window *w, XRectangle *fr) | |||
| 28820 | /* When we're currently updating the window, display and current | 28799 | /* When we're currently updating the window, display and current |
| 28821 | matrix usually don't agree. Arrange for a thorough display | 28800 | matrix usually don't agree. Arrange for a thorough display |
| 28822 | later. */ | 28801 | later. */ |
| 28823 | if (w == updated_window) | 28802 | if (w->must_be_updated_p) |
| 28824 | { | 28803 | { |
| 28825 | SET_FRAME_GARBAGED (f); | 28804 | SET_FRAME_GARBAGED (f); |
| 28826 | return 0; | 28805 | return 0; |
diff --git a/src/xterm.c b/src/xterm.c index a486242b8c3..6391154961f 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -320,7 +320,6 @@ static void x_clip_to_row (struct window *, struct glyph_row *, int, GC); | |||
| 320 | static void x_flush (struct frame *f); | 320 | static void x_flush (struct frame *f); |
| 321 | static void x_update_begin (struct frame *); | 321 | static void x_update_begin (struct frame *); |
| 322 | static void x_update_window_begin (struct window *); | 322 | static void x_update_window_begin (struct window *); |
| 323 | static void x_after_update_window_line (struct glyph_row *); | ||
| 324 | static struct scroll_bar *x_window_to_scroll_bar (Display *, Window); | 323 | static struct scroll_bar *x_window_to_scroll_bar (Display *, Window); |
| 325 | static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, | 324 | static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, |
| 326 | enum scroll_bar_part *, | 325 | enum scroll_bar_part *, |
| @@ -554,8 +553,7 @@ x_update_begin (struct frame *f) | |||
| 554 | } | 553 | } |
| 555 | 554 | ||
| 556 | 555 | ||
| 557 | /* Start update of window W. Set the global variable updated_window | 556 | /* Start update of window W. Set output_cursor to the cursor |
| 558 | to the window being updated and set output_cursor to the cursor | ||
| 559 | position of W. */ | 557 | position of W. */ |
| 560 | 558 | ||
| 561 | static void | 559 | static void |
| @@ -564,7 +562,6 @@ x_update_window_begin (struct window *w) | |||
| 564 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 562 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 565 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | 563 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 566 | 564 | ||
| 567 | updated_window = w; | ||
| 568 | set_output_cursor (&w->cursor); | 565 | set_output_cursor (&w->cursor); |
| 569 | 566 | ||
| 570 | block_input (); | 567 | block_input (); |
| @@ -601,7 +598,7 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1) | |||
| 601 | f->output_data.x->normal_gc, x, y0, x, y1); | 598 | f->output_data.x->normal_gc, x, y0, x, y1); |
| 602 | } | 599 | } |
| 603 | 600 | ||
| 604 | /* End update of window W (which is equal to updated_window). | 601 | /* End update of window W. |
| 605 | 602 | ||
| 606 | Draw vertical borders between horizontally adjacent windows, and | 603 | Draw vertical borders between horizontally adjacent windows, and |
| 607 | display W's cursor if CURSOR_ON_P is non-zero. | 604 | display W's cursor if CURSOR_ON_P is non-zero. |
| @@ -642,8 +639,6 @@ x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritt | |||
| 642 | hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; | 639 | hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; |
| 643 | hlinfo->mouse_face_window = Qnil; | 640 | hlinfo->mouse_face_window = Qnil; |
| 644 | } | 641 | } |
| 645 | |||
| 646 | updated_window = NULL; | ||
| 647 | } | 642 | } |
| 648 | 643 | ||
| 649 | 644 | ||
| @@ -664,9 +659,8 @@ x_update_end (struct frame *f) | |||
| 664 | } | 659 | } |
| 665 | 660 | ||
| 666 | 661 | ||
| 667 | /* This function is called from various places in xdisp.c whenever a | 662 | /* This function is called from various places in xdisp.c |
| 668 | complete update has been performed. The global variable | 663 | whenever a complete update has been performed. */ |
| 669 | updated_window is not available here. */ | ||
| 670 | 664 | ||
| 671 | static void | 665 | static void |
| 672 | XTframe_up_to_date (struct frame *f) | 666 | XTframe_up_to_date (struct frame *f) |
| @@ -678,15 +672,13 @@ XTframe_up_to_date (struct frame *f) | |||
| 678 | 672 | ||
| 679 | /* Draw truncation mark bitmaps, continuation mark bitmaps, overlay | 673 | /* Draw truncation mark bitmaps, continuation mark bitmaps, overlay |
| 680 | arrow bitmaps, or clear the fringes if no bitmaps are required | 674 | arrow bitmaps, or clear the fringes if no bitmaps are required |
| 681 | before DESIRED_ROW is made current. The window being updated is | 675 | before DESIRED_ROW is made current. This function is called from |
| 682 | found in updated_window. This function It is called from | ||
| 683 | update_window_line only if it is known that there are differences | 676 | update_window_line only if it is known that there are differences |
| 684 | between bitmaps to be drawn between current row and DESIRED_ROW. */ | 677 | between bitmaps to be drawn between current row and DESIRED_ROW. */ |
| 685 | 678 | ||
| 686 | static void | 679 | static void |
| 687 | x_after_update_window_line (struct glyph_row *desired_row) | 680 | x_after_update_window_line (struct window *w, struct glyph_row *desired_row) |
| 688 | { | 681 | { |
| 689 | struct window *w = updated_window; | ||
| 690 | struct frame *f; | 682 | struct frame *f; |
| 691 | int width, height; | 683 | int width, height; |
| 692 | 684 | ||
| @@ -697,7 +689,7 @@ x_after_update_window_line (struct glyph_row *desired_row) | |||
| 697 | 689 | ||
| 698 | /* When a window has disappeared, make sure that no rest of | 690 | /* When a window has disappeared, make sure that no rest of |
| 699 | full-width rows stays visible in the internal border. Could | 691 | full-width rows stays visible in the internal border. Could |
| 700 | check here if updated_window is the leftmost/rightmost window, | 692 | check here if updated window is the leftmost/rightmost window, |
| 701 | but I guess it's not worth doing since vertically split windows | 693 | but I guess it's not worth doing since vertically split windows |
| 702 | are almost never used, internal border is rarely set, and the | 694 | are almost never used, internal border is rarely set, and the |
| 703 | overhead is very small. */ | 695 | overhead is very small. */ |
| @@ -3323,7 +3315,6 @@ x_scroll_run (struct window *w, struct run *run) | |||
| 3323 | block_input (); | 3315 | block_input (); |
| 3324 | 3316 | ||
| 3325 | /* Cursor off. Will be switched on again in x_update_window_end. */ | 3317 | /* Cursor off. Will be switched on again in x_update_window_end. */ |
| 3326 | updated_window = w; | ||
| 3327 | x_clear_cursor (w); | 3318 | x_clear_cursor (w); |
| 3328 | 3319 | ||
| 3329 | XCopyArea (FRAME_X_DISPLAY (f), | 3320 | XCopyArea (FRAME_X_DISPLAY (f), |