summaryrefslogtreecommitdiff
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorGregory Heytings <gregory@heytings.org>2022-11-24 14:21:30 +0100
committerGregory Heytings <gregory@heytings.org>2022-11-24 14:21:30 +0100
commitba9315b1641b483f2bf843c38dcdba0cd1643a55 (patch)
treed119cae86c7386db66be72972d90f6c83215974d /src/keyboard.c
parentaef803d6c3d61004f15d0bc82fa7bf9952302312 (diff)
parenta3b654e069e563b0a2a6335ec310ada51400ac09 (diff)
downloademacs-ba9315b1641b483f2bf843c38dcdba0cd1643a55.tar.gz
Merge master into feature/improved-locked-narrowing.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c57
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)
if ((NILP (echo_string) || SCHARS (echo_string) == 0)
&& help_char_p (c))
{
- AUTO_STRING (str, " (Type ? for further options)");
+ AUTO_STRING (str, " (Type ? for further options, q for quick help)");
AUTO_LIST2 (props, Qface, Qhelp_key_binding);
Fadd_text_properties (make_fixnum (7), make_fixnum (8), props, str);
+ Fadd_text_properties (make_fixnum (30), make_fixnum (31), props,
+str);
new_string = concat2 (new_string, str);
}
@@ -5718,6 +5720,29 @@ make_scroll_bar_position (struct input_event *ev, Lisp_Object type)
builtin_lisp_symbol (scroll_bar_parts[ev->part]));
}
+#if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR
+
+/* Return whether or not the coordinates X and Y are inside the
+ box of the menu-bar window of frame F. */
+
+static bool
+coords_in_menu_bar_window (struct frame *f, int x, int y)
+{
+ struct window *window;
+
+ if (!WINDOWP (f->menu_bar_window))
+ return false;
+
+ window = XWINDOW (f->menu_bar_window);
+
+ return (y >= WINDOW_TOP_EDGE_Y (window)
+ && x >= WINDOW_LEFT_EDGE_X (window)
+ && y <= WINDOW_BOTTOM_EDGE_Y (window)
+ && x <= WINDOW_RIGHT_EDGE_X (window));
+}
+
+#endif
+
/* Given a struct input_event, build the lisp event which represents
it. If EVENT is 0, build a mouse movement event from the mouse
movement buffer, which should have a movement event in it.
@@ -5970,10 +5995,32 @@ make_lispy_event (struct input_event *event)
and ROW are set to frame relative glyph coordinates
which are then used to determine whether this click is
in a menu (non-toolkit version). */
- if (!toolkit_menubar_in_use (f))
+ if (!toolkit_menubar_in_use (f)
+#if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR
+ /* Don't process events for menu bars if they are not
+ in the menu bar window. */
+ && (!FRAME_WINDOW_P (f)
+ || coords_in_menu_bar_window (f, XFIXNUM (event->x),
+ XFIXNUM (event->y)))
+#endif
+ )
{
- pixel_to_glyph_coords (f, XFIXNUM (event->x), XFIXNUM (event->y),
- &column, &row, NULL, 1);
+#if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR
+ 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.
@@ -5983,7 +6030,7 @@ make_lispy_event (struct input_event *event)
menu bar and Emacs doesn't know about it until
after the user makes a selection.) */
if (row >= 0 && row < FRAME_MENU_BAR_LINES (f)
- && (event->modifiers & down_modifier))
+ && (event->modifiers & down_modifier))
{
Lisp_Object items, item;