-/* Given HPOS/VPOS in the current matrix of W, return corresponding
- frame-relative pixel positions in *FRAME_X and *FRAME_Y. If we
- can't tell the positions because W's display is not up to date,
- return 0. */
-
-int
-glyph_to_pixel_coords (struct window *w, int hpos, int vpos,
- int *frame_x, int *frame_y)
-{
-#ifdef HAVE_WINDOW_SYSTEM
- if (FRAME_WINDOW_P (XFRAME (WINDOW_FRAME (w))))
- {
- int success_p;
-
- xassert (hpos >= 0 && hpos < w->current_matrix->matrix_w);
- xassert (vpos >= 0 && vpos < w->current_matrix->matrix_h);
-
- if (display_completed)
- {
- struct glyph_row *row = MATRIX_ROW (w->current_matrix, vpos);
- struct glyph *glyph = row->glyphs[TEXT_AREA];
- struct glyph *end = glyph + min (hpos, row->used[TEXT_AREA]);
-
- hpos = row->x;
- vpos = row->y;
- while (glyph < end)
- {
- hpos += glyph->pixel_width;
- ++glyph;
- }
-
- /* If first glyph is partially visible, its first visible position is still 0. */
- if (hpos < 0)
- hpos = 0;
-
- success_p = 1;
- }
- else
- {
- hpos = vpos = 0;
- success_p = 0;
- }
-
- *frame_x = WINDOW_TO_FRAME_PIXEL_X (w, hpos);
- *frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, vpos);
- return success_p;
- }
-#endif
-
- *frame_x = hpos;
- *frame_y = vpos;
- return 1;
-}
-
-