Mercurial > emacs
comparison src/xterm.c @ 37685:e05763add5ce
(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.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 11 May 2001 15:10:44 +0000 |
parents | 456320a3ebab |
children | 4a800a01388b |
comparison
equal
deleted
inserted
replaced
37684:60dce3e9a7e4 | 37685:e05763add5ce |
---|---|
397 DRAW_MOUSE_FACE, | 397 DRAW_MOUSE_FACE, |
398 DRAW_IMAGE_RAISED, | 398 DRAW_IMAGE_RAISED, |
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 *)); |
405 static void x_update_window_end P_ ((struct window *, int, int)); | 406 static void x_update_window_end P_ ((struct window *, int, int)); |
406 static void frame_to_window_pixel_xy P_ ((struct window *, int *, int *)); | 407 static void frame_to_window_pixel_xy P_ ((struct window *, int *, int *)); |
6878 /* Clear mouse face if X/Y not over text. */ | 6879 /* Clear mouse face if X/Y not over text. */ |
6879 if (glyph == NULL | 6880 if (glyph == NULL |
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. */ |
6898 obuf = current_buffer; | 6900 obuf = current_buffer; |
6899 current_buffer = b; | 6901 current_buffer = b; |
6946 highlight only that. */ | 6948 highlight only that. */ |
6947 || (OVERLAYP (dpyinfo->mouse_face_overlay) | 6949 || (OVERLAYP (dpyinfo->mouse_face_overlay) |
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. */ |
6956 overlay = Qnil; | 6958 overlay = Qnil; |
6957 for (i = noverlays - 1; i >= 0 && NILP (overlay); --i) | 6959 for (i = noverlays - 1; i >= 0 && NILP (overlay); --i) |
7140 BEGV = obegv; | 7142 BEGV = obegv; |
7141 ZV = ozv; | 7143 ZV = ozv; |
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 } |
7148 | 7152 |
7149 static void | 7153 static void |
7650 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 7654 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
7651 f->output_data.x->nontext_cursor); | 7655 f->output_data.x->nontext_cursor); |
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 |
7656 | 7660 face was actually drawn unhighlighted. */ |
7657 void | 7661 |
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. */ | 7667 |
7663 if (!NILP (tip_frame)) | 7668 if (!NILP (dpyinfo->mouse_face_window)) |
7664 return; | 7669 { |
7665 #endif | 7670 show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT); |
7666 | 7671 cleared = 1; |
7667 if (! NILP (dpyinfo->mouse_face_window)) | 7672 } |
7668 show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT); | |
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 |
7676 /* Clear any mouse-face on window W. This function is part of the | 7681 /* Clear any mouse-face on window W. This function is part of the |
7677 redisplay interface, and is called from try_window_id and similar | 7682 redisplay interface, and is called from try_window_id and similar |