-static int glyph_rect P_ ((struct frame *f, int, int, XRectangle *));
-
-
-/* Try to determine frame pixel position and size of the glyph under
- frame pixel coordinates X/Y on frame F . Return the position and
- size in *RECT. Value is non-zero if we could compute these
- values. */
-
-static int
-glyph_rect (f, x, y, rect)
- struct frame *f;
- int x, y;
- XRectangle *rect;
-{
- Lisp_Object window;
- struct window *w;
- struct glyph_row *r, *end_row;
-
- window = window_from_coordinates (f, x, y, 0, &x, &y, 0);
- if (NILP (window))
- return 0;
-
- w = XWINDOW (window);
- r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
- end_row = r + w->current_matrix->nrows - 1;
-
- for (; r < end_row && r->enabled_p; ++r)
- {
- if (r->y >= y)
- {
- struct glyph *g = r->glyphs[TEXT_AREA];
- struct glyph *end = g + r->used[TEXT_AREA];
- int gx = r->x;
- while (g < end && gx < x)
- gx += g->pixel_width, ++g;
- if (g < end)
- {
- rect->width = g->pixel_width;
- rect->height = r->height;
- rect->x = WINDOW_TO_FRAME_PIXEL_X (w, gx);
- rect->y = WINDOW_TO_FRAME_PIXEL_Y (w, r->y);
- return 1;
- }
- break;
- }
- }
-
- return 0;
-}
-