comparison src/redisplay-output.c @ 408:501cfd01ee6d r21-2-34

Import from CVS: tag r21-2-34
author cvs
date Mon, 13 Aug 2007 11:18:11 +0200
parents b8cc9ab3f761
children 697ef44129c6
comparison
equal deleted inserted replaced
407:ed6218a7d4d3 408:501cfd01ee6d
248 Lisp_Object window, image; 248 Lisp_Object window, image;
249 Lisp_Image_Instance* ii; 249 Lisp_Image_Instance* ii;
250 XSETWINDOW (window, w); 250 XSETWINDOW (window, w);
251 image = glyph_image_instance (crb->object.dglyph.glyph, 251 image = glyph_image_instance (crb->object.dglyph.glyph,
252 window, ERROR_ME_NOT, 1); 252 window, ERROR_ME_NOT, 1);
253
254 if (!IMAGE_INSTANCEP (image))
255 return 0;
253 ii = XIMAGE_INSTANCE (image); 256 ii = XIMAGE_INSTANCE (image);
254 257
255 if (TEXT_IMAGE_INSTANCEP (image) && 258 if (TEXT_IMAGE_INSTANCEP (image) &&
256 (crb->findex != drb->findex || 259 (crb->findex != drb->findex ||
257 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))) 260 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)))
279 of this are.*/ 282 of this are.*/
280 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (ii) = 1; 283 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (ii) = 1;
281 return 0; 284 return 0;
282 } 285 }
283 else 286 else
284 { 287 return 1;
285 #ifdef DEBUG_WIDGET_OUTPUT
286 if (XIMAGE_INSTANCE_TYPE (image) == IMAGE_LAYOUT)
287 printf ("glyph layout %p considered unchanged\n", ii);
288 #endif
289 return 1;
290 }
291 } 288 }
292 /* We now do this last so that glyph checks can do their own thing 289 /* We now do this last so that glyph checks can do their own thing
293 for face changes. Face changes quite often happen when we are 290 for face changes. Face changes quite often happen when we are
294 trying to output something in the gutter, this would normally 291 trying to output something in the gutter, this would normally
295 lead to a lot of flashing. The indices can quite often be 292 lead to a lot of flashing. The indices can quite often be
899 dl->cursor_elt = x; 896 dl->cursor_elt = x;
900 return 1; 897 return 1;
901 } 898 }
902 else 899 else
903 { 900 {
904 DEVMETH (d, output_begin, (d)); 901 {
902 MAYBE_DEVMETH (d, frame_output_begin, (f));
903 MAYBE_DEVMETH (d, window_output_begin, (w));
904 }
905 rb->cursor_type = CURSOR_OFF; 905 rb->cursor_type = CURSOR_OFF;
906 dl->cursor_elt = -1; 906 dl->cursor_elt = -1;
907 output_display_line (w, 0, cla, y, rb->xpos, rb->xpos + rb->width); 907 output_display_line (w, 0, cla, y, rb->xpos, rb->xpos + rb->width);
908 } 908 }
909 909
914 /* If this isn't the selected frame, then erasing the old cursor is 914 /* If this isn't the selected frame, then erasing the old cursor is
915 all we actually had to do. */ 915 all we actually had to do. */
916 if (w != XWINDOW (FRAME_SELECTED_WINDOW (device_selected_frame (d)))) 916 if (w != XWINDOW (FRAME_SELECTED_WINDOW (device_selected_frame (d))))
917 { 917 {
918 if (!no_output_end) 918 if (!no_output_end)
919 DEVMETH (d, output_end, (d)); 919 {
920 MAYBE_DEVMETH (d, window_output_end, (w));
921 MAYBE_DEVMETH (d, frame_output_end, (f));
922 }
920 923
921 return 1; 924 return 1;
922 } 925 }
923 926
924 /* This should only occur in the minibuffer. */ 927 /* This should only occur in the minibuffer. */
933 dl->cursor_elt = 0; 936 dl->cursor_elt = 0;
934 937
935 output_display_line (w, 0, cla, y, rb->xpos, rb->xpos + rb->width); 938 output_display_line (w, 0, cla, y, rb->xpos, rb->xpos + rb->width);
936 939
937 if (!no_output_end) 940 if (!no_output_end)
938 DEVMETH (d, output_end, (d)); 941 {
942 MAYBE_DEVMETH (d, window_output_end, (w));
943 MAYBE_DEVMETH (d, frame_output_end, (f));
944 }
939 return 1; 945 return 1;
940 } 946 }
941 else 947 else
942 { 948 {
943 int cur_rb = 0; 949 int cur_rb = 0;
997 w->last_point_y[CURRENT_DISP] = cur_dl; 1003 w->last_point_y[CURRENT_DISP] = cur_dl;
998 Fset_marker (w->last_point[CURRENT_DISP], 1004 Fset_marker (w->last_point[CURRENT_DISP],
999 make_int (ADJ_BUFPOS), w->buffer); 1005 make_int (ADJ_BUFPOS), w->buffer);
1000 1006
1001 if (!no_output_end) 1007 if (!no_output_end)
1002 DEVMETH (d, output_end, (d)); 1008 {
1009 MAYBE_DEVMETH (d, window_output_end, (w));
1010 MAYBE_DEVMETH (d, frame_output_end, (f));
1011 }
1003 return 1; 1012 return 1;
1004 } 1013 }
1005 1014
1006 (up ? cur_rb++ : cur_rb--); 1015 (up ? cur_rb++ : cur_rb--);
1007 } 1016 }
1010 (up ? cur_dl++ : cur_dl--); 1019 (up ? cur_dl++ : cur_dl--);
1011 } 1020 }
1012 } 1021 }
1013 1022
1014 if (!no_output_end) 1023 if (!no_output_end)
1015 DEVMETH (d, output_end, (d)); 1024 {
1025 MAYBE_DEVMETH (d, window_output_end, (w));
1026 MAYBE_DEVMETH (d, frame_output_end, (f));
1027 }
1016 return 0; 1028 return 0;
1017 } 1029 }
1018 #undef ADJ_BUFPOS 1030 #undef ADJ_BUFPOS
1019 #undef ADJ_ENDPOS 1031 #undef ADJ_ENDPOS
1020 1032
1065 { 1077 {
1066 MAYBE_DEVMETH (d, set_final_cursor_coords, 1078 MAYBE_DEVMETH (d, set_final_cursor_coords,
1067 (f, dl->ypos - 1, rb->xpos)); 1079 (f, dl->ypos - 1, rb->xpos));
1068 1080
1069 if (run_end_begin_meths) 1081 if (run_end_begin_meths)
1070 DEVMETH (d, output_begin, (d)); 1082 {
1083 MAYBE_DEVMETH (d, frame_output_begin, (f));
1084 MAYBE_DEVMETH (d, window_output_begin, (w));
1085 }
1071 1086
1072 output_display_line (w, 0, dla, y, rb->xpos, rb->xpos + rb->width); 1087 output_display_line (w, 0, dla, y, rb->xpos, rb->xpos + rb->width);
1073 1088
1074 if (run_end_begin_meths) 1089 if (run_end_begin_meths)
1075 DEVMETH (d, output_end, (d)); 1090 {
1091 MAYBE_DEVMETH (d, window_output_end, (w));
1092 MAYBE_DEVMETH (d, frame_output_end, (f));
1093 }
1076 } 1094 }
1077 } 1095 }
1078 1096
1079 /***************************************************************************** 1097 /*****************************************************************************
1080 redisplay_redraw_cursor 1098 redisplay_redraw_cursor
1144 parameters. 1162 parameters.
1145 ****************************************************************************/ 1163 ****************************************************************************/
1146 static void redisplay_unmap_subwindows (struct frame* f, int x, int y, int width, int height, 1164 static void redisplay_unmap_subwindows (struct frame* f, int x, int y, int width, int height,
1147 Lisp_Object ignored_window) 1165 Lisp_Object ignored_window)
1148 { 1166 {
1149 int elt; 1167 Lisp_Object rest;
1150 1168
1151 for (elt = 0; elt < Dynarr_length (f->subwindow_cachels); elt++) 1169 LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))
1152 { 1170 {
1153 struct subwindow_cachel *cachel = 1171 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (XCAR (rest));
1154 Dynarr_atp (f->subwindow_cachels, elt); 1172
1155 1173 if (IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii)
1156 if (cachel->being_displayed
1157 && 1174 &&
1158 cachel->x + cachel->width > x && cachel->x < x + width 1175 IMAGE_INSTANCE_DISPLAY_X (ii)
1176 + IMAGE_INSTANCE_DISPLAY_WIDTH (ii) > x
1177 &&
1178 IMAGE_INSTANCE_DISPLAY_X (ii) < x + width
1159 && 1179 &&
1160 cachel->y + cachel->height > y && cachel->y < y + height 1180 IMAGE_INSTANCE_DISPLAY_Y (ii)
1181 + IMAGE_INSTANCE_DISPLAY_HEIGHT (ii) > y
1182 &&
1183 IMAGE_INSTANCE_DISPLAY_Y (ii) < y + height
1161 && 1184 &&
1162 !EQ (cachel->subwindow, ignored_window)) 1185 !EQ (XCAR (rest), ignored_window))
1163 { 1186 {
1164 unmap_subwindow (cachel->subwindow); 1187 unmap_subwindow (XCAR (rest));
1165 } 1188 }
1166 } 1189 }
1167 } 1190 }
1168 1191
1169 /**************************************************************************** 1192 /****************************************************************************
1172 Potentially subwindows from the area in the box defined by the given 1195 Potentially subwindows from the area in the box defined by the given
1173 parameters. 1196 parameters.
1174 ****************************************************************************/ 1197 ****************************************************************************/
1175 void redisplay_unmap_subwindows_maybe (struct frame* f, int x, int y, int width, int height) 1198 void redisplay_unmap_subwindows_maybe (struct frame* f, int x, int y, int width, int height)
1176 { 1199 {
1177 if (Dynarr_length (FRAME_SUBWINDOW_CACHE (f))) 1200 if (!NILP (XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))))
1178 { 1201 {
1179 redisplay_unmap_subwindows (f, x, y, width, height, Qnil); 1202 redisplay_unmap_subwindows (f, x, y, width, height, Qnil);
1180 } 1203 }
1181 } 1204 }
1182 1205
1183 static void redisplay_unmap_subwindows_except_us (struct frame* f, int x, int y, int width, 1206 static void redisplay_unmap_subwindows_except_us (struct frame* f, int x, int y, int width,
1184 int height, Lisp_Object subwindow) 1207 int height, Lisp_Object subwindow)
1185 { 1208 {
1186 if (Dynarr_length (FRAME_SUBWINDOW_CACHE (f))) 1209 if (!NILP (XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))))
1187 { 1210 {
1188 redisplay_unmap_subwindows (f, x, y, width, height, subwindow); 1211 redisplay_unmap_subwindows (f, x, y, width, height, subwindow);
1189 } 1212 }
1190 } 1213 }
1191 1214
1464 redisplay_output_pixmap (w, child, &cdb, &cdga, findex, 1487 redisplay_output_pixmap (w, child, &cdb, &cdga, findex,
1465 0, 0, 0, 0); 1488 0, 0, 0, 0);
1466 break; 1489 break;
1467 1490
1468 case IMAGE_WIDGET: 1491 case IMAGE_WIDGET:
1492 if (EQ (IMAGE_INSTANCE_WIDGET_TYPE (childii), Qlayout))
1493 {
1494 redisplay_output_layout (w, child, &cdb, &cdga, findex,
1495 0, 0, 0);
1496 break;
1497 }
1469 case IMAGE_SUBWINDOW: 1498 case IMAGE_SUBWINDOW:
1470 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) || 1499 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) ||
1471 IMAGE_INSTANCE_DIRTYP (childii)) 1500 IMAGE_INSTANCE_DIRTYP (childii))
1472 redisplay_output_subwindow (w, child, &cdb, &cdga, findex, 1501 redisplay_output_subwindow (w, child, &cdb, &cdga, findex,
1473 0, 0, 0); 1502 0, 0, 0);
1474 break;
1475
1476 case IMAGE_LAYOUT:
1477 redisplay_output_layout (w, child, &cdb, &cdga, findex,
1478 0, 0, 0);
1479 break; 1503 break;
1480 1504
1481 case IMAGE_NOTHING: 1505 case IMAGE_NOTHING:
1482 /* nothing is as nothing does */ 1506 /* nothing is as nothing does */
1483 break; 1507 break;
2035 struct device *d = XDEVICE (f->device); 2059 struct device *d = XDEVICE (f->device);
2036 2060
2037 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP); 2061 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
2038 display_line_dynarr *ddla = window_display_lines (w, DESIRED_DISP); 2062 display_line_dynarr *ddla = window_display_lines (w, DESIRED_DISP);
2039 2063
2040 DEVMETH (d, output_begin, (d)); 2064 MAYBE_DEVMETH (d, window_output_begin, (w));
2041 2065
2042 while (first_line <= last_line) 2066 while (first_line <= last_line)
2043 { 2067 {
2044 Charcount old_len = (Dynarr_atp (cdla, first_line)->end_bufpos - 2068 Charcount old_len = (Dynarr_atp (cdla, first_line)->end_bufpos -
2045 Dynarr_atp (cdla, first_line)->bufpos); 2069 Dynarr_atp (cdla, first_line)->bufpos);
2120 update_window_scrollbars (w, NULL, 1, stupid_vertical_scrollbar_drag_hack); 2144 update_window_scrollbars (w, NULL, 1, stupid_vertical_scrollbar_drag_hack);
2121 stupid_vertical_scrollbar_drag_hack = 1; 2145 stupid_vertical_scrollbar_drag_hack = 1;
2122 } 2146 }
2123 #endif 2147 #endif
2124 2148
2125 /* This has to be done after we've updated the values. We don't 2149 redisplay_redraw_cursor (f, 0);
2126 call output_end for tty frames. Redisplay will do this after all 2150 MAYBE_DEVMETH (d, window_output_end, (w));
2127 tty windows have been updated. This cuts down on cursor
2128 flicker. */
2129 if (FRAME_TTY_P (f))
2130 redisplay_redraw_cursor (f, 0);
2131 else
2132 DEVMETH (d, output_end, (d));
2133 } 2151 }
2134 2152
2135 /***************************************************************************** 2153 /*****************************************************************************
2136 redisplay_output_window 2154 redisplay_output_window
2137 2155
2241 } 2259 }
2242 } 2260 }
2243 } 2261 }
2244 2262
2245 /* Perform any output initialization. */ 2263 /* Perform any output initialization. */
2246 DEVMETH (d, output_begin, (d)); 2264 MAYBE_DEVMETH (d, window_output_begin, (w));
2247 2265
2248 /* If the window's structure has changed clear the internal border 2266 /* If the window's structure has changed clear the internal border
2249 above it if it is topmost (the function will check). */ 2267 above it if it is topmost (the function will check). */
2250 if (f->windows_structure_changed) 2268 if (f->windows_structure_changed)
2251 redisplay_clear_top_of_window (w); 2269 redisplay_clear_top_of_window (w);
2264 2282
2265 /* Output a vertical divider between windows, if necessary. */ 2283 /* Output a vertical divider between windows, if necessary. */
2266 if (window_needs_vertical_divider (w) 2284 if (window_needs_vertical_divider (w)
2267 && (f->windows_structure_changed || f->clear)) 2285 && (f->windows_structure_changed || f->clear))
2268 { 2286 {
2269 DEVMETH (d, output_vertical_divider, (w, f->windows_structure_changed)); 2287 MAYBE_DEVMETH (d, output_vertical_divider, (w, f->windows_structure_changed));
2270 } 2288 }
2271 2289
2272 /* Clear the rest of the window, if necessary. */ 2290 /* Clear the rest of the window, if necessary. */
2273 if (need_to_clear_bottom) 2291 if (need_to_clear_bottom)
2274 { 2292 {
2298 2316
2299 /* Overkill on invalidating the cache. It is very bad for it to not 2317 /* Overkill on invalidating the cache. It is very bad for it to not
2300 get invalidated when it should be. */ 2318 get invalidated when it should be. */
2301 INVALIDATE_DEVICE_PIXEL_TO_GLYPH_CACHE (d); 2319 INVALIDATE_DEVICE_PIXEL_TO_GLYPH_CACHE (d);
2302 2320
2303 /* We don't call output_end for tty frames. Redisplay will do this 2321 redisplay_redraw_cursor (f, 0);
2304 after all tty windows have been updated. This cuts down on 2322 MAYBE_DEVMETH (d, window_output_end, (w));
2305 cursor flicker. */
2306 if (FRAME_TTY_P (f))
2307 redisplay_redraw_cursor (f, 0);
2308 else
2309 DEVMETH (d, output_end, (d));
2310 2323
2311 #ifdef HAVE_SCROLLBARS 2324 #ifdef HAVE_SCROLLBARS
2312 update_window_scrollbars (w, NULL, !MINI_WINDOW_P (w), 0); 2325 update_window_scrollbars (w, NULL, !MINI_WINDOW_P (w), 0);
2313 #endif 2326 #endif
2314 } 2327 }