Mercurial > emacs
comparison src/xterm.c @ 30214:793f5a4e610b
(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.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 14 Jul 2000 13:56:09 +0000 |
parents | 3237a5529020 |
children | 9a5ccf8784f3 |
comparison
equal
deleted
inserted
replaced
30213:a6cb500e4bc6 | 30214:793f5a4e610b |
---|---|
241 | 241 |
242 /* If a string, XTread_socket generates an event to display that string. | 242 /* If a string, XTread_socket generates an event to display that string. |
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 |
249 static Lisp_Object previous_help_echo; | 251 static Lisp_Object previous_help_echo; |
250 | 252 |
6350 arrange for the help to be displayed. This is done by | 6352 arrange for the help to be displayed. This is done by |
6351 setting the global variable help_echo to the help string. */ | 6353 setting the global variable help_echo to the help string. */ |
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 |
6365 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor); | 6378 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor); |
6366 } | 6379 } |
6602 } | 6615 } |
6603 } | 6616 } |
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; |
6630 ZV = ozv; | 6655 ZV = ozv; |
6631 current_buffer = obuf; | 6656 current_buffer = obuf; |
6853 | 6878 |
6854 set_help_echo: | 6879 set_help_echo: |
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)) |
6861 help_echo = (XVECTOR (f->current_tool_bar_items) | 6888 help_echo = (XVECTOR (f->current_tool_bar_items) |
6862 ->contents[prop_idx + TOOL_BAR_ITEM_CAPTION]); | 6889 ->contents[prop_idx + TOOL_BAR_ITEM_CAPTION]); |
9767 Do it only if there's something to cancel. | 9794 Do it only if there's something to cancel. |
9768 Otherwise, the startup message is cleared when | 9795 Otherwise, the startup message is cleared when |
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 |
9780 /* Please see the comment at the start of the | 9808 /* Please see the comment at the start of the |
9781 EnterNotify case. */ | 9809 EnterNotify case. */ |
9818 goto OTHER; | 9846 goto OTHER; |
9819 | 9847 |
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)) |
9827 f = last_mouse_frame; | 9856 f = last_mouse_frame; |
9828 else | 9857 else |
9849 has changed, generate a HELP_EVENT. */ | 9878 has changed, generate a HELP_EVENT. */ |
9850 if (!NILP (help_echo) | 9879 if (!NILP (help_echo) |
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); |
9857 else | 9887 else |
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; |
9868 } | 9897 } |
9869 | 9898 |
13562 Qvendor_specific_keysyms = intern ("vendor-specific-keysyms"); | 13591 Qvendor_specific_keysyms = intern ("vendor-specific-keysyms"); |
13563 | 13592 |
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 |
13596 help_echo = Qnil; | |
13567 staticpro (&help_echo); | 13597 staticpro (&help_echo); |
13568 help_echo = Qnil; | 13598 help_echo_object = Qnil; |
13599 staticpro (&help_echo_object); | |
13600 previous_help_echo = Qnil; | |
13569 staticpro (&previous_help_echo); | 13601 staticpro (&previous_help_echo); |
13570 previous_help_echo = Qnil; | 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\ |
13574 For example, if a block cursor is over a tab, it will be drawn as\n\ | 13606 For example, if a block cursor is over a tab, it will be drawn as\n\ |
13575 wide as that tab on the display."); | 13607 wide as that tab on the display."); |