-/* Ensure that the given display line DL accurately represents the
- modeline for the given window. */
-
-static void
-generate_modeline (struct window *w, struct display_line *dl, int type)
-{
- struct buffer *b = XBUFFER (w->buffer);
- struct frame *f = XFRAME (w->frame);
- struct device *d = XDEVICE (f->device);
-
- /* Unlike display line and rune pointers, this one can't change underneath
- our feet. */
- struct display_block *db = get_display_block_from_line (dl, TEXT);
- int max_pixpos, min_pixpos, ypos_adj;
- Lisp_Object font_inst;
-
- /* This will actually determine incorrect inside boundaries for the
- modeline since it ignores the margins. However being aware of this fact
- we never use those values anywhere so it doesn't matter. */
- dl->bounds = calculate_display_line_boundaries (w, 1);
-
- /* We are generating a modeline. */
- dl->modeline = 1;
- dl->cursor_elt = -1;
-
- /* Reset the runes on the modeline. */
- Dynarr_reset (db->runes);
-
- if (!WINDOW_HAS_MODELINE_P (w))
- {
- struct rune rb;
-
- /* If there is a horizontal scrollbar, don't add anything. */
- if (window_scrollbar_height (w))
- return;
-
- dl->ascent = DEVMETH (d, divider_height, ());
- dl->descent = 0;
- /* The modeline is at the bottom of the gutters. */
- dl->ypos = WINDOW_BOTTOM (w);
-
- /* adjust for the bottom gutter */
- if (window_is_lowest (w))
- dl->ypos -= FRAME_BOTTOM_GUTTER_BOUNDS (f);
-
- rb.findex = MODELINE_INDEX;
- rb.xpos = dl->bounds.left_out;
- rb.width = dl->bounds.right_out - dl->bounds.left_out;
- rb.bufpos = 0;
- rb.endpos = 0;
- rb.type = RUNE_HLINE;
- rb.object.hline.thickness = 1;
- rb.object.hline.yoffset = 0;
- rb.cursor_type = NO_CURSOR;
-
- if (!EQ (Qzero, w->modeline_shadow_thickness)
- && FRAME_WIN_P (f))
- {
- int shadow_thickness = MODELINE_SHADOW_THICKNESS (w);
-
- dl->ypos -= shadow_thickness;
- rb.xpos += shadow_thickness;
- rb.width -= 2 * shadow_thickness;
- }
-
- Dynarr_add (db->runes, rb);
- return;
- }
-
- /* !!#### not right; needs to compute the max height of
- all the charsets */
- font_inst = WINDOW_FACE_CACHEL_FONT (w, MODELINE_INDEX, Vcharset_ascii);
-
- dl->ascent = XFONT_INSTANCE (font_inst)->ascent;
- dl->descent = XFONT_INSTANCE (font_inst)->descent;
-
- min_pixpos = dl->bounds.left_out;
- max_pixpos = dl->bounds.right_out;
-
- if (!EQ (Qzero, w->modeline_shadow_thickness) && FRAME_WIN_P (f))
- {
- int shadow_thickness = MODELINE_SHADOW_THICKNESS (w);
-
- ypos_adj = shadow_thickness;
- min_pixpos += shadow_thickness;
- max_pixpos -= shadow_thickness;
- }
- else
- ypos_adj = 0;
-
- generate_formatted_string_db (b->modeline_format,
- b->generated_modeline_string, w, dl, db,
- MODELINE_INDEX, min_pixpos, max_pixpos, type);
-
- /* The modeline is at the bottom of the gutters. We have to wait to
- set this until we've generated the modeline in order to account
- for any embedded faces. */
- dl->ypos = WINDOW_BOTTOM (w) - dl->descent - ypos_adj;
- /* adjust for the bottom gutter */
- if (window_is_lowest (w))
- dl->ypos -= FRAME_BOTTOM_GUTTER_BOUNDS (f);
-}
-
-static void