#endif
}
+
+/* EXPORT:
+ Return the position and height of the phys cursor in window W.
+ Set w->phys_cursor_width to width of phys cursor.
+*/
+
+int
+get_phys_cursor_geometry (w, row, glyph, heightp)
+ struct window *w;
+ struct glyph_row *row;
+ struct glyph *glyph;
+ int *heightp;
+{
+ struct frame *f = XFRAME (WINDOW_FRAME (w));
+ int x, y, wd, h, h0, y0;
+
+ /* Compute the width of the rectangle to draw. If on a stretch
+ glyph, and `x-stretch-block-cursor' is nil, don't draw a
+ rectangle as wide as the glyph, but use a canonical character
+ width instead. */
+ wd = glyph->pixel_width - 1;
+#ifdef HAVE_NTGUI
+ wd++; /* Why? */
+#endif
+ if (glyph->type == STRETCH_GLYPH
+ && !x_stretch_cursor_p)
+ wd = min (FRAME_COLUMN_WIDTH (f), wd);
+ w->phys_cursor_width = wd;
+
+ y = w->phys_cursor.y + row->ascent - glyph->ascent;
+
+ /* If y is below window bottom, ensure that we still see a cursor. */
+ h0 = min (FRAME_LINE_HEIGHT (f), row->visible_height);
+
+ h = max (h0, glyph->ascent + glyph->descent);
+ h0 = min (h0, glyph->ascent + glyph->descent);
+
+ y0 = WINDOW_HEADER_LINE_HEIGHT (w);
+ if (y < y0)
+ {
+ h = max (h - (y0 - y) + 1, h0);
+ y = y0 - 1;
+ }
+ else
+ {
+ y0 = window_text_bottom_y (w) - h0;
+ if (y > y0)
+ {
+ h += y - y0;
+ y = y0;
+ }
+ }
+
+ *heightp = h - 1;
+ return WINDOW_TO_FRAME_PIXEL_Y (w, y);
+}
+
+
#endif /* HAVE_WINDOW_SYSTEM */
\f