diff options
| author | Alexander Gramiak | 2019-04-27 15:00:13 -0600 |
|---|---|---|
| committer | Alexander Gramiak | 2019-05-02 21:16:43 -0600 |
| commit | 9ae94ebdfa80cf3983c254696b5ab998f7296aec (patch) | |
| tree | 364c8c2dad661c4a5c7c735677e0bb0ed8775aec | |
| parent | d17ae7f5afb851a26a957bd7d1765aae6d08fe1d (diff) | |
| download | emacs-9ae94ebdfa80cf3983c254696b5ab998f7296aec.tar.gz emacs-9ae94ebdfa80cf3983c254696b5ab998f7296aec.zip | |
Refactor update_window_begin and update_window_end hooks
Bug#35464.
* src/dispnew.c (gui_update_window_begin, gui_update_window_end): New
procedures implementing common functionality.
* src/nsterm.m: (ns_update_window_begin, ns_update_window_end):
* src/xterm.c: (x_update_window_begin, x_update_window_end): Remove in
favor of only using the new generic versions.
* src/w32term.c: (w32_update_window_begin, w32_update_window_end):
Remove duplicated and unused code.
| -rw-r--r-- | src/dispextern.h | 4 | ||||
| -rw-r--r-- | src/dispnew.c | 94 | ||||
| -rw-r--r-- | src/nsterm.m | 78 | ||||
| -rw-r--r-- | src/w32term.c | 83 | ||||
| -rw-r--r-- | src/xdisp.c | 18 | ||||
| -rw-r--r-- | src/xterm.c | 84 |
6 files changed, 118 insertions, 243 deletions
diff --git a/src/dispextern.h b/src/dispextern.h index 4d6d0371d38..bb981f83fca 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3521,6 +3521,10 @@ void clear_glyph_matrix_rows (struct glyph_matrix *, int, int); | |||
| 3521 | void clear_glyph_row (struct glyph_row *); | 3521 | void clear_glyph_row (struct glyph_row *); |
| 3522 | void prepare_desired_row (struct window *, struct glyph_row *, bool); | 3522 | void prepare_desired_row (struct window *, struct glyph_row *, bool); |
| 3523 | void update_single_window (struct window *); | 3523 | void update_single_window (struct window *); |
| 3524 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 3525 | extern void gui_update_window_begin (struct window *); | ||
| 3526 | extern void gui_update_window_end (struct window *, bool, bool); | ||
| 3527 | #endif | ||
| 3524 | void do_pending_window_change (bool); | 3528 | void do_pending_window_change (bool); |
| 3525 | void change_frame_size (struct frame *, int, int, bool, bool, bool, bool); | 3529 | void change_frame_size (struct frame *, int, int, bool, bool, bool, bool); |
| 3526 | void init_display (void); | 3530 | void init_display (void); |
diff --git a/src/dispnew.c b/src/dispnew.c index 25a2d1cd38b..52a7b6d6ee0 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -3390,7 +3390,9 @@ update_window (struct window *w, bool force_p) | |||
| 3390 | struct glyph_matrix *desired_matrix = w->desired_matrix; | 3390 | struct glyph_matrix *desired_matrix = w->desired_matrix; |
| 3391 | bool paused_p; | 3391 | bool paused_p; |
| 3392 | int preempt_count = clip_to_bounds (1, baud_rate / 2400 + 1, INT_MAX); | 3392 | int preempt_count = clip_to_bounds (1, baud_rate / 2400 + 1, INT_MAX); |
| 3393 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 3393 | struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w))); | 3394 | struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w))); |
| 3395 | #endif | ||
| 3394 | #ifdef GLYPH_DEBUG | 3396 | #ifdef GLYPH_DEBUG |
| 3395 | /* Check that W's frame doesn't have glyph matrices. */ | 3397 | /* Check that W's frame doesn't have glyph matrices. */ |
| 3396 | eassert (FRAME_WINDOW_P (XFRAME (WINDOW_FRAME (w)))); | 3398 | eassert (FRAME_WINDOW_P (XFRAME (WINDOW_FRAME (w)))); |
| @@ -3411,7 +3413,9 @@ update_window (struct window *w, bool force_p) | |||
| 3411 | bool changed_p = 0, mouse_face_overwritten_p = 0; | 3413 | bool changed_p = 0, mouse_face_overwritten_p = 0; |
| 3412 | int n_updated = 0; | 3414 | int n_updated = 0; |
| 3413 | 3415 | ||
| 3414 | rif->update_window_begin_hook (w); | 3416 | #ifdef HAVE_WINDOW_SYSTEM |
| 3417 | gui_update_window_begin (w); | ||
| 3418 | #endif | ||
| 3415 | yb = window_text_bottom_y (w); | 3419 | yb = window_text_bottom_y (w); |
| 3416 | row = MATRIX_ROW (desired_matrix, 0); | 3420 | row = MATRIX_ROW (desired_matrix, 0); |
| 3417 | end = MATRIX_MODE_LINE_ROW (desired_matrix); | 3421 | end = MATRIX_MODE_LINE_ROW (desired_matrix); |
| @@ -3533,13 +3537,13 @@ update_window (struct window *w, bool force_p) | |||
| 3533 | 3537 | ||
| 3534 | #ifdef HAVE_WINDOW_SYSTEM | 3538 | #ifdef HAVE_WINDOW_SYSTEM |
| 3535 | update_window_fringes (w, 0); | 3539 | update_window_fringes (w, 0); |
| 3536 | #endif | ||
| 3537 | 3540 | ||
| 3538 | /* End the update of window W. Don't set the cursor if we | 3541 | /* End the update of window W. Don't set the cursor if we |
| 3539 | paused updating the display because in this case, | 3542 | paused updating the display because in this case, |
| 3540 | set_window_cursor_after_update hasn't been called, and | 3543 | set_window_cursor_after_update hasn't been called, and |
| 3541 | W->output_cursor doesn't contain the cursor location. */ | 3544 | W->output_cursor doesn't contain the cursor location. */ |
| 3542 | rif->update_window_end_hook (w, !paused_p, mouse_face_overwritten_p); | 3545 | gui_update_window_end (w, !paused_p, mouse_face_overwritten_p); |
| 3546 | #endif | ||
| 3543 | } | 3547 | } |
| 3544 | else | 3548 | else |
| 3545 | paused_p = 1; | 3549 | paused_p = 1; |
| @@ -3555,6 +3559,90 @@ update_window (struct window *w, bool force_p) | |||
| 3555 | return paused_p; | 3559 | return paused_p; |
| 3556 | } | 3560 | } |
| 3557 | 3561 | ||
| 3562 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 3563 | |||
| 3564 | /* Start update of window W. */ | ||
| 3565 | |||
| 3566 | void | ||
| 3567 | gui_update_window_begin (struct window *w) | ||
| 3568 | { | ||
| 3569 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | ||
| 3570 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | ||
| 3571 | |||
| 3572 | block_input (); | ||
| 3573 | |||
| 3574 | if (FRAME_RIF (f)->update_window_begin_hook) | ||
| 3575 | FRAME_RIF (f)->update_window_begin_hook (w); | ||
| 3576 | |||
| 3577 | w->output_cursor = w->cursor; | ||
| 3578 | |||
| 3579 | if (f == hlinfo->mouse_face_mouse_frame) | ||
| 3580 | { | ||
| 3581 | /* Don't do highlighting for mouse motion during the update. */ | ||
| 3582 | hlinfo->mouse_face_defer = true; | ||
| 3583 | |||
| 3584 | /* If the frame needs to be redrawn, simply forget about any | ||
| 3585 | prior mouse highlighting. */ | ||
| 3586 | if (FRAME_GARBAGED_P (f)) | ||
| 3587 | hlinfo->mouse_face_window = Qnil; | ||
| 3588 | } | ||
| 3589 | |||
| 3590 | unblock_input (); | ||
| 3591 | } | ||
| 3592 | |||
| 3593 | /* End update of window W. | ||
| 3594 | |||
| 3595 | Draw vertical borders between horizontally adjacent windows, and | ||
| 3596 | display W's cursor if CURSOR_ON_P is non-zero. | ||
| 3597 | |||
| 3598 | MOUSE_FACE_OVERWRITTEN_P non-zero means that some row containing | ||
| 3599 | glyphs in mouse-face were overwritten. In that case we have to | ||
| 3600 | make sure that the mouse-highlight is properly redrawn. */ | ||
| 3601 | void | ||
| 3602 | gui_update_window_end (struct window *w, bool cursor_on_p, | ||
| 3603 | bool mouse_face_overwritten_p) | ||
| 3604 | { | ||
| 3605 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | ||
| 3606 | |||
| 3607 | block_input (); | ||
| 3608 | |||
| 3609 | /* Pseudo windows don't have cursors, so don't display them here. */ | ||
| 3610 | if (!w->pseudo_window_p) | ||
| 3611 | { | ||
| 3612 | |||
| 3613 | if (cursor_on_p) | ||
| 3614 | display_and_set_cursor (w, true, | ||
| 3615 | w->output_cursor.hpos, w->output_cursor.vpos, | ||
| 3616 | w->output_cursor.x, w->output_cursor.y); | ||
| 3617 | |||
| 3618 | if (draw_window_fringes (w, true)) | ||
| 3619 | { | ||
| 3620 | if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) | ||
| 3621 | gui_draw_right_divider (w); | ||
| 3622 | else | ||
| 3623 | gui_draw_vertical_border (w); | ||
| 3624 | } | ||
| 3625 | } | ||
| 3626 | |||
| 3627 | /* If a row with mouse-face was overwritten, arrange for | ||
| 3628 | frame_up_to_date_hook to redisplay the mouse highlight. */ | ||
| 3629 | if (mouse_face_overwritten_p) | ||
| 3630 | { | ||
| 3631 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | ||
| 3632 | |||
| 3633 | hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; | ||
| 3634 | hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; | ||
| 3635 | hlinfo->mouse_face_window = Qnil; | ||
| 3636 | } | ||
| 3637 | |||
| 3638 | if (FRAME_RIF (f)->update_window_end_hook) | ||
| 3639 | FRAME_RIF (f)->update_window_end_hook (w, | ||
| 3640 | cursor_on_p, | ||
| 3641 | mouse_face_overwritten_p); | ||
| 3642 | unblock_input (); | ||
| 3643 | } | ||
| 3644 | |||
| 3645 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3558 | 3646 | ||
| 3559 | /* Update the display of area AREA in window W, row number VPOS. | 3647 | /* Update the display of area AREA in window W, row number VPOS. |
| 3560 | AREA can be either LEFT_MARGIN_AREA or RIGHT_MARGIN_AREA. */ | 3648 | AREA can be either LEFT_MARGIN_AREA or RIGHT_MARGIN_AREA. */ |
diff --git a/src/nsterm.m b/src/nsterm.m index cdf1916e71b..ffb7b7692b4 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -1106,7 +1106,7 @@ static void | |||
| 1106 | ns_update_begin (struct frame *f) | 1106 | ns_update_begin (struct frame *f) |
| 1107 | /* -------------------------------------------------------------------------- | 1107 | /* -------------------------------------------------------------------------- |
| 1108 | Prepare for a grouped sequence of drawing calls | 1108 | Prepare for a grouped sequence of drawing calls |
| 1109 | external (RIF) call; whole frame, called before update_window_begin | 1109 | external (RIF) call; whole frame, called before gui_update_window_begin |
| 1110 | -------------------------------------------------------------------------- */ | 1110 | -------------------------------------------------------------------------- */ |
| 1111 | { | 1111 | { |
| 1112 | #ifdef NS_IMPL_COCOA | 1112 | #ifdef NS_IMPL_COCOA |
| @@ -1129,80 +1129,10 @@ ns_update_begin (struct frame *f) | |||
| 1129 | 1129 | ||
| 1130 | 1130 | ||
| 1131 | static void | 1131 | static void |
| 1132 | ns_update_window_begin (struct window *w) | ||
| 1133 | /* -------------------------------------------------------------------------- | ||
| 1134 | Prepare for a grouped sequence of drawing calls | ||
| 1135 | external (RIF) call; for one window, called after update_begin | ||
| 1136 | -------------------------------------------------------------------------- */ | ||
| 1137 | { | ||
| 1138 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | ||
| 1139 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | ||
| 1140 | |||
| 1141 | NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_window_begin"); | ||
| 1142 | w->output_cursor = w->cursor; | ||
| 1143 | |||
| 1144 | block_input (); | ||
| 1145 | |||
| 1146 | if (f == hlinfo->mouse_face_mouse_frame) | ||
| 1147 | { | ||
| 1148 | /* Don't do highlighting for mouse motion during the update. */ | ||
| 1149 | hlinfo->mouse_face_defer = 1; | ||
| 1150 | |||
| 1151 | /* If the frame needs to be redrawn, | ||
| 1152 | simply forget about any prior mouse highlighting. */ | ||
| 1153 | if (FRAME_GARBAGED_P (f)) | ||
| 1154 | hlinfo->mouse_face_window = Qnil; | ||
| 1155 | |||
| 1156 | /* (further code for mouse faces ifdef'd out in other terms elided) */ | ||
| 1157 | } | ||
| 1158 | |||
| 1159 | unblock_input (); | ||
| 1160 | } | ||
| 1161 | |||
| 1162 | |||
| 1163 | static void | ||
| 1164 | ns_update_window_end (struct window *w, bool cursor_on_p, | ||
| 1165 | bool mouse_face_overwritten_p) | ||
| 1166 | /* -------------------------------------------------------------------------- | ||
| 1167 | Finished a grouped sequence of drawing calls | ||
| 1168 | external (RIF) call; for one window called before update_end | ||
| 1169 | -------------------------------------------------------------------------- */ | ||
| 1170 | { | ||
| 1171 | NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_window_end"); | ||
| 1172 | |||
| 1173 | /* note: this fn is nearly identical in all terms */ | ||
| 1174 | if (!w->pseudo_window_p) | ||
| 1175 | { | ||
| 1176 | block_input (); | ||
| 1177 | |||
| 1178 | if (cursor_on_p) | ||
| 1179 | display_and_set_cursor (w, 1, | ||
| 1180 | w->output_cursor.hpos, w->output_cursor.vpos, | ||
| 1181 | w->output_cursor.x, w->output_cursor.y); | ||
| 1182 | |||
| 1183 | if (draw_window_fringes (w, 1)) | ||
| 1184 | { | ||
| 1185 | if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) | ||
| 1186 | gui_draw_right_divider (w); | ||
| 1187 | else | ||
| 1188 | gui_draw_vertical_border (w); | ||
| 1189 | } | ||
| 1190 | |||
| 1191 | unblock_input (); | ||
| 1192 | } | ||
| 1193 | |||
| 1194 | /* If a row with mouse-face was overwritten, arrange for | ||
| 1195 | frame_up_to_date to redisplay the mouse highlight. */ | ||
| 1196 | if (mouse_face_overwritten_p) | ||
| 1197 | reset_mouse_highlight (MOUSE_HL_INFO (XFRAME (w->frame))); | ||
| 1198 | } | ||
| 1199 | |||
| 1200 | |||
| 1201 | static void | ||
| 1202 | ns_update_end (struct frame *f) | 1132 | ns_update_end (struct frame *f) |
| 1203 | /* -------------------------------------------------------------------------- | 1133 | /* -------------------------------------------------------------------------- |
| 1204 | Finished a grouped sequence of drawing calls | 1134 | Finished a grouped sequence of drawing calls |
| 1205 | external (RIF) call; for whole frame, called after update_window_end | 1135 | external (RIF) call; for whole frame, called after gui_update_window_end |
| 1206 | -------------------------------------------------------------------------- */ | 1136 | -------------------------------------------------------------------------- */ |
| 1207 | { | 1137 | { |
| 1208 | NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_end"); | 1138 | NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_end"); |
| @@ -5166,8 +5096,8 @@ static struct redisplay_interface ns_redisplay_interface = | |||
| 5166 | gui_clear_end_of_line, | 5096 | gui_clear_end_of_line, |
| 5167 | ns_scroll_run, | 5097 | ns_scroll_run, |
| 5168 | ns_after_update_window_line, | 5098 | ns_after_update_window_line, |
| 5169 | ns_update_window_begin, | 5099 | NULL, /* update_window_begin */ |
| 5170 | ns_update_window_end, | 5100 | NULL, /* update_window_end */ |
| 5171 | 0, /* flush_display */ | 5101 | 0, /* flush_display */ |
| 5172 | gui_clear_window_mouse_face, | 5102 | gui_clear_window_mouse_face, |
| 5173 | gui_get_glyph_overhangs, | 5103 | gui_get_glyph_overhangs, |
diff --git a/src/w32term.c b/src/w32term.c index 451dd54dd8a..0abec3d92a7 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -529,7 +529,7 @@ w32_display_pixel_width (struct w32_display_info *dpyinfo) | |||
| 529 | 529 | ||
| 530 | /* Start an update of frame F. This function is installed as a hook | 530 | /* Start an update of frame F. This function is installed as a hook |
| 531 | for update_begin, i.e. it is called when update_begin is called. | 531 | for update_begin, i.e. it is called when update_begin is called. |
| 532 | This function is called prior to calls to w32_update_window_begin | 532 | This function is called prior to calls to gui_update_window_begin |
| 533 | for each window being updated. */ | 533 | for each window being updated. */ |
| 534 | 534 | ||
| 535 | static void | 535 | static void |
| @@ -555,58 +555,12 @@ w32_update_begin (struct frame *f) | |||
| 555 | static void | 555 | static void |
| 556 | w32_update_window_begin (struct window *w) | 556 | w32_update_window_begin (struct window *w) |
| 557 | { | 557 | { |
| 558 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | ||
| 559 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | ||
| 560 | |||
| 561 | /* Hide the system caret during an update. */ | 558 | /* Hide the system caret during an update. */ |
| 562 | if (w32_use_visible_system_caret && w32_system_caret_hwnd) | 559 | if (w32_use_visible_system_caret && w32_system_caret_hwnd) |
| 563 | { | 560 | { |
| 564 | SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0, | 561 | SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0, |
| 565 | 0, 6000, NULL); | 562 | 0, 6000, NULL); |
| 566 | } | 563 | } |
| 567 | |||
| 568 | w->output_cursor = w->cursor; | ||
| 569 | |||
| 570 | block_input (); | ||
| 571 | |||
| 572 | if (f == hlinfo->mouse_face_mouse_frame) | ||
| 573 | { | ||
| 574 | /* Don't do highlighting for mouse motion during the update. */ | ||
| 575 | hlinfo->mouse_face_defer = true; | ||
| 576 | |||
| 577 | /* If F needs to be redrawn, simply forget about any prior mouse | ||
| 578 | highlighting. */ | ||
| 579 | if (FRAME_GARBAGED_P (f)) | ||
| 580 | hlinfo->mouse_face_window = Qnil; | ||
| 581 | |||
| 582 | #if 0 /* Rows in a current matrix containing glyphs in mouse-face have | ||
| 583 | their mouse_face_p flag set, which means that they are always | ||
| 584 | unequal to rows in a desired matrix which never have that | ||
| 585 | flag set. So, rows containing mouse-face glyphs are never | ||
| 586 | scrolled, and we don't have to switch the mouse highlight off | ||
| 587 | here to prevent it from being scrolled. */ | ||
| 588 | |||
| 589 | /* Can we tell that this update does not affect the window | ||
| 590 | where the mouse highlight is? If so, no need to turn off. | ||
| 591 | Likewise, don't do anything if the frame is garbaged; | ||
| 592 | in that case, the frame's current matrix that we would use | ||
| 593 | is all wrong, and we will redisplay that line anyway. */ | ||
| 594 | if (!NILP (hlinfo->mouse_face_window) | ||
| 595 | && w == XWINDOW (hlinfo->mouse_face_window)) | ||
| 596 | { | ||
| 597 | int i; | ||
| 598 | |||
| 599 | for (i = 0; i < w->desired_matrix->nrows; ++i) | ||
| 600 | if (MATRIX_ROW_ENABLED_P (w->desired_matrix, i)) | ||
| 601 | break; | ||
| 602 | |||
| 603 | if (i < w->desired_matrix->nrows) | ||
| 604 | clear_mouse_face (hlinfo); | ||
| 605 | } | ||
| 606 | #endif /* 0 */ | ||
| 607 | } | ||
| 608 | |||
| 609 | unblock_input (); | ||
| 610 | } | 564 | } |
| 611 | 565 | ||
| 612 | /* Draw a vertical window border from (x,y0) to (x,y1) */ | 566 | /* Draw a vertical window border from (x,y0) to (x,y1) */ |
| @@ -694,39 +648,8 @@ w32_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) | |||
| 694 | 648 | ||
| 695 | static void | 649 | static void |
| 696 | w32_update_window_end (struct window *w, bool cursor_on_p, | 650 | w32_update_window_end (struct window *w, bool cursor_on_p, |
| 697 | bool mouse_face_overwritten_p) | 651 | bool mouse_face_overwritten_p) |
| 698 | { | 652 | { |
| 699 | if (!w->pseudo_window_p) | ||
| 700 | { | ||
| 701 | block_input (); | ||
| 702 | |||
| 703 | if (cursor_on_p) | ||
| 704 | display_and_set_cursor (w, true, | ||
| 705 | w->output_cursor.hpos, w->output_cursor.vpos, | ||
| 706 | w->output_cursor.x, w->output_cursor.y); | ||
| 707 | |||
| 708 | if (draw_window_fringes (w, true)) | ||
| 709 | { | ||
| 710 | if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) | ||
| 711 | gui_draw_right_divider (w); | ||
| 712 | else | ||
| 713 | gui_draw_vertical_border (w); | ||
| 714 | } | ||
| 715 | |||
| 716 | unblock_input (); | ||
| 717 | } | ||
| 718 | |||
| 719 | /* If a row with mouse-face was overwritten, arrange for | ||
| 720 | XTframe_up_to_date to redisplay the mouse highlight. */ | ||
| 721 | if (mouse_face_overwritten_p) | ||
| 722 | { | ||
| 723 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); | ||
| 724 | |||
| 725 | hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; | ||
| 726 | hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; | ||
| 727 | hlinfo->mouse_face_window = Qnil; | ||
| 728 | } | ||
| 729 | |||
| 730 | /* Unhide the caret. This won't actually show the cursor, unless it | 653 | /* Unhide the caret. This won't actually show the cursor, unless it |
| 731 | was visible before the corresponding call to HideCaret in | 654 | was visible before the corresponding call to HideCaret in |
| 732 | w32_update_window_begin. */ | 655 | w32_update_window_begin. */ |
| @@ -2859,7 +2782,7 @@ w32_scroll_run (struct window *w, struct run *run) | |||
| 2859 | 2782 | ||
| 2860 | block_input (); | 2783 | block_input (); |
| 2861 | 2784 | ||
| 2862 | /* Cursor off. Will be switched on again in w32_update_window_end. */ | 2785 | /* Cursor off. Will be switched on again in gui_update_window_end. */ |
| 2863 | gui_clear_cursor (w); | 2786 | gui_clear_cursor (w); |
| 2864 | 2787 | ||
| 2865 | { | 2788 | { |
diff --git a/src/xdisp.c b/src/xdisp.c index 95ff8513e30..3bdb8ea1b0f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -18030,12 +18030,14 @@ try_window_reusing_current_matrix (struct window *w) | |||
| 18030 | 18030 | ||
| 18031 | if (run.height > 0 && run.current_y != run.desired_y) | 18031 | if (run.height > 0 && run.current_y != run.desired_y) |
| 18032 | { | 18032 | { |
| 18033 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 18033 | update_begin (f); | 18034 | update_begin (f); |
| 18034 | FRAME_RIF (f)->update_window_begin_hook (w); | 18035 | gui_update_window_begin (w); |
| 18035 | FRAME_RIF (f)->clear_window_mouse_face (w); | 18036 | FRAME_RIF (f)->clear_window_mouse_face (w); |
| 18036 | FRAME_RIF (f)->scroll_run_hook (w, &run); | 18037 | FRAME_RIF (f)->scroll_run_hook (w, &run); |
| 18037 | FRAME_RIF (f)->update_window_end_hook (w, false, false); | 18038 | gui_update_window_end (w, false, false); |
| 18038 | update_end (f); | 18039 | update_end (f); |
| 18040 | #endif | ||
| 18039 | } | 18041 | } |
| 18040 | 18042 | ||
| 18041 | /* Shift current matrix down by nrows_scrolled lines. */ | 18043 | /* Shift current matrix down by nrows_scrolled lines. */ |
| @@ -18194,12 +18196,14 @@ try_window_reusing_current_matrix (struct window *w) | |||
| 18194 | 18196 | ||
| 18195 | if (run.height) | 18197 | if (run.height) |
| 18196 | { | 18198 | { |
| 18199 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 18197 | update_begin (f); | 18200 | update_begin (f); |
| 18198 | FRAME_RIF (f)->update_window_begin_hook (w); | 18201 | gui_update_window_begin (w); |
| 18199 | FRAME_RIF (f)->clear_window_mouse_face (w); | 18202 | FRAME_RIF (f)->clear_window_mouse_face (w); |
| 18200 | FRAME_RIF (f)->scroll_run_hook (w, &run); | 18203 | FRAME_RIF (f)->scroll_run_hook (w, &run); |
| 18201 | FRAME_RIF (f)->update_window_end_hook (w, false, false); | 18204 | gui_update_window_end (w, false, false); |
| 18202 | update_end (f); | 18205 | update_end (f); |
| 18206 | #endif | ||
| 18203 | } | 18207 | } |
| 18204 | 18208 | ||
| 18205 | /* Adjust Y positions of reused rows. */ | 18209 | /* Adjust Y positions of reused rows. */ |
| @@ -19147,10 +19151,12 @@ try_window_id (struct window *w) | |||
| 19147 | 19151 | ||
| 19148 | if (FRAME_WINDOW_P (f)) | 19152 | if (FRAME_WINDOW_P (f)) |
| 19149 | { | 19153 | { |
| 19150 | FRAME_RIF (f)->update_window_begin_hook (w); | 19154 | #ifdef HAVE_WINDOW_SYSTEM |
| 19155 | gui_update_window_begin (w); | ||
| 19151 | FRAME_RIF (f)->clear_window_mouse_face (w); | 19156 | FRAME_RIF (f)->clear_window_mouse_face (w); |
| 19152 | FRAME_RIF (f)->scroll_run_hook (w, &run); | 19157 | FRAME_RIF (f)->scroll_run_hook (w, &run); |
| 19153 | FRAME_RIF (f)->update_window_end_hook (w, false, false); | 19158 | gui_update_window_end (w, false, false); |
| 19159 | #endif | ||
| 19154 | } | 19160 | } |
| 19155 | else | 19161 | else |
| 19156 | { | 19162 | { |
diff --git a/src/xterm.c b/src/xterm.c index dd19b8bde15..26f74cde91d 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -989,7 +989,7 @@ x_set_frame_alpha (struct frame *f) | |||
| 989 | 989 | ||
| 990 | /* Start an update of frame F. This function is installed as a hook | 990 | /* Start an update of frame F. This function is installed as a hook |
| 991 | for update_begin, i.e. it is called when update_begin is called. | 991 | for update_begin, i.e. it is called when update_begin is called. |
| 992 | This function is called prior to calls to x_update_window_begin for | 992 | This function is called prior to calls to gui_update_window_begin for |
| 993 | each window being updated. Currently, there is nothing to do here | 993 | each window being updated. Currently, there is nothing to do here |
| 994 | because all interesting stuff is done on a window basis. */ | 994 | because all interesting stuff is done on a window basis. */ |
| 995 | 995 | ||
| @@ -1033,33 +1033,6 @@ x_update_begin (struct frame *f) | |||
| 1033 | #endif /* USE_CAIRO */ | 1033 | #endif /* USE_CAIRO */ |
| 1034 | } | 1034 | } |
| 1035 | 1035 | ||
| 1036 | /* Start update of window W. */ | ||
| 1037 | |||
| 1038 | static void | ||
| 1039 | x_update_window_begin (struct window *w) | ||
| 1040 | { | ||
| 1041 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | ||
| 1042 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | ||
| 1043 | |||
| 1044 | w->output_cursor = w->cursor; | ||
| 1045 | |||
| 1046 | block_input (); | ||
| 1047 | |||
| 1048 | if (f == hlinfo->mouse_face_mouse_frame) | ||
| 1049 | { | ||
| 1050 | /* Don't do highlighting for mouse motion during the update. */ | ||
| 1051 | hlinfo->mouse_face_defer = true; | ||
| 1052 | |||
| 1053 | /* If F needs to be redrawn, simply forget about any prior mouse | ||
| 1054 | highlighting. */ | ||
| 1055 | if (FRAME_GARBAGED_P (f)) | ||
| 1056 | hlinfo->mouse_face_window = Qnil; | ||
| 1057 | } | ||
| 1058 | |||
| 1059 | unblock_input (); | ||
| 1060 | } | ||
| 1061 | |||
| 1062 | |||
| 1063 | /* Draw a vertical window border from (x,y0) to (x,y1) */ | 1036 | /* Draw a vertical window border from (x,y0) to (x,y1) */ |
| 1064 | 1037 | ||
| 1065 | static void | 1038 | static void |
| @@ -1139,55 +1112,6 @@ x_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) | |||
| 1139 | } | 1112 | } |
| 1140 | } | 1113 | } |
| 1141 | 1114 | ||
| 1142 | /* End update of window W. | ||
| 1143 | |||
| 1144 | Draw vertical borders between horizontally adjacent windows, and | ||
| 1145 | display W's cursor if CURSOR_ON_P is non-zero. | ||
| 1146 | |||
| 1147 | MOUSE_FACE_OVERWRITTEN_P non-zero means that some row containing | ||
| 1148 | glyphs in mouse-face were overwritten. In that case we have to | ||
| 1149 | make sure that the mouse-highlight is properly redrawn. | ||
| 1150 | |||
| 1151 | W may be a menu bar pseudo-window in case we don't have X toolkit | ||
| 1152 | support. Such windows don't have a cursor, so don't display it | ||
| 1153 | here. */ | ||
| 1154 | |||
| 1155 | static void | ||
| 1156 | x_update_window_end (struct window *w, bool cursor_on_p, | ||
| 1157 | bool mouse_face_overwritten_p) | ||
| 1158 | { | ||
| 1159 | if (!w->pseudo_window_p) | ||
| 1160 | { | ||
| 1161 | block_input (); | ||
| 1162 | |||
| 1163 | if (cursor_on_p) | ||
| 1164 | display_and_set_cursor (w, true, | ||
| 1165 | w->output_cursor.hpos, w->output_cursor.vpos, | ||
| 1166 | w->output_cursor.x, w->output_cursor.y); | ||
| 1167 | |||
| 1168 | if (draw_window_fringes (w, true)) | ||
| 1169 | { | ||
| 1170 | if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) | ||
| 1171 | gui_draw_right_divider (w); | ||
| 1172 | else | ||
| 1173 | gui_draw_vertical_border (w); | ||
| 1174 | } | ||
| 1175 | |||
| 1176 | unblock_input (); | ||
| 1177 | } | ||
| 1178 | |||
| 1179 | /* If a row with mouse-face was overwritten, arrange for | ||
| 1180 | XTframe_up_to_date to redisplay the mouse highlight. */ | ||
| 1181 | if (mouse_face_overwritten_p) | ||
| 1182 | { | ||
| 1183 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); | ||
| 1184 | |||
| 1185 | hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; | ||
| 1186 | hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; | ||
| 1187 | hlinfo->mouse_face_window = Qnil; | ||
| 1188 | } | ||
| 1189 | } | ||
| 1190 | |||
| 1191 | /* Show the frame back buffer. If frame is double-buffered, | 1115 | /* Show the frame back buffer. If frame is double-buffered, |
| 1192 | atomically publish to the user's screen graphics updates made since | 1116 | atomically publish to the user's screen graphics updates made since |
| 1193 | the last call to show_back_buffer. */ | 1117 | the last call to show_back_buffer. */ |
| @@ -4306,7 +4230,7 @@ x_scroll_run (struct window *w, struct run *run) | |||
| 4306 | 4230 | ||
| 4307 | block_input (); | 4231 | block_input (); |
| 4308 | 4232 | ||
| 4309 | /* Cursor off. Will be switched on again in x_update_window_end. */ | 4233 | /* Cursor off. Will be switched on again in gui_update_window_end. */ |
| 4310 | gui_clear_cursor (w); | 4234 | gui_clear_cursor (w); |
| 4311 | 4235 | ||
| 4312 | #ifdef USE_CAIRO | 4236 | #ifdef USE_CAIRO |
| @@ -13145,8 +13069,8 @@ static struct redisplay_interface x_redisplay_interface = | |||
| 13145 | gui_clear_end_of_line, | 13069 | gui_clear_end_of_line, |
| 13146 | x_scroll_run, | 13070 | x_scroll_run, |
| 13147 | x_after_update_window_line, | 13071 | x_after_update_window_line, |
| 13148 | x_update_window_begin, | 13072 | NULL, /* update_window_begin */ |
| 13149 | x_update_window_end, | 13073 | NULL, /* update_window_end */ |
| 13150 | x_flip_and_flush, | 13074 | x_flip_and_flush, |
| 13151 | gui_clear_window_mouse_face, | 13075 | gui_clear_window_mouse_face, |
| 13152 | gui_get_glyph_overhangs, | 13076 | gui_get_glyph_overhangs, |