#define CLEAR_FACE_CACHE_COUNT 500
static int clear_face_cache_count;
+/* Similarly for the image cache. */
+
+#ifdef HAVE_WINDOW_SYSTEM
+#define CLEAR_IMAGE_CACHE_COUNT 101
+static int clear_image_cache_count;
+#endif
+
/* Record the previous terminal frame we displayed. */
static struct frame *previous_terminal_frame;
CHARPOS (this_line_start_pos) = 0;
consider_all_windows_p |= buffer_shared > 1;
++clear_face_cache_count;
-
+#ifdef HAVE_WINDOW_SYSTEM
+ ++clear_image_cache_count;
+#endif
/* Build desired matrices, and update the display. If
consider_all_windows_p is non-zero, do it for all windows on all
struct frame **updated
= (struct frame **) alloca (size * sizeof *updated);
- /* Clear the face cache eventually. */
- if (clear_face_cache_count > CLEAR_FACE_CACHE_COUNT)
- {
- clear_face_cache (0);
- clear_face_cache_count = 0;
- }
-
/* Recompute # windows showing selected buffer. This will be
incremented each time such a window is displayed. */
buffer_shared = 0;
variables. */
select_frame_for_redisplay (frame);
-#ifdef HAVE_WINDOW_SYSTEM
- if (clear_face_cache_count % 50 == 0
- && FRAME_WINDOW_P (f))
- clear_image_cache (f, 0);
-#endif /* HAVE_WINDOW_SYSTEM */
-
/* Mark all the scroll bars to be removed; we'll redeem
the ones we want when we redisplay their windows. */
if (condemn_scroll_bars_hook)
if (windows_or_buffers_changed && !pause)
goto retry;
+ /* Clear the face cache eventually. */
+ if (consider_all_windows_p)
+ {
+ if (clear_face_cache_count > CLEAR_FACE_CACHE_COUNT)
+ {
+ clear_face_cache (0);
+ clear_face_cache_count = 0;
+ }
+#ifdef HAVE_WINDOW_SYSTEM
+ if (clear_image_cache_count > CLEAR_IMAGE_CACHE_COUNT)
+ {
+ Lisp_Object tail, frame;
+ FOR_EACH_FRAME (tail, frame)
+ {
+ struct frame *f = XFRAME (frame);
+ if (FRAME_WINDOW_P (f))
+ clear_image_cache (f, 0);
+ }
+ clear_image_cache_count = 0;
+ }
+#endif /* HAVE_WINDOW_SYSTEM */
+ }
+
end_of_redisplay:
unbind_to (count, Qnil);
RESUME_POLLING;