diff options
| author | Gerd Moellmann | 2001-05-11 15:10:44 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-05-11 15:10:44 +0000 |
| commit | fa262c0722bf28dac8339ac5d42c39fae466dca2 (patch) | |
| tree | 0dfcf4395c4c615c0db4202262b6dd0ec5876645 /src/xterm.c | |
| parent | d88a79d4a5f7ab9c893345a7ad68ffd6aad437e6 (diff) | |
| download | emacs-fa262c0722bf28dac8339ac5d42c39fae466dca2.tar.gz emacs-fa262c0722bf28dac8339ac5d42c39fae466dca2.zip | |
(clear_mouse_face): Return 1 if text with mouse face was
actually redrawn. Make the function static.
(note_mouse_highlight): Fix a case where the mouse cursor
was changed back to the text cursor.
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/xterm.c b/src/xterm.c index 9201cf1cd13..65138279126 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -399,6 +399,7 @@ enum draw_glyphs_face | |||
| 399 | DRAW_IMAGE_SUNKEN | 399 | DRAW_IMAGE_SUNKEN |
| 400 | }; | 400 | }; |
| 401 | 401 | ||
| 402 | static int clear_mouse_face P_ ((struct x_display_info *)); | ||
| 402 | static int x_alloc_nearest_color_1 P_ ((Display *, Colormap, XColor *)); | 403 | static int x_alloc_nearest_color_1 P_ ((Display *, Colormap, XColor *)); |
| 403 | static void x_set_window_size_1 P_ ((struct frame *, int, int, int)); | 404 | static void x_set_window_size_1 P_ ((struct frame *, int, int, int)); |
| 404 | static const XColor *x_color_cells P_ ((Display *, int *)); | 405 | static const XColor *x_color_cells P_ ((Display *, int *)); |
| @@ -6880,18 +6881,19 @@ note_mouse_highlight (f, x, y) | |||
| 6880 | || area != TEXT_AREA | 6881 | || area != TEXT_AREA |
| 6881 | || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p) | 6882 | || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p) |
| 6882 | { | 6883 | { |
| 6883 | clear_mouse_face (dpyinfo); | 6884 | if (clear_mouse_face (dpyinfo)) |
| 6884 | return; | 6885 | cursor = None; |
| 6886 | goto set_cursor; | ||
| 6885 | } | 6887 | } |
| 6886 | 6888 | ||
| 6887 | pos = glyph->charpos; | 6889 | pos = glyph->charpos; |
| 6888 | object = glyph->object; | 6890 | object = glyph->object; |
| 6889 | if (!STRINGP (object) && !BUFFERP (object)) | 6891 | if (!STRINGP (object) && !BUFFERP (object)) |
| 6890 | return; | 6892 | goto set_cursor; |
| 6891 | 6893 | ||
| 6892 | /* If we get an out-of-range value, return now; avoid an error. */ | 6894 | /* If we get an out-of-range value, return now; avoid an error. */ |
| 6893 | if (BUFFERP (object) && pos > BUF_Z (b)) | 6895 | if (BUFFERP (object) && pos > BUF_Z (b)) |
| 6894 | return; | 6896 | goto set_cursor; |
| 6895 | 6897 | ||
| 6896 | /* Make the window's buffer temporarily current for | 6898 | /* Make the window's buffer temporarily current for |
| 6897 | overlays_at and compute_char_face. */ | 6899 | overlays_at and compute_char_face. */ |
| @@ -6948,8 +6950,8 @@ note_mouse_highlight (f, x, y) | |||
| 6948 | && mouse_face_overlay_overlaps (dpyinfo->mouse_face_overlay))) | 6950 | && mouse_face_overlay_overlaps (dpyinfo->mouse_face_overlay))) |
| 6949 | { | 6951 | { |
| 6950 | /* Clear the display of the old active region, if any. */ | 6952 | /* Clear the display of the old active region, if any. */ |
| 6951 | clear_mouse_face (dpyinfo); | 6953 | if (clear_mouse_face (dpyinfo)) |
| 6952 | cursor = None; | 6954 | cursor = None; |
| 6953 | 6955 | ||
| 6954 | /* Find the highest priority overlay that has a mouse-face | 6956 | /* Find the highest priority overlay that has a mouse-face |
| 6955 | property. */ | 6957 | property. */ |
| @@ -7142,6 +7144,8 @@ note_mouse_highlight (f, x, y) | |||
| 7142 | current_buffer = obuf; | 7144 | current_buffer = obuf; |
| 7143 | } | 7145 | } |
| 7144 | 7146 | ||
| 7147 | set_cursor: | ||
| 7148 | |||
| 7145 | if (cursor != None) | 7149 | if (cursor != None) |
| 7146 | XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor); | 7150 | XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor); |
| 7147 | } | 7151 | } |
| @@ -7652,24 +7656,25 @@ show_mouse_face (dpyinfo, draw) | |||
| 7652 | } | 7656 | } |
| 7653 | 7657 | ||
| 7654 | /* Clear out the mouse-highlighted active region. | 7658 | /* Clear out the mouse-highlighted active region. |
| 7655 | Redraw it un-highlighted first. */ | 7659 | Redraw it un-highlighted first. Value is non-zero if mouse |
| 7660 | face was actually drawn unhighlighted. */ | ||
| 7656 | 7661 | ||
| 7657 | void | 7662 | static int |
| 7658 | clear_mouse_face (dpyinfo) | 7663 | clear_mouse_face (dpyinfo) |
| 7659 | struct x_display_info *dpyinfo; | 7664 | struct x_display_info *dpyinfo; |
| 7660 | { | 7665 | { |
| 7661 | #if 0 /* This prevents redrawing tool bar items when changing from one | 7666 | int cleared = 0; |
| 7662 | to another while a tooltip is open, so don't do it. */ | ||
| 7663 | if (!NILP (tip_frame)) | ||
| 7664 | return; | ||
| 7665 | #endif | ||
| 7666 | 7667 | ||
| 7667 | if (! NILP (dpyinfo->mouse_face_window)) | 7668 | if (!NILP (dpyinfo->mouse_face_window)) |
| 7668 | show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT); | 7669 | { |
| 7670 | show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT); | ||
| 7671 | cleared = 1; | ||
| 7672 | } | ||
| 7669 | 7673 | ||
| 7670 | dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; | 7674 | dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; |
| 7671 | dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; | 7675 | dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; |
| 7672 | dpyinfo->mouse_face_window = Qnil; | 7676 | dpyinfo->mouse_face_window = Qnil; |
| 7677 | return cleared; | ||
| 7673 | } | 7678 | } |
| 7674 | 7679 | ||
| 7675 | 7680 | ||