diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 104 |
1 files changed, 40 insertions, 64 deletions
diff --git a/src/xterm.c b/src/xterm.c index 93fe45977b7..aae8114dda0 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -429,7 +429,8 @@ static int fast_find_string_pos P_ ((struct window *, int, Lisp_Object, | |||
| 429 | static void set_output_cursor P_ ((struct cursor_pos *)); | 429 | static void set_output_cursor P_ ((struct cursor_pos *)); |
| 430 | static struct glyph *x_y_to_hpos_vpos P_ ((struct window *, int, int, | 430 | static struct glyph *x_y_to_hpos_vpos P_ ((struct window *, int, int, |
| 431 | int *, int *, int *, int)); | 431 | int *, int *, int *, int)); |
| 432 | static void note_mode_line_highlight P_ ((struct window *, int, int)); | 432 | static void note_mode_line_or_margin_highlight P_ ((struct window *, int, |
| 433 | int, int)); | ||
| 433 | static void note_mouse_highlight P_ ((struct frame *, int, int)); | 434 | static void note_mouse_highlight P_ ((struct frame *, int, int)); |
| 434 | static void note_tool_bar_highlight P_ ((struct frame *f, int, int)); | 435 | static void note_tool_bar_highlight P_ ((struct frame *f, int, int)); |
| 435 | static void x_handle_tool_bar_click P_ ((struct frame *, XButtonEvent *)); | 436 | static void x_handle_tool_bar_click P_ ((struct frame *, XButtonEvent *)); |
| @@ -851,7 +852,7 @@ x_draw_fringe_bitmap (w, row, which, left_p) | |||
| 851 | Window window = FRAME_X_WINDOW (f); | 852 | Window window = FRAME_X_WINDOW (f); |
| 852 | int x, y, wd, h, dy; | 853 | int x, y, wd, h, dy; |
| 853 | int b1, b2; | 854 | int b1, b2; |
| 854 | unsigned char *bits; | 855 | unsigned char *bits = NULL; |
| 855 | Pixmap pixmap; | 856 | Pixmap pixmap; |
| 856 | GC gc = f->output_data.x->normal_gc; | 857 | GC gc = f->output_data.x->normal_gc; |
| 857 | struct face *face; | 858 | struct face *face; |
| @@ -6791,80 +6792,55 @@ frame_to_window_pixel_xy (w, x, y) | |||
| 6791 | } | 6792 | } |
| 6792 | 6793 | ||
| 6793 | 6794 | ||
| 6794 | /* Take proper action when mouse has moved to the mode or header line of | 6795 | /* Take proper action when mouse has moved to the mode or header line |
| 6795 | window W, x-position X. MODE_LINE_P non-zero means mouse is on the | 6796 | or marginal area of window W, x-position X and y-position Y. Area |
| 6796 | mode line. X is relative to the start of the text display area of | 6797 | is 1, 3, 6 or 7 for the mode line, header line, left and right |
| 6797 | W, so the width of fringes and scroll bars must be subtracted | 6798 | marginal area respectively. X is relative to the start of the text |
| 6798 | to get a position relative to the start of the mode line. */ | 6799 | display area of W, so the width of bitmap areas and scroll bars |
| 6799 | 6800 | must be subtracted to get a position relative to the start of the | |
| 6801 | mode line. */ | ||
| 6802 | |||
| 6800 | static void | 6803 | static void |
| 6801 | note_mode_line_highlight (w, x, mode_line_p) | 6804 | note_mode_line_or_margin_highlight (w, x, y, portion) |
| 6802 | struct window *w; | 6805 | struct window *w; |
| 6803 | int x, mode_line_p; | 6806 | int x, y, portion; |
| 6804 | { | 6807 | { |
| 6805 | struct frame *f = XFRAME (w->frame); | 6808 | struct frame *f = XFRAME (w->frame); |
| 6806 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 6809 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
| 6807 | Cursor cursor = dpyinfo->vertical_scroll_bar_cursor; | 6810 | Cursor cursor = dpyinfo->vertical_scroll_bar_cursor; |
| 6808 | struct glyph_row *row; | 6811 | struct glyph_row *row; |
| 6812 | int i, area, charpos; | ||
| 6813 | Lisp_Object string, help, map, pos; | ||
| 6809 | 6814 | ||
| 6810 | if (mode_line_p) | 6815 | if (portion == 1 || portion == 3) |
| 6811 | row = MATRIX_MODE_LINE_ROW (w->current_matrix); | 6816 | string = mode_line_string (w, x, y, portion == 1, &charpos); |
| 6812 | else | 6817 | else |
| 6813 | row = MATRIX_HEADER_LINE_ROW (w->current_matrix); | 6818 | string = marginal_area_string (w, x, y, portion, &charpos); |
| 6814 | 6819 | ||
| 6815 | if (row->enabled_p) | 6820 | if (STRINGP (string)) |
| 6816 | { | 6821 | { |
| 6817 | struct glyph *glyph, *end; | 6822 | pos = make_number (charpos); |
| 6818 | Lisp_Object help, map; | ||
| 6819 | int x0; | ||
| 6820 | |||
| 6821 | /* Find the glyph under X. */ | ||
| 6822 | glyph = row->glyphs[TEXT_AREA]; | ||
| 6823 | end = glyph + row->used[TEXT_AREA]; | ||
| 6824 | x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f) | ||
| 6825 | + FRAME_X_LEFT_FRINGE_WIDTH (f)); | ||
| 6826 | 6823 | ||
| 6827 | while (glyph < end | 6824 | /* If we're on a string with `help-echo' text property, arrange |
| 6828 | && x >= x0 + glyph->pixel_width) | 6825 | for the help to be displayed. This is done by setting the |
| 6826 | global variable help_echo to the help string. */ | ||
| 6827 | help = Fget_text_property (pos, Qhelp_echo, string); | ||
| 6828 | if (!NILP (help)) | ||
| 6829 | { | 6829 | { |
| 6830 | x0 += glyph->pixel_width; | 6830 | help_echo = help; |
| 6831 | ++glyph; | 6831 | XSETWINDOW (help_echo_window, w); |
| 6832 | help_echo_object = string; | ||
| 6833 | help_echo_pos = charpos; | ||
| 6832 | } | 6834 | } |
| 6833 | 6835 | ||
| 6834 | if (glyph < end | 6836 | /* Change the mouse pointer according to what is under X/Y. */ |
| 6835 | && STRINGP (glyph->object) | 6837 | map = Fget_text_property (pos, Qlocal_map, string); |
| 6836 | && XSTRING (glyph->object)->intervals | 6838 | if (!KEYMAPP (map)) |
| 6837 | && glyph->charpos >= 0 | 6839 | map = Fget_text_property (pos, Qkeymap, string); |
| 6838 | && glyph->charpos < XSTRING (glyph->object)->size) | 6840 | if (KEYMAPP (map)) |
| 6839 | { | 6841 | cursor = f->output_data.x->nontext_cursor; |
| 6840 | /* If we're on a string with `help-echo' text property, | ||
| 6841 | arrange for the help to be displayed. This is done by | ||
| 6842 | setting the global variable help_echo to the help string. */ | ||
| 6843 | help = Fget_text_property (make_number (glyph->charpos), | ||
| 6844 | Qhelp_echo, glyph->object); | ||
| 6845 | if (!NILP (help)) | ||
| 6846 | { | ||
| 6847 | help_echo = help; | ||
| 6848 | XSETWINDOW (help_echo_window, w); | ||
| 6849 | help_echo_object = glyph->object; | ||
| 6850 | help_echo_pos = glyph->charpos; | ||
| 6851 | } | ||
| 6852 | |||
| 6853 | /* Change the mouse pointer according to what is under X/Y. */ | ||
| 6854 | map = Fget_text_property (make_number (glyph->charpos), | ||
| 6855 | Qlocal_map, glyph->object); | ||
| 6856 | if (KEYMAPP (map)) | ||
| 6857 | cursor = f->output_data.x->nontext_cursor; | ||
| 6858 | else | ||
| 6859 | { | ||
| 6860 | map = Fget_text_property (make_number (glyph->charpos), | ||
| 6861 | Qkeymap, glyph->object); | ||
| 6862 | if (KEYMAPP (map)) | ||
| 6863 | cursor = f->output_data.x->nontext_cursor; | ||
| 6864 | } | ||
| 6865 | } | ||
| 6866 | } | 6842 | } |
| 6867 | 6843 | ||
| 6868 | XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor); | 6844 | XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor); |
| 6869 | } | 6845 | } |
| 6870 | 6846 | ||
| @@ -6932,10 +6908,10 @@ note_mouse_highlight (f, x, y) | |||
| 6932 | return; | 6908 | return; |
| 6933 | } | 6909 | } |
| 6934 | 6910 | ||
| 6935 | /* Mouse is on the mode or header line? */ | 6911 | /* Mouse is on the mode, header line or margin? */ |
| 6936 | if (portion == 1 || portion == 3) | 6912 | if (portion == 1 || portion == 3 || portion == 6 || portion == 7) |
| 6937 | { | 6913 | { |
| 6938 | note_mode_line_highlight (w, x, portion == 1); | 6914 | note_mode_line_or_margin_highlight (w, x, y, portion); |
| 6939 | return; | 6915 | return; |
| 6940 | } | 6916 | } |
| 6941 | 6917 | ||