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 /src/xterm.c | |
| 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.
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 84 |
1 files changed, 4 insertions, 80 deletions
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, |