aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 05e2e50e11d..841859bc0d4 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1907,6 +1907,9 @@ make_ctrl_char (c)
1907 arguments; the function should return a help string or nil for 1907 arguments; the function should return a help string or nil for
1908 none. For all other types of HELP evaluate it to obtain a string. 1908 none. For all other types of HELP evaluate it to obtain a string.
1909 1909
1910 WINDOW is the window in which the help was generated, if any.
1911 It is nil if not in a window.
1912
1910 OBJECT is the object where a `help-echo' property was found; POS 1913 OBJECT is the object where a `help-echo' property was found; POS
1911 is the position within OBJECT where it was found. OBJECT is nil 1914 is the position within OBJECT where it was found. OBJECT is nil
1912 if HELP isn't from a `help-echo' text property. 1915 if HELP isn't from a `help-echo' text property.
@@ -1919,19 +1922,20 @@ make_ctrl_char (c)
1919 from X code running asynchronously. */ 1922 from X code running asynchronously. */
1920 1923
1921void 1924void
1922show_help_echo (help, object, pos, ok_to_overwrite_keystroke_echo) 1925show_help_echo (help, window, object, pos, ok_to_overwrite_keystroke_echo)
1923 Lisp_Object help, object, pos; 1926 Lisp_Object help, window, object, pos;
1924 int ok_to_overwrite_keystroke_echo; 1927 int ok_to_overwrite_keystroke_echo;
1925{ 1928{
1926 if (!NILP (help) && !STRINGP (help)) 1929 if (!NILP (help) && !STRINGP (help))
1927 { 1930 {
1928 if (FUNCTIONP (help)) 1931 if (FUNCTIONP (help))
1929 { 1932 {
1930 Lisp_Object args[3]; 1933 Lisp_Object args[4];
1931 args[0] = help; 1934 args[0] = help;
1932 args[1] = object; 1935 args[1] = window;
1933 args[2] = pos; 1936 args[2] = object;
1934 help = call_function (3, args); 1937 args[3] = pos;
1938 help = call_function (4, args);
1935 } 1939 }
1936 else 1940 else
1937 help = eval_form (help); 1941 help = eval_form (help);
@@ -2710,12 +2714,13 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2710 /* Display help if not echoing. */ 2714 /* Display help if not echoing. */
2711 if (CONSP (c) && EQ (XCAR (c), Qhelp_echo)) 2715 if (CONSP (c) && EQ (XCAR (c), Qhelp_echo))
2712 { 2716 {
2713 /* (help-echo FRAME HELP OBJECT POS). */ 2717 /* (help-echo FRAME HELP WINDOW OBJECT POS). */
2714 Lisp_Object help, object, position; 2718 Lisp_Object help, object, position, window;
2715 help = Fnth (make_number (2), c); 2719 help = Fnth (make_number (2), c);
2716 object = Fnth (make_number (3), c); 2720 window = Fnth (make_number (3), c);
2717 position = Fnth (make_number (4), c); 2721 object = Fnth (make_number (4), c);
2718 show_help_echo (help, object, position, 0); 2722 position = Fnth (make_number (5), c);
2723 show_help_echo (help, window, object, position, 0);
2719 goto retry; 2724 goto retry;
2720 } 2725 }
2721 2726
@@ -3174,9 +3179,9 @@ kbd_buffer_store_event (event)
3174 Value is the number of input_events generated. */ 3179 Value is the number of input_events generated. */
3175 3180
3176int 3181int
3177gen_help_event (bufp, help, frame, object, pos) 3182gen_help_event (bufp, help, frame, window, object, pos)
3178 struct input_event *bufp; 3183 struct input_event *bufp;
3179 Lisp_Object help, frame, object; 3184 Lisp_Object help, frame, object, window;
3180 int pos; 3185 int pos;
3181{ 3186{
3182 bufp->kind = HELP_EVENT; 3187 bufp->kind = HELP_EVENT;
@@ -3187,10 +3192,10 @@ gen_help_event (bufp, help, frame, object, pos)
3187 3192
3188 ++bufp; 3193 ++bufp;
3189 bufp->kind = HELP_EVENT; 3194 bufp->kind = HELP_EVENT;
3190 bufp->frame_or_window = frame; 3195 bufp->frame_or_window = WINDOWP (window) ? window : frame;
3191 bufp->arg = help; 3196 bufp->arg = help;
3192 bufp->code = 1; 3197 bufp->code = 1;
3193 3198
3194 return 2; 3199 return 2;
3195} 3200}
3196 3201
@@ -3440,7 +3445,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
3440 { 3445 {
3441 /* There are always two consecutive HELP_EVENTs in the 3446 /* There are always two consecutive HELP_EVENTs in the
3442 input queue. */ 3447 input queue. */
3443 Lisp_Object object, position, help, frame; 3448 Lisp_Object object, position, help, frame, window;
3444 3449
3445 xassert (event->code == 0); 3450 xassert (event->code == 0);
3446 frame = event->frame_or_window; 3451 frame = event->frame_or_window;
@@ -3448,10 +3453,11 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
3448 position = event->x; 3453 position = event->x;
3449 xassert ((event + 1)->code == 1); 3454 xassert ((event + 1)->code == 1);
3450 help = (event + 1)->arg; 3455 help = (event + 1)->arg;
3451 3456 window = (event + 1)->frame_or_window;
3452 /* Event->frame_or_window is a frame, event->arg is the 3457 if (!WINDOWP (window))
3453 help to display. */ 3458 window = Qnil;
3454 obj = list5 (Qhelp_echo, frame, help, object, position); 3459 obj = Fcons (Qhelp_echo,
3460 list5 (frame, help, window, object, position));
3455 kbd_fetch_ptr = event + 2; 3461 kbd_fetch_ptr = event + 2;
3456 } 3462 }
3457 else if (event->kind == FOCUS_IN_EVENT) 3463 else if (event->kind == FOCUS_IN_EVENT)