extern void tty_draw_row_with_mouse_face (struct window *, struct glyph_row *,
int, int, enum draw_glyphs_face);
extern void display_tty_menu_item (const char *, int, int, int, int, bool);
-
+extern struct glyph *x_y_to_hpos_vpos (struct window *, int, int, int *, int *,
+ int *, int *, int *);
/* Flags passed to try_window. */
#define TRY_WINDOW_CHECK_MARGINS (1 << 0)
#define TRY_WINDOW_IGNORE_FONTS_CHANGE (1 << 1)
in a menu (non-toolkit version). */
if (!toolkit_menubar_in_use (f))
{
- pixel_to_glyph_coords (f, XFIXNUM (event->x), XFIXNUM (event->y),
- &column, &row, NULL, 1);
+#if defined HAVE_WINDOW_SYSTEM
+ if (FRAME_WINDOW_P (f))
+ {
+ struct window *menu_w = XWINDOW (f->menu_bar_window);
+ int x, y, dummy;
+
+ x = FRAME_TO_WINDOW_PIXEL_X (menu_w, XFIXNUM (event->x));
+ y = FRAME_TO_WINDOW_PIXEL_Y (menu_w, XFIXNUM (event->y));
+
+ x_y_to_hpos_vpos (XWINDOW (f->menu_bar_window), x, y, &column, &row,
+ NULL, NULL, &dummy);
+ }
+ else
+#endif
+ pixel_to_glyph_coords (f, XFIXNUM (event->x), XFIXNUM (event->y),
+ &column, &row, NULL, 1);
/* In the non-toolkit version, clicks on the menu bar
are ordinary button events in the event buffer.
text, or we can't tell because W's current matrix is not up to
date. */
-static struct glyph *
+struct glyph *
x_y_to_hpos_vpos (struct window *w, int x, int y, int *hpos, int *vpos,
int *dx, int *dy, int *area)
{