diff options
| author | Gregory Heytings | 2022-11-24 14:21:30 +0100 |
|---|---|---|
| committer | Gregory Heytings | 2022-11-24 14:21:30 +0100 |
| commit | ba9315b1641b483f2bf843c38dcdba0cd1643a55 (patch) | |
| tree | d119cae86c7386db66be72972d90f6c83215974d /src/keyboard.c | |
| parent | aef803d6c3d61004f15d0bc82fa7bf9952302312 (diff) | |
| parent | a3b654e069e563b0a2a6335ec310ada51400ac09 (diff) | |
| download | emacs-ba9315b1641b483f2bf843c38dcdba0cd1643a55.tar.gz emacs-ba9315b1641b483f2bf843c38dcdba0cd1643a55.zip | |
Merge master into feature/improved-locked-narrowing.
Diffstat (limited to 'src/keyboard.c')
| -rw-r--r-- | src/keyboard.c | 57 |
1 files changed, 52 insertions, 5 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index d8796569cd2..4b35a044eb0 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -503,9 +503,11 @@ echo_add_key (Lisp_Object c) | |||
| 503 | if ((NILP (echo_string) || SCHARS (echo_string) == 0) | 503 | if ((NILP (echo_string) || SCHARS (echo_string) == 0) |
| 504 | && help_char_p (c)) | 504 | && help_char_p (c)) |
| 505 | { | 505 | { |
| 506 | AUTO_STRING (str, " (Type ? for further options)"); | 506 | AUTO_STRING (str, " (Type ? for further options, q for quick help)"); |
| 507 | AUTO_LIST2 (props, Qface, Qhelp_key_binding); | 507 | AUTO_LIST2 (props, Qface, Qhelp_key_binding); |
| 508 | Fadd_text_properties (make_fixnum (7), make_fixnum (8), props, str); | 508 | Fadd_text_properties (make_fixnum (7), make_fixnum (8), props, str); |
| 509 | Fadd_text_properties (make_fixnum (30), make_fixnum (31), props, | ||
| 510 | str); | ||
| 509 | new_string = concat2 (new_string, str); | 511 | new_string = concat2 (new_string, str); |
| 510 | } | 512 | } |
| 511 | 513 | ||
| @@ -5718,6 +5720,29 @@ make_scroll_bar_position (struct input_event *ev, Lisp_Object type) | |||
| 5718 | builtin_lisp_symbol (scroll_bar_parts[ev->part])); | 5720 | builtin_lisp_symbol (scroll_bar_parts[ev->part])); |
| 5719 | } | 5721 | } |
| 5720 | 5722 | ||
| 5723 | #if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR | ||
| 5724 | |||
| 5725 | /* Return whether or not the coordinates X and Y are inside the | ||
| 5726 | box of the menu-bar window of frame F. */ | ||
| 5727 | |||
| 5728 | static bool | ||
| 5729 | coords_in_menu_bar_window (struct frame *f, int x, int y) | ||
| 5730 | { | ||
| 5731 | struct window *window; | ||
| 5732 | |||
| 5733 | if (!WINDOWP (f->menu_bar_window)) | ||
| 5734 | return false; | ||
| 5735 | |||
| 5736 | window = XWINDOW (f->menu_bar_window); | ||
| 5737 | |||
| 5738 | return (y >= WINDOW_TOP_EDGE_Y (window) | ||
| 5739 | && x >= WINDOW_LEFT_EDGE_X (window) | ||
| 5740 | && y <= WINDOW_BOTTOM_EDGE_Y (window) | ||
| 5741 | && x <= WINDOW_RIGHT_EDGE_X (window)); | ||
| 5742 | } | ||
| 5743 | |||
| 5744 | #endif | ||
| 5745 | |||
| 5721 | /* Given a struct input_event, build the lisp event which represents | 5746 | /* Given a struct input_event, build the lisp event which represents |
| 5722 | it. If EVENT is 0, build a mouse movement event from the mouse | 5747 | it. If EVENT is 0, build a mouse movement event from the mouse |
| 5723 | movement buffer, which should have a movement event in it. | 5748 | movement buffer, which should have a movement event in it. |
| @@ -5970,10 +5995,32 @@ make_lispy_event (struct input_event *event) | |||
| 5970 | and ROW are set to frame relative glyph coordinates | 5995 | and ROW are set to frame relative glyph coordinates |
| 5971 | which are then used to determine whether this click is | 5996 | which are then used to determine whether this click is |
| 5972 | in a menu (non-toolkit version). */ | 5997 | in a menu (non-toolkit version). */ |
| 5973 | if (!toolkit_menubar_in_use (f)) | 5998 | if (!toolkit_menubar_in_use (f) |
| 5999 | #if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR | ||
| 6000 | /* Don't process events for menu bars if they are not | ||
| 6001 | in the menu bar window. */ | ||
| 6002 | && (!FRAME_WINDOW_P (f) | ||
| 6003 | || coords_in_menu_bar_window (f, XFIXNUM (event->x), | ||
| 6004 | XFIXNUM (event->y))) | ||
| 6005 | #endif | ||
| 6006 | ) | ||
| 5974 | { | 6007 | { |
| 5975 | pixel_to_glyph_coords (f, XFIXNUM (event->x), XFIXNUM (event->y), | 6008 | #if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR |
| 5976 | &column, &row, NULL, 1); | 6009 | if (FRAME_WINDOW_P (f)) |
| 6010 | { | ||
| 6011 | struct window *menu_w = XWINDOW (f->menu_bar_window); | ||
| 6012 | int x, y, dummy; | ||
| 6013 | |||
| 6014 | x = FRAME_TO_WINDOW_PIXEL_X (menu_w, XFIXNUM (event->x)); | ||
| 6015 | y = FRAME_TO_WINDOW_PIXEL_Y (menu_w, XFIXNUM (event->y)); | ||
| 6016 | |||
| 6017 | x_y_to_hpos_vpos (XWINDOW (f->menu_bar_window), x, y, &column, &row, | ||
| 6018 | NULL, NULL, &dummy); | ||
| 6019 | } | ||
| 6020 | else | ||
| 6021 | #endif | ||
| 6022 | pixel_to_glyph_coords (f, XFIXNUM (event->x), XFIXNUM (event->y), | ||
| 6023 | &column, &row, NULL, 1); | ||
| 5977 | 6024 | ||
| 5978 | /* In the non-toolkit version, clicks on the menu bar | 6025 | /* In the non-toolkit version, clicks on the menu bar |
| 5979 | are ordinary button events in the event buffer. | 6026 | are ordinary button events in the event buffer. |
| @@ -5983,7 +6030,7 @@ make_lispy_event (struct input_event *event) | |||
| 5983 | menu bar and Emacs doesn't know about it until | 6030 | menu bar and Emacs doesn't know about it until |
| 5984 | after the user makes a selection.) */ | 6031 | after the user makes a selection.) */ |
| 5985 | if (row >= 0 && row < FRAME_MENU_BAR_LINES (f) | 6032 | if (row >= 0 && row < FRAME_MENU_BAR_LINES (f) |
| 5986 | && (event->modifiers & down_modifier)) | 6033 | && (event->modifiers & down_modifier)) |
| 5987 | { | 6034 | { |
| 5988 | Lisp_Object items, item; | 6035 | Lisp_Object items, item; |
| 5989 | 6036 | ||