diff options
| author | Gerd Moellmann | 2000-07-14 13:56:09 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-07-14 13:56:09 +0000 |
| commit | be01051469d7f14895eb388f6eabe3894d8ed75a (patch) | |
| tree | 4ec2908f51f571da3721b793ed5c1a932bcce77c /src | |
| parent | 35ff954adbee79c75bfced64d71c004a2eb36350 (diff) | |
| download | emacs-be01051469d7f14895eb388f6eabe3894d8ed75a.tar.gz emacs-be01051469d7f14895eb388f6eabe3894d8ed75a.zip | |
(help_echo_object, help_echo_pos): New variables.
(note_mode_line_highlight): Store additional information about the
help-echo in help_echo_object and help_echo_pos. Check both
`local-map' and `keymap' properties for changing the cursor
(note_mouse_highlight): Store additional information about the
help-echo in help_echo_object and help_echo_pos.
(note_tool_bar_highlight): Set help_echo_object to nil and
help_echo_pos to -1.
(XTread_socket): Use gen_help_event instead of filling
input_events manually.
(syms_of_xterm): Staticpro help_echo_object.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 78 |
1 files changed, 55 insertions, 23 deletions
diff --git a/src/xterm.c b/src/xterm.c index b9cc3565508..58dc0143fa7 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -243,6 +243,8 @@ int x_toolkit_scroll_bars_p; | |||
| 243 | (The display is done in read_char.) */ | 243 | (The display is done in read_char.) */ |
| 244 | 244 | ||
| 245 | static Lisp_Object help_echo; | 245 | static Lisp_Object help_echo; |
| 246 | static Lisp_Object help_echo_object; | ||
| 247 | static int help_echo_pos; | ||
| 246 | 248 | ||
| 247 | /* Temporary variable for XTread_socket. */ | 249 | /* Temporary variable for XTread_socket. */ |
| 248 | 250 | ||
| @@ -6352,13 +6354,24 @@ note_mode_line_highlight (w, x, mode_line_p) | |||
| 6352 | help = Fget_text_property (make_number (glyph->charpos), | 6354 | help = Fget_text_property (make_number (glyph->charpos), |
| 6353 | Qhelp_echo, glyph->object); | 6355 | Qhelp_echo, glyph->object); |
| 6354 | if (!NILP (help)) | 6356 | if (!NILP (help)) |
| 6355 | help_echo = help; | 6357 | { |
| 6358 | help_echo = help; | ||
| 6359 | help_echo_object = glyph->object; | ||
| 6360 | help_echo_pos = glyph->charpos; | ||
| 6361 | } | ||
| 6356 | 6362 | ||
| 6357 | /* Change the mouse pointer according to what is under X/Y. */ | 6363 | /* Change the mouse pointer according to what is under X/Y. */ |
| 6358 | map = Fget_text_property (make_number (glyph->charpos), | 6364 | map = Fget_text_property (make_number (glyph->charpos), |
| 6359 | Qlocal_map, glyph->object); | 6365 | Qlocal_map, glyph->object); |
| 6360 | if (!NILP (Fkeymapp (map))) | 6366 | if (!NILP (Fkeymapp (map))) |
| 6361 | cursor = f->output_data.x->nontext_cursor; | 6367 | cursor = f->output_data.x->nontext_cursor; |
| 6368 | else | ||
| 6369 | { | ||
| 6370 | map = Fget_text_property (make_number (glyph->charpos), | ||
| 6371 | Qkeymap, glyph->object); | ||
| 6372 | if (!NILP (Fkeymapp (map))) | ||
| 6373 | cursor = f->output_data.x->nontext_cursor; | ||
| 6374 | } | ||
| 6362 | } | 6375 | } |
| 6363 | } | 6376 | } |
| 6364 | 6377 | ||
| @@ -6604,26 +6617,38 @@ note_mouse_highlight (f, x, y) | |||
| 6604 | 6617 | ||
| 6605 | /* Look for a `help-echo' property. */ | 6618 | /* Look for a `help-echo' property. */ |
| 6606 | { | 6619 | { |
| 6607 | Lisp_Object help; | 6620 | Lisp_Object help, object, position; |
| 6608 | 6621 | ||
| 6609 | /* Check overlays first. */ | 6622 | /* Check overlays first. */ |
| 6610 | help = Qnil; | 6623 | help = Qnil; |
| 6611 | for (i = 0; i < noverlays && NILP (help); ++i) | 6624 | for (i = 0; i < noverlays && NILP (help); ++i) |
| 6612 | help = Foverlay_get (overlay_vec[i], Qhelp_echo); | 6625 | help = Foverlay_get (overlay_vec[i], Qhelp_echo); |
| 6613 | 6626 | ||
| 6614 | /* Try text properties. */ | 6627 | if (!NILP (help)) |
| 6615 | if (NILP (help) | 6628 | { |
| 6616 | && ((STRINGP (glyph->object) | 6629 | help_echo = help; |
| 6630 | help_echo_object = w->buffer; | ||
| 6631 | help_echo_pos = pos; | ||
| 6632 | } | ||
| 6633 | else | ||
| 6634 | { | ||
| 6635 | /* Try text properties. */ | ||
| 6636 | if ((STRINGP (glyph->object) | ||
| 6617 | && glyph->charpos >= 0 | 6637 | && glyph->charpos >= 0 |
| 6618 | && glyph->charpos < XSTRING (glyph->object)->size) | 6638 | && glyph->charpos < XSTRING (glyph->object)->size) |
| 6619 | || (BUFFERP (glyph->object) | 6639 | || (BUFFERP (glyph->object) |
| 6620 | && glyph->charpos >= BEGV | 6640 | && glyph->charpos >= BEGV |
| 6621 | && glyph->charpos < ZV))) | 6641 | && glyph->charpos < ZV)) |
| 6622 | help = Fget_text_property (make_number (glyph->charpos), | 6642 | help = Fget_text_property (make_number (glyph->charpos), |
| 6623 | Qhelp_echo, glyph->object); | 6643 | Qhelp_echo, glyph->object); |
| 6624 | 6644 | ||
| 6625 | if (!NILP (help)) | 6645 | if (!NILP (help)) |
| 6626 | help_echo = help; | 6646 | { |
| 6647 | help_echo = help; | ||
| 6648 | help_echo_object = glyph->object; | ||
| 6649 | help_echo_pos = glyph->charpos; | ||
| 6650 | } | ||
| 6651 | } | ||
| 6627 | } | 6652 | } |
| 6628 | 6653 | ||
| 6629 | BEGV = obegv; | 6654 | BEGV = obegv; |
| @@ -6855,6 +6880,8 @@ note_tool_bar_highlight (f, x, y) | |||
| 6855 | 6880 | ||
| 6856 | /* Set help_echo to a help string.to display for this tool-bar item. | 6881 | /* Set help_echo to a help string.to display for this tool-bar item. |
| 6857 | XTread_socket does the rest. */ | 6882 | XTread_socket does the rest. */ |
| 6883 | help_echo_object = Qnil; | ||
| 6884 | help_echo_pos = -1; | ||
| 6858 | help_echo = (XVECTOR (f->current_tool_bar_items) | 6885 | help_echo = (XVECTOR (f->current_tool_bar_items) |
| 6859 | ->contents[prop_idx + TOOL_BAR_ITEM_HELP]); | 6886 | ->contents[prop_idx + TOOL_BAR_ITEM_HELP]); |
| 6860 | if (NILP (help_echo)) | 6887 | if (NILP (help_echo)) |
| @@ -9769,11 +9796,12 @@ XTread_socket (sd, bufp, numchars, expected) | |||
| 9769 | the mouse leaves the frame. */ | 9796 | the mouse leaves the frame. */ |
| 9770 | if (any_help_event_p) | 9797 | if (any_help_event_p) |
| 9771 | { | 9798 | { |
| 9799 | Lisp_Object frame; | ||
| 9800 | int n; | ||
| 9801 | |||
| 9772 | XSETFRAME (frame, f); | 9802 | XSETFRAME (frame, f); |
| 9773 | bufp->kind = HELP_EVENT; | 9803 | n = gen_help_event (bufp, Qnil, frame, Qnil, 0); |
| 9774 | bufp->frame_or_window = frame; | 9804 | bufp += n, count += n, numchars -= n; |
| 9775 | bufp->arg = Qnil; | ||
| 9776 | ++bufp, ++count, --numchars; | ||
| 9777 | } | 9805 | } |
| 9778 | 9806 | ||
| 9779 | #ifdef LESSTIF_VERSION | 9807 | #ifdef LESSTIF_VERSION |
| @@ -9820,7 +9848,8 @@ XTread_socket (sd, bufp, numchars, expected) | |||
| 9820 | case MotionNotify: | 9848 | case MotionNotify: |
| 9821 | { | 9849 | { |
| 9822 | previous_help_echo = help_echo; | 9850 | previous_help_echo = help_echo; |
| 9823 | help_echo = Qnil; | 9851 | help_echo = help_echo_object = Qnil; |
| 9852 | help_echo_pos = -1; | ||
| 9824 | 9853 | ||
| 9825 | if (dpyinfo->grabbed && last_mouse_frame | 9854 | if (dpyinfo->grabbed && last_mouse_frame |
| 9826 | && FRAME_LIVE_P (last_mouse_frame)) | 9855 | && FRAME_LIVE_P (last_mouse_frame)) |
| @@ -9851,6 +9880,7 @@ XTread_socket (sd, bufp, numchars, expected) | |||
| 9851 | || !NILP (previous_help_echo)) | 9880 | || !NILP (previous_help_echo)) |
| 9852 | { | 9881 | { |
| 9853 | Lisp_Object frame; | 9882 | Lisp_Object frame; |
| 9883 | int n; | ||
| 9854 | 9884 | ||
| 9855 | if (f) | 9885 | if (f) |
| 9856 | XSETFRAME (frame, f); | 9886 | XSETFRAME (frame, f); |
| @@ -9858,10 +9888,9 @@ XTread_socket (sd, bufp, numchars, expected) | |||
| 9858 | frame = Qnil; | 9888 | frame = Qnil; |
| 9859 | 9889 | ||
| 9860 | any_help_event_p = 1; | 9890 | any_help_event_p = 1; |
| 9861 | bufp->kind = HELP_EVENT; | 9891 | n = gen_help_event (bufp, help_echo, frame, |
| 9862 | bufp->frame_or_window = frame; | 9892 | help_echo_object, help_echo_pos); |
| 9863 | bufp->arg = help_echo; | 9893 | bufp += n, count += n, numchars -= n; |
| 9864 | ++bufp, ++count, --numchars; | ||
| 9865 | } | 9894 | } |
| 9866 | 9895 | ||
| 9867 | goto OTHER; | 9896 | goto OTHER; |
| @@ -13564,10 +13593,13 @@ syms_of_xterm () | |||
| 13564 | staticpro (&last_mouse_press_frame); | 13593 | staticpro (&last_mouse_press_frame); |
| 13565 | last_mouse_press_frame = Qnil; | 13594 | last_mouse_press_frame = Qnil; |
| 13566 | 13595 | ||
| 13567 | staticpro (&help_echo); | ||
| 13568 | help_echo = Qnil; | 13596 | help_echo = Qnil; |
| 13569 | staticpro (&previous_help_echo); | 13597 | staticpro (&help_echo); |
| 13598 | help_echo_object = Qnil; | ||
| 13599 | staticpro (&help_echo_object); | ||
| 13570 | previous_help_echo = Qnil; | 13600 | previous_help_echo = Qnil; |
| 13601 | staticpro (&previous_help_echo); | ||
| 13602 | help_echo_pos = -1; | ||
| 13571 | 13603 | ||
| 13572 | DEFVAR_BOOL ("x-stretch-cursor", &x_stretch_cursor_p, | 13604 | DEFVAR_BOOL ("x-stretch-cursor", &x_stretch_cursor_p, |
| 13573 | "*Non-nil means draw block cursor as wide as the glyph under it.\n\ | 13605 | "*Non-nil means draw block cursor as wide as the glyph under it.\n\ |