diff options
author | Manuel Giraud <manuel@ledu-giraud.fr> | 2022-11-18 09:24:55 +0100 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-11-19 08:22:45 +0800 |
commit | 409f0430b6a0c138836e5067141bf6b2a7beb6b3 (patch) | |
tree | 82d640332b147300ba19be2565ba4296113d1917 /src/keyboard.c | |
parent | 87fce324c6bd135532958b1ad1496a3da67b7936 (diff) | |
download | emacs-409f0430b6a0c138836e5067141bf6b2a7beb6b3.tar.gz |
Fix click position to menu bar entry with no-toolkit
* src/keyboard.c (make_lispy_event): Use x_y_to_hpos_vpos to
compute correct menu bar position should the menu face change.
* src/xdisp.c (x_y_to_hpos_vpos): Not static anymore.
* src/dispextern.h: Export x_y_to_hpos_vpos.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r-- | src/keyboard.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 069cf0627b2..6ce6ce17f27 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5974,8 +5974,22 @@ make_lispy_event (struct input_event *event) 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. |