Mercurial > emacs
comparison src/xterm.c @ 44533:cf3b9d517c45
(note_mode_line_or_margin_highlight): Renamed from
note_mode_line_highlight and extended.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 12 Apr 2002 09:33:52 +0000 |
parents | ff9f7aee02c8 |
children | 404f74d6dc4a |
comparison
equal
deleted
inserted
replaced
44532:b94ae378e07c | 44533:cf3b9d517c45 |
---|---|
427 static int fast_find_string_pos P_ ((struct window *, int, Lisp_Object, | 427 static int fast_find_string_pos P_ ((struct window *, int, Lisp_Object, |
428 int *, int *, int *, int *, int)); | 428 int *, int *, int *, int *, int)); |
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 *)); |
436 static void show_mouse_face P_ ((struct x_display_info *, | 437 static void show_mouse_face P_ ((struct x_display_info *, |
437 enum draw_glyphs_face)); | 438 enum draw_glyphs_face)); |
849 struct frame *f = XFRAME (WINDOW_FRAME (w)); | 850 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
850 Display *display = FRAME_X_DISPLAY (f); | 851 Display *display = FRAME_X_DISPLAY (f); |
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; |
858 int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); | 859 int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); |
859 | 860 |
6789 *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); | 6790 *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); |
6790 } | 6791 } |
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; |
6809 | 6812 int i, area, charpos; |
6810 if (mode_line_p) | 6813 Lisp_Object string, help, map, pos; |
6811 row = MATRIX_MODE_LINE_ROW (w->current_matrix); | 6814 |
6812 else | 6815 if (portion == 1 || portion == 3) |
6813 row = MATRIX_HEADER_LINE_ROW (w->current_matrix); | 6816 string = mode_line_string (w, x, y, portion == 1, &charpos); |
6814 | 6817 else |
6815 if (row->enabled_p) | 6818 string = marginal_area_string (w, x, y, portion, &charpos); |
6816 { | 6819 |
6817 struct glyph *glyph, *end; | 6820 if (STRINGP (string)) |
6818 Lisp_Object help, map; | 6821 { |
6819 int x0; | 6822 pos = make_number (charpos); |
6820 | 6823 |
6821 /* Find the glyph under X. */ | 6824 /* If we're on a string with `help-echo' text property, arrange |
6822 glyph = row->glyphs[TEXT_AREA]; | 6825 for the help to be displayed. This is done by setting the |
6823 end = glyph + row->used[TEXT_AREA]; | 6826 global variable help_echo to the help string. */ |
6824 x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f) | 6827 help = Fget_text_property (pos, Qhelp_echo, string); |
6825 + FRAME_X_LEFT_FRINGE_WIDTH (f)); | 6828 if (!NILP (help)) |
6826 | |
6827 while (glyph < end | |
6828 && x >= x0 + glyph->pixel_width) | |
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, | 6842 } |
6841 arrange for the help to be displayed. This is done by | 6843 |
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 } | |
6867 | |
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 |
6871 | 6847 |
6872 /* Take proper action when the mouse has moved to position X, Y on | 6848 /* Take proper action when the mouse has moved to position X, Y on |
6930 { | 6906 { |
6931 note_tool_bar_highlight (f, x, y); | 6907 note_tool_bar_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 |
6942 if (portion == 2) | 6918 if (portion == 2) |
6943 cursor = f->output_data.x->horizontal_drag_cursor; | 6919 cursor = f->output_data.x->horizontal_drag_cursor; |