aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2001-11-18 21:53:11 +0000
committerJason Rumney2001-11-18 21:53:11 +0000
commit6ff3e5e3cdba7a0b98a5e23f2900089194b303b2 (patch)
treec6438efa73472ff19bd0a9a929ce521eca51eb48 /src
parent1d297d9b0120fb649bb9d8894232febde18196fc (diff)
downloademacs-6ff3e5e3cdba7a0b98a5e23f2900089194b303b2.tar.gz
emacs-6ff3e5e3cdba7a0b98a5e23f2900089194b303b2.zip
(note_mouse_highlight): Fix type of variable `ignore'.
(x_draw_bar_cursor): If the background color of the glyph under the cursor equals the frame's cursor color, use the glyph's foreground color for drawing the bar cursor. (x_after_update_window_line): Clear internal border in different circumstances. (w32_set_vertical_scroll_bar): Check for width and height > 0. (w32_draw_relief_rect): Correct relief by 1 pixel. (x_set_glyph_string_background_width): Set extends_to_end_of_line_p if the row's fill_line_p is set and drawing the last glyph with DRAW_IMAGE_{RAISED,SUNKEN}. (x_display_and_set_cursor): If cursor_in_echo_area, use NO_CURSOR if cursor_in_non_selected_windows is false. (show_mouse_face): Clean up. Recognize overwritten cursor differently. (x_draw_glyphs): Remove parameters REAL_START and REAL_END. Notice if cursor gets overwritten. (notice_overwritten_cursor): Renamed from note_overwritten_text_cursor. Rewritten to take glyph widths into account, and to take X positions as parameters. (x_draw_phys_cursor_glyph): Save state of w->phys_cursor_on_p around call to x_draw_glyphs. (x_setup_relief_colors): Use `IMAGE_BACKGROUND' and `IMAGE_BACKGROUND_TRANSPARENT' to calculate the correct background color to use for image glyph reliefs. (x_draw_image_relief): Accept zero tool_bar_button_relief. (glyph_rect): Remove unused variable `area'.
Diffstat (limited to 'src')
-rw-r--r--src/w32term.c301
1 files changed, 149 insertions, 152 deletions
diff --git a/src/w32term.c b/src/w32term.c
index 18095654d95..6c7cbe8b230 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -407,7 +407,7 @@ static void w32_clip_to_row P_ ((struct window *, struct glyph_row *,
407 HDC, int)); 407 HDC, int));
408static int x_phys_cursor_in_rect_p P_ ((struct window *, RECT *)); 408static int x_phys_cursor_in_rect_p P_ ((struct window *, RECT *));
409static void x_draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); 409static void x_draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *));
410static void note_overwritten_text_cursor P_ ((struct window *, int, int)); 410static void notice_overwritten_cursor P_ ((struct window *, int, int));
411 411
412static Lisp_Object Qvendor_specific_keysyms; 412static Lisp_Object Qvendor_specific_keysyms;
413 413
@@ -761,34 +761,46 @@ x_after_update_window_line (desired_row)
761 struct glyph_row *desired_row; 761 struct glyph_row *desired_row;
762{ 762{
763 struct window *w = updated_window; 763 struct window *w = updated_window;
764 764 struct frame *f;
765 int width, height;
766
765 xassert (w); 767 xassert (w);
766 768
767 if (!desired_row->mode_line_p && !w->pseudo_window_p) 769 if (!desired_row->mode_line_p && !w->pseudo_window_p)
768 { 770 {
769 struct frame *f;
770 int width;
771
772 BLOCK_INPUT; 771 BLOCK_INPUT;
773 x_draw_row_fringe_bitmaps (w, desired_row); 772 x_draw_row_fringe_bitmaps (w, desired_row);
773 UNBLOCK_INPUT;
774 }
774 775
775 /* When a window has disappeared, make sure that no rest of 776 /* When a window has disappeared, make sure that no rest of
776 full-width rows stays visible in the internal border. */ 777 full-width rows stays visible in the internal border. Could
777 if (windows_or_buffers_changed 778 check here if updated_window is the leftmost/rightmost window,
778 && (f = XFRAME (w->frame), 779 but I guess it's not worth doing since vertically split windows
779 width = FRAME_INTERNAL_BORDER_WIDTH (f), 780 are almost never used, internal border is rarely set, and the
780 width != 0)) 781 overhead is very small. */
781 { 782 if (windows_or_buffers_changed
782 int height = desired_row->visible_height; 783 && desired_row->full_width_p
783 int x = (window_box_right (w, -1) 784 && (f = XFRAME (w->frame),
784 + FRAME_X_RIGHT_FRINGE_WIDTH (f)); 785 width = FRAME_INTERNAL_BORDER_WIDTH (f),
785 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); 786 width != 0)
786 HDC hdc = get_frame_dc (f); 787 && (height = desired_row->visible_height,
787 788 height > 0))
788 w32_clear_area (f, hdc, x, y, width, height); 789 {
789 release_frame_dc (f, hdc); 790 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
790 } 791 /* Internal border is drawn below the tool bar. */
791 792 if (WINDOWP (f->tool_bar_window)
793 && w == XWINDOW (f->tool_bar_window))
794 y -= width;
795
796 BLOCK_INPUT;
797 {
798 HDC hdc = get_frame_dc (f);
799 w32_clear_area (f, hdc, 0, y, width, height);
800 w32_clear_area (f, hdc, f->output_data.w32->pixel_width - width,
801 y, width, height);
802 release_frame_dc (f, hdc);
803 }
792 UNBLOCK_INPUT; 804 UNBLOCK_INPUT;
793 } 805 }
794} 806}
@@ -2742,7 +2754,7 @@ static void w32_init_glyph_string P_ ((struct glyph_string *, HDC hdc,
2742 enum draw_glyphs_face)); 2754 enum draw_glyphs_face));
2743static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, 2755static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *,
2744 enum glyph_row_area, int, int, 2756 enum glyph_row_area, int, int,
2745 enum draw_glyphs_face, int *, int *, int)); 2757 enum draw_glyphs_face, int));
2746static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); 2758static void x_set_glyph_string_clipping P_ ((struct glyph_string *));
2747static void x_set_glyph_string_gc P_ ((struct glyph_string *)); 2759static void x_set_glyph_string_gc P_ ((struct glyph_string *));
2748static void x_draw_glyph_string_background P_ ((struct glyph_string *, 2760static void x_draw_glyph_string_background P_ ((struct glyph_string *,
@@ -3619,6 +3631,9 @@ x_setup_relief_colors (s)
3619 3631
3620 if (s->face->use_box_color_for_shadows_p) 3632 if (s->face->use_box_color_for_shadows_p)
3621 color = s->face->box_color; 3633 color = s->face->box_color;
3634 else if (s->first_glyph->type == IMAGE_GLYPH
3635 && !IMAGE_BACKGROUND_TRANSPARENT (s->img, s->f, 0))
3636 color = IMAGE_BACKGROUND (s->img, s->f, 0);
3622 else 3637 else
3623 color = s->gc->background; 3638 color = s->gc->background;
3624 3639
@@ -3664,14 +3679,14 @@ w32_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
3664 for (i = 0; i < width; ++i) 3679 for (i = 0; i < width; ++i)
3665 w32_fill_area (f, hdc, gc.foreground, 3680 w32_fill_area (f, hdc, gc.foreground,
3666 left_x + i * left_p, top_y + i, 3681 left_x + i * left_p, top_y + i,
3667 (right_x + 1 - i * right_p) - (left_x + i * left_p), 1); 3682 (right_x + 1 - i * right_p) - (left_x + i * left_p) + 1, 1);
3668 3683
3669 /* Left. */ 3684 /* Left. */
3670 if (left_p) 3685 if (left_p)
3671 for (i = 0; i < width; ++i) 3686 for (i = 0; i < width; ++i)
3672 w32_fill_area (f, hdc, gc.foreground, 3687 w32_fill_area (f, hdc, gc.foreground,
3673 left_x + i, top_y + i, 1, 3688 left_x + i, top_y + i, 1,
3674 (bottom_y - i + 1) - (top_y + i)); 3689 (bottom_y - i) - (top_y + i) + 2);
3675 3690
3676 if (raised_p) 3691 if (raised_p)
3677 gc.foreground = f->output_data.w32->black_relief.gc->foreground; 3692 gc.foreground = f->output_data.w32->black_relief.gc->foreground;
@@ -3682,14 +3697,14 @@ w32_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
3682 for (i = 0; i < width; ++i) 3697 for (i = 0; i < width; ++i)
3683 w32_fill_area (f, hdc, gc.foreground, 3698 w32_fill_area (f, hdc, gc.foreground,
3684 left_x + i * left_p, bottom_y - i, 3699 left_x + i * left_p, bottom_y - i,
3685 (right_x + 2 - i * right_p) - (left_x + i * left_p), 1); 3700 (right_x - i * right_p) - (left_x + i * left_p) + 2, 1);
3686 3701
3687 /* Right. */ 3702 /* Right. */
3688 if (right_p) 3703 if (right_p)
3689 for (i = 0; i < width; ++i) 3704 for (i = 0; i < width; ++i)
3690 w32_fill_area (f, hdc, gc.foreground, 3705 w32_fill_area (f, hdc, gc.foreground,
3691 right_x - i, top_y + i + 1, 1, 3706 right_x - i, top_y + i + 1, 1,
3692 (bottom_y - i) - (top_y + i + 1)); 3707 (bottom_y - i) - (top_y + i));
3693 3708
3694 w32_set_clip_rectangle (hdc, NULL); 3709 w32_set_clip_rectangle (hdc, NULL);
3695 3710
@@ -3923,7 +3938,7 @@ x_draw_image_relief (s)
3923 if (s->hl == DRAW_IMAGE_SUNKEN 3938 if (s->hl == DRAW_IMAGE_SUNKEN
3924 || s->hl == DRAW_IMAGE_RAISED) 3939 || s->hl == DRAW_IMAGE_RAISED)
3925 { 3940 {
3926 thick = tool_bar_button_relief > 0 ? tool_bar_button_relief : 3; 3941 thick = tool_bar_button_relief >= 0 ? tool_bar_button_relief : 3;
3927 raised_p = s->hl == DRAW_IMAGE_RAISED; 3942 raised_p = s->hl == DRAW_IMAGE_RAISED;
3928 } 3943 }
3929 else 3944 else
@@ -4647,7 +4662,9 @@ x_set_glyph_string_background_width (s, start, last_x)
4647 || s->face->background != default_face->background 4662 || s->face->background != default_face->background
4648 || s->face->stipple != default_face->stipple 4663 || s->face->stipple != default_face->stipple
4649 || s->row->mouse_face_p)) 4664 || s->row->mouse_face_p))
4650 || s->hl == DRAW_MOUSE_FACE)) 4665 || s->hl == DRAW_MOUSE_FACE
4666 || ((s->hl == DRAW_IMAGE_RAISED || s->hl == DRAW_IMAGE_SUNKEN)
4667 && s->row->fill_line_p)))
4651 s->extends_to_end_of_line_p = 1; 4668 s->extends_to_end_of_line_p = 1;
4652 4669
4653 /* If S extends its face to the end of the line, set its 4670 /* If S extends its face to the end of the line, set its
@@ -4849,27 +4866,19 @@ x_set_glyph_string_background_width (s, start, last_x)
4849 DRAW_IMAGE_SUNKEN draw an image with a sunken relief around it 4866 DRAW_IMAGE_SUNKEN draw an image with a sunken relief around it
4850 DRAW_IMAGE_RAISED draw an image with a raised relief around it 4867 DRAW_IMAGE_RAISED draw an image with a raised relief around it
4851 4868
4852 If REAL_START is non-null, return in *REAL_START the real starting
4853 position for display. This can be different from START in case
4854 overlapping glyphs must be displayed. If REAL_END is non-null,
4855 return in *REAL_END the real end position for display. This can be
4856 different from END in case overlapping glyphs must be displayed.
4857
4858 If OVERLAPS_P is non-zero, draw only the foreground of characters 4869 If OVERLAPS_P is non-zero, draw only the foreground of characters
4859 and clip to the physical height of ROW. 4870 and clip to the physical height of ROW.
4860 4871
4861 Value is the x-position reached, relative to AREA of W. */ 4872 Value is the x-position reached, relative to AREA of W. */
4862 4873
4863static int 4874static int
4864x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end, 4875x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
4865 overlaps_p)
4866 struct window *w; 4876 struct window *w;
4867 int x; 4877 int x;
4868 struct glyph_row *row; 4878 struct glyph_row *row;
4869 enum glyph_row_area area; 4879 enum glyph_row_area area;
4870 int start, end; 4880 int start, end;
4871 enum draw_glyphs_face hl; 4881 enum draw_glyphs_face hl;
4872 int *real_start, *real_end;
4873 int overlaps_p; 4882 int overlaps_p;
4874{ 4883{
4875 struct glyph_string *head, *tail; 4884 struct glyph_string *head, *tail;
@@ -4883,10 +4892,6 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end,
4883 end = min (end, row->used[area]); 4892 end = min (end, row->used[area]);
4884 start = max (0, start); 4893 start = max (0, start);
4885 start = min (end, start); 4894 start = min (end, start);
4886 if (real_start)
4887 *real_start = start;
4888 if (real_end)
4889 *real_end = end;
4890 4895
4891 /* Translate X to frame coordinates. Set last_x to the right 4896 /* Translate X to frame coordinates. Set last_x to the right
4892 end of the drawing area. */ 4897 end of the drawing area. */
@@ -4958,8 +4963,6 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end,
4958 DRAW_NORMAL_TEXT, dummy_x, last_x, 4963 DRAW_NORMAL_TEXT, dummy_x, last_x,
4959 overlaps_p); 4964 overlaps_p);
4960 start = i; 4965 start = i;
4961 if (real_start)
4962 *real_start = start;
4963 x_compute_overhangs_and_x (t, head->x, 1); 4966 x_compute_overhangs_and_x (t, head->x, 1);
4964 x_prepend_glyph_string_lists (&head, &tail, h, t); 4967 x_prepend_glyph_string_lists (&head, &tail, h, t);
4965 } 4968 }
@@ -4979,8 +4982,6 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end,
4979 overlaps_p); 4982 overlaps_p);
4980 for (s = h; s; s = s->next) 4983 for (s = h; s; s = s->next)
4981 s->background_filled_p = 1; 4984 s->background_filled_p = 1;
4982 if (real_start)
4983 *real_start = i;
4984 x_compute_overhangs_and_x (t, head->x, 1); 4985 x_compute_overhangs_and_x (t, head->x, 1);
4985 x_prepend_glyph_string_lists (&head, &tail, h, t); 4986 x_prepend_glyph_string_lists (&head, &tail, h, t);
4986 } 4987 }
@@ -4997,8 +4998,6 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end,
4997 overlaps_p); 4998 overlaps_p);
4998 x_compute_overhangs_and_x (h, tail->x + tail->width, 0); 4999 x_compute_overhangs_and_x (h, tail->x + tail->width, 0);
4999 x_append_glyph_string_lists (&head, &tail, h, t); 5000 x_append_glyph_string_lists (&head, &tail, h, t);
5000 if (real_end)
5001 *real_end = i;
5002 } 5001 }
5003 5002
5004 /* Append glyph strings for glyphs following the last glyph 5003 /* Append glyph strings for glyphs following the last glyph
@@ -5016,8 +5015,6 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end,
5016 s->background_filled_p = 1; 5015 s->background_filled_p = 1;
5017 x_compute_overhangs_and_x (h, tail->x + tail->width, 0); 5016 x_compute_overhangs_and_x (h, tail->x + tail->width, 0);
5018 x_append_glyph_string_lists (&head, &tail, h, t); 5017 x_append_glyph_string_lists (&head, &tail, h, t);
5019 if (real_end)
5020 *real_end = i;
5021 } 5018 }
5022 } 5019 }
5023 5020
@@ -5025,6 +5022,24 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end,
5025 for (s = head; s; s = s->next) 5022 for (s = head; s; s = s->next)
5026 x_draw_glyph_string (s); 5023 x_draw_glyph_string (s);
5027 5024
5025 if (area == TEXT_AREA && !row->full_width_p)
5026 {
5027 int x0 = head ? head->x : x;
5028 int x1 = tail ? tail->x + tail->background_width : x;
5029
5030 x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0);
5031 x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1);
5032
5033 if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0)
5034 {
5035 int left_area_width = window_box_width (w, LEFT_MARGIN_AREA);
5036 x0 -= left_area_width;
5037 x1 -= left_area_width;
5038 }
5039
5040 notice_overwritten_cursor (w, x0, x1);
5041 }
5042
5028 /* Value is the x-position up to which drawn, relative to AREA of W. 5043 /* Value is the x-position up to which drawn, relative to AREA of W.
5029 This doesn't include parts drawn because of overhangs. */ 5044 This doesn't include parts drawn because of overhangs. */
5030 x_reached = FRAME_TO_WINDOW_PIXEL_X (w, x_reached); 5045 x_reached = FRAME_TO_WINDOW_PIXEL_X (w, x_reached);
@@ -5077,8 +5092,7 @@ x_fix_overlapping_area (w, row, area)
5077 && row->glyphs[area][i].overlaps_vertically_p); 5092 && row->glyphs[area][i].overlaps_vertically_p);
5078 5093
5079 x_draw_glyphs (w, start_x, row, area, start, i, 5094 x_draw_glyphs (w, start_x, row, area, start, i,
5080 DRAW_NORMAL_TEXT, 5095 DRAW_NORMAL_TEXT, 1);
5081 NULL, NULL, 1);
5082 } 5096 }
5083 else 5097 else
5084 { 5098 {
@@ -5102,7 +5116,7 @@ x_write_glyphs (start, len)
5102 struct glyph *start; 5116 struct glyph *start;
5103 int len; 5117 int len;
5104{ 5118{
5105 int x, hpos, real_start, real_end; 5119 int x, hpos;
5106 5120
5107 xassert (updated_window && updated_row); 5121 xassert (updated_window && updated_row);
5108 BLOCK_INPUT; 5122 BLOCK_INPUT;
@@ -5113,12 +5127,7 @@ x_write_glyphs (start, len)
5113 x = x_draw_glyphs (updated_window, output_cursor.x, 5127 x = x_draw_glyphs (updated_window, output_cursor.x,
5114 updated_row, updated_area, 5128 updated_row, updated_area,
5115 hpos, hpos + len, 5129 hpos, hpos + len,
5116 DRAW_NORMAL_TEXT, 5130 DRAW_NORMAL_TEXT, 0);
5117 &real_start, &real_end, 0);
5118
5119 /* If we drew over the cursor, note that it is not visible any more. */
5120 note_overwritten_text_cursor (updated_window, real_start,
5121 real_end - real_start);
5122 5131
5123 UNBLOCK_INPUT; 5132 UNBLOCK_INPUT;
5124 5133
@@ -5140,7 +5149,7 @@ x_insert_glyphs (start, len)
5140 int line_height, shift_by_width, shifted_region_width; 5149 int line_height, shift_by_width, shifted_region_width;
5141 struct glyph_row *row; 5150 struct glyph_row *row;
5142 struct glyph *glyph; 5151 struct glyph *glyph;
5143 int frame_x, frame_y, hpos, real_start, real_end; 5152 int frame_x, frame_y, hpos;
5144 HDC hdc; 5153 HDC hdc;
5145 5154
5146 xassert (updated_window && updated_row); 5155 xassert (updated_window && updated_row);
@@ -5173,9 +5182,8 @@ x_insert_glyphs (start, len)
5173 /* Write the glyphs. */ 5182 /* Write the glyphs. */
5174 hpos = start - row->glyphs[updated_area]; 5183 hpos = start - row->glyphs[updated_area];
5175 x_draw_glyphs (w, output_cursor.x, row, updated_area, hpos, hpos + len, 5184 x_draw_glyphs (w, output_cursor.x, row, updated_area, hpos, hpos + len,
5176 DRAW_NORMAL_TEXT, &real_start, &real_end, 0); 5185 DRAW_NORMAL_TEXT, 0);
5177 note_overwritten_text_cursor (w, real_start, real_end - real_start); 5186
5178
5179 /* Advance the output cursor. */ 5187 /* Advance the output cursor. */
5180 output_cursor.hpos += len; 5188 output_cursor.hpos += len;
5181 output_cursor.x += shift_by_width; 5189 output_cursor.x += shift_by_width;
@@ -5249,7 +5257,7 @@ x_clear_end_of_line (to_x)
5249 5257
5250 /* Notice if the cursor will be cleared by this operation. */ 5258 /* Notice if the cursor will be cleared by this operation. */
5251 if (!updated_row->full_width_p) 5259 if (!updated_row->full_width_p)
5252 note_overwritten_text_cursor (w, output_cursor.hpos, -1); 5260 notice_overwritten_cursor (w, output_cursor.x, -1);
5253 5261
5254 from_x = output_cursor.x; 5262 from_x = output_cursor.x;
5255 5263
@@ -5575,8 +5583,7 @@ expose_area (w, row, r, area)
5575 /* If row extends face to end of line write the whole line. */ 5583 /* If row extends face to end of line write the whole line. */
5576 x_draw_glyphs (w, 0, row, area, 5584 x_draw_glyphs (w, 0, row, area,
5577 0, row->used[area], 5585 0, row->used[area],
5578 DRAW_NORMAL_TEXT, 5586 DRAW_NORMAL_TEXT, 0);
5579 NULL, NULL, 0);
5580 else 5587 else
5581 { 5588 {
5582 /* Set START_X to the window-relative start position for drawing glyphs of 5589 /* Set START_X to the window-relative start position for drawing glyphs of
@@ -5614,8 +5621,7 @@ expose_area (w, row, r, area)
5614 x_draw_glyphs (w, first_x - start_x, row, area, 5621 x_draw_glyphs (w, first_x - start_x, row, area,
5615 first - row->glyphs[area], 5622 first - row->glyphs[area],
5616 last - row->glyphs[area], 5623 last - row->glyphs[area],
5617 DRAW_NORMAL_TEXT, 5624 DRAW_NORMAL_TEXT, 0);
5618 NULL, NULL, 0);
5619 } 5625 }
5620} 5626}
5621 5627
@@ -5634,7 +5640,7 @@ expose_line (w, row, r)
5634 5640
5635 if (row->mode_line_p || w->pseudo_window_p) 5641 if (row->mode_line_p || w->pseudo_window_p)
5636 x_draw_glyphs (w, 0, row, TEXT_AREA, 0, row->used[TEXT_AREA], 5642 x_draw_glyphs (w, 0, row, TEXT_AREA, 0, row->used[TEXT_AREA],
5637 DRAW_NORMAL_TEXT, NULL, NULL, 0); 5643 DRAW_NORMAL_TEXT, 0);
5638 else 5644 else
5639 { 5645 {
5640 if (row->used[LEFT_MARGIN_AREA]) 5646 if (row->used[LEFT_MARGIN_AREA])
@@ -6738,7 +6744,7 @@ note_mouse_highlight (f, x, y)
6738 { 6744 {
6739 Lisp_Object before = Foverlay_start (overlay); 6745 Lisp_Object before = Foverlay_start (overlay);
6740 Lisp_Object after = Foverlay_end (overlay); 6746 Lisp_Object after = Foverlay_end (overlay);
6741 Lisp_Object ignore; 6747 int ignore;
6742 6748
6743 /* Note that we might not be able to find position 6749 /* Note that we might not be able to find position
6744 BEFORE in the glyph matrix if the overlay is 6750 BEFORE in the glyph matrix if the overlay is
@@ -7344,81 +7350,58 @@ show_mouse_face (dpyinfo, draw)
7344{ 7350{
7345 struct window *w = XWINDOW (dpyinfo->mouse_face_window); 7351 struct window *w = XWINDOW (dpyinfo->mouse_face_window);
7346 struct frame *f = XFRAME (WINDOW_FRAME (w)); 7352 struct frame *f = XFRAME (WINDOW_FRAME (w));
7347 int i;
7348 int cursor_off_p = 0;
7349 struct cursor_pos saved_cursor;
7350
7351 saved_cursor = output_cursor;
7352 7353
7353 /* If window is in the process of being destroyed, don't bother 7354 if (/* If window is in the process of being destroyed, don't bother
7354 to do anything. */ 7355 to do anything. */
7355 if (w->current_matrix == NULL) 7356 w->current_matrix != NULL
7356 goto set_x_cursor; 7357 /* Recognize when we are called to operate on rows that don't exist
7357 7358 anymore. This can happen when a window is split. */
7358 /* Recognize when we are called to operate on rows that don't exist 7359 && dpyinfo->mouse_face_end_row < w->current_matrix->nrows)
7359 anymore. This can happen when a window is split. */ 7360 {
7360 if (dpyinfo->mouse_face_end_row >= w->current_matrix->nrows) 7361 int phys_cursor_on_p = w->phys_cursor_on_p;
7361 goto set_x_cursor; 7362 struct glyph_row *row, *first, *last;
7362 7363
7363 set_output_cursor (&w->phys_cursor); 7364 first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row);
7364 7365 last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row);
7365 /* Note that mouse_face_beg_row etc. are window relative. */ 7366
7366 for (i = dpyinfo->mouse_face_beg_row; 7367 for (row = first; row <= last && row->enabled_p; ++row)
7367 i <= dpyinfo->mouse_face_end_row; 7368 {
7368 i++) 7369 int start_hpos, end_hpos, start_x;
7369 {
7370 int start_hpos, end_hpos, start_x;
7371 struct glyph_row *row = MATRIX_ROW (w->current_matrix, i);
7372 7370
7373 /* Don't do anything if row doesn't have valid contents. */ 7371 /* For all but the first row, the highlight starts at column 0. */
7374 if (!row->enabled_p) 7372 if (row == first)
7375 continue; 7373 {
7374 start_hpos = dpyinfo->mouse_face_beg_col;
7375 start_x = dpyinfo->mouse_face_beg_x;
7376 }
7377 else
7378 {
7379 start_hpos = 0;
7380 start_x = 0;
7381 }
7376 7382
7377 /* For all but the first row, the highlight starts at column 0. */ 7383 if (row == last)
7378 if (i == dpyinfo->mouse_face_beg_row) 7384 end_hpos = dpyinfo->mouse_face_end_col;
7379 { 7385 else
7380 start_hpos = dpyinfo->mouse_face_beg_col; 7386 end_hpos = row->used[TEXT_AREA];
7381 start_x = dpyinfo->mouse_face_beg_x;
7382 }
7383 else
7384 {
7385 start_hpos = 0;
7386 start_x = 0;
7387 }
7388 7387
7389 if (i == dpyinfo->mouse_face_end_row) 7388 if (end_hpos > start_hpos)
7390 end_hpos = dpyinfo->mouse_face_end_col; 7389 {
7391 else 7390 x_draw_glyphs (w, start_x, row, TEXT_AREA,
7392 end_hpos = row->used[TEXT_AREA]; 7391 start_hpos, end_hpos, draw, 0);
7393 7392
7394 /* If the cursor's in the text we are about to rewrite, turn the 7393 row->mouse_face_p = draw == DRAW_MOUSE_FACE || DRAW_IMAGE_RAISED;
7395 cursor off. */ 7394 }
7396 if (!w->pseudo_window_p
7397 && i == output_cursor.vpos
7398 && output_cursor.hpos >= start_hpos - 1
7399 && output_cursor.hpos <= end_hpos)
7400 {
7401 x_update_window_cursor (w, 0);
7402 cursor_off_p = 1;
7403 } 7395 }
7404 7396
7405 if (end_hpos > start_hpos) 7397 /* When we've written over the cursor, arrange for it to
7406 { 7398 be displayed again. */
7407 x_draw_glyphs (w, start_x, row, TEXT_AREA, 7399 if (phys_cursor_on_p && !w->phys_cursor_on_p)
7408 start_hpos, end_hpos, draw, NULL, NULL, 0); 7400 x_display_cursor (w, 1,
7409 row->mouse_face_p = draw == DRAW_MOUSE_FACE || DRAW_IMAGE_RAISED; 7401 w->phys_cursor.hpos, w->phys_cursor.vpos,
7410 } 7402 w->phys_cursor.x, w->phys_cursor.y);
7411 } 7403 }
7412 7404
7413 /* If we turned the cursor off, turn it back on. */
7414 if (cursor_off_p)
7415 x_display_cursor (w, 1,
7416 output_cursor.hpos, output_cursor.vpos,
7417 output_cursor.x, output_cursor.y);
7418
7419 output_cursor = saved_cursor;
7420
7421 set_x_cursor:
7422#if 0 /* TODO: mouse cursor */ 7405#if 0 /* TODO: mouse cursor */
7423 /* Change the mouse cursor. */ 7406 /* Change the mouse cursor. */
7424 if (draw == DRAW_NORMAL_TEXT) 7407 if (draw == DRAW_NORMAL_TEXT)
@@ -7431,7 +7414,6 @@ show_mouse_face (dpyinfo, draw)
7431 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 7414 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
7432 f->output_data.x->nontext_cursor); 7415 f->output_data.x->nontext_cursor);
7433#endif 7416#endif
7434 ;
7435} 7417}
7436 7418
7437/* Clear out the mouse-highlighted active region. 7419/* Clear out the mouse-highlighted active region.
@@ -7521,7 +7503,6 @@ glyph_rect (f, x, y, rect)
7521 struct window *w = XWINDOW (window); 7503 struct window *w = XWINDOW (window);
7522 struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 7504 struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
7523 struct glyph_row *end = r + w->current_matrix->nrows - 1; 7505 struct glyph_row *end = r + w->current_matrix->nrows - 1;
7524 int area;
7525 7506
7526 frame_to_window_pixel_xy (w, &x, &y); 7507 frame_to_window_pixel_xy (w, &x, &y);
7527 7508
@@ -8004,7 +7985,7 @@ w32_set_vertical_scroll_bar (w, portion, whole, position)
8004 { 7985 {
8005 HDC hdc; 7986 HDC hdc;
8006 BLOCK_INPUT; 7987 BLOCK_INPUT;
8007 if (width && height) 7988 if (width > 0 && height > 0)
8008 { 7989 {
8009 hdc = get_frame_dc (f); 7990 hdc = get_frame_dc (f);
8010 w32_clear_area (f, hdc, left, top, width, height); 7991 w32_clear_area (f, hdc, left, top, width, height);
@@ -9152,21 +9133,22 @@ w32_read_socket (sd, bufp, numchars, expected)
9152 Text Cursor 9133 Text Cursor
9153 ***********************************************************************/ 9134 ***********************************************************************/
9154 9135
9155/* Note if the text cursor of window W has been overwritten by a 9136/* Notice if the text cursor of window W has been overwritten by a
9156 drawing operation that outputs N glyphs starting at HPOS in the 9137 drawing operation that outputs glyphs starting at START_X and
9157 line given by output_cursor.vpos. N < 0 means all the rest of the 9138 ending at END_X in the line given by output_cursor.vpos.
9158 line after HPOS has been written. */ 9139 Coordinates are area-relative. END_X < 0 means all the rest
9140 of the line after START_X has been written. */
9159 9141
9160static void 9142static void
9161note_overwritten_text_cursor (w, hpos, n) 9143notice_overwritten_cursor (w, start_x, end_x)
9162 struct window *w; 9144 struct window *w;
9163 int hpos, n; 9145 int start_x, end_x;
9164{ 9146{
9165 if (updated_area == TEXT_AREA 9147 if (updated_area == TEXT_AREA
9148 && w->phys_cursor_on_p
9166 && output_cursor.vpos == w->phys_cursor.vpos 9149 && output_cursor.vpos == w->phys_cursor.vpos
9167 && hpos <= w->phys_cursor.hpos 9150 && start_x <= w->phys_cursor.x
9168 && (n < 0 9151 && (end_x < 0 || end_x > w->phys_cursor.x))
9169 || hpos + n > w->phys_cursor.hpos))
9170 w->phys_cursor_on_p = 0; 9152 w->phys_cursor_on_p = 0;
9171} 9153}
9172 9154
@@ -9292,14 +9274,24 @@ x_draw_bar_cursor (w, row, width)
9292 } 9274 }
9293 else 9275 else
9294 { 9276 {
9277 COLORREF cursor_color = f->output_data.w32->cursor_pixel;
9278 struct face *face = FACE_FROM_ID (f, cursor_glyph->face_id);
9279
9295 if (width < 0) 9280 if (width < 0)
9296 width = f->output_data.w32->cursor_width; 9281 width = f->output_data.w32->cursor_width;
9297 9282
9283 /* If the glyph's background equals the color we normally draw
9284 the bar cursor in, the bar cursor in its normal color is
9285 invisible. Use the glyph's foreground color instead in this
9286 case, on the assumption that the glyph's colors are chosen so
9287 that the glyph is legible. */
9288 if (face->background == cursor_color)
9289 cursor_color = face->foreground;
9290
9298 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 9291 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
9299 hdc = get_frame_dc (f); 9292 hdc = get_frame_dc (f);
9300 w32_clip_to_row (w, row, hdc, 0); 9293 w32_clip_to_row (w, row, hdc, 0);
9301 w32_fill_area (f, hdc, f->output_data.w32->cursor_pixel, 9294 w32_fill_area (f, hdc, cursor_color, x,
9302 x,
9303 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), 9295 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
9304 min (cursor_glyph->pixel_width, width), 9296 min (cursor_glyph->pixel_width, width),
9305 row->height); 9297 row->height);
@@ -9335,9 +9327,11 @@ x_draw_phys_cursor_glyph (w, row, hl)
9335 glyphs and mini-buffer. */ 9327 glyphs and mini-buffer. */
9336 if (w->phys_cursor.hpos < row->used[TEXT_AREA]) 9328 if (w->phys_cursor.hpos < row->used[TEXT_AREA])
9337 { 9329 {
9330 int on_p = w->phys_cursor_on_p;
9338 x_draw_glyphs (w, w->phys_cursor.x, row, TEXT_AREA, 9331 x_draw_glyphs (w, w->phys_cursor.x, row, TEXT_AREA,
9339 w->phys_cursor.hpos, w->phys_cursor.hpos + 1, 9332 w->phys_cursor.hpos, w->phys_cursor.hpos + 1,
9340 hl, 0, 0, 0); 9333 hl, 0);
9334 w->phys_cursor_on_p = on_p;
9341 9335
9342 /* When we erase the cursor, and ROW is overlapped by other 9336 /* When we erase the cursor, and ROW is overlapped by other
9343 rows, make sure that these overlapping parts of other rows 9337 rows, make sure that these overlapping parts of other rows
@@ -9541,7 +9535,10 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
9541 new_cursor_type = FRAME_DESIRED_CURSOR (f); 9535 new_cursor_type = FRAME_DESIRED_CURSOR (f);
9542 else 9536 else
9543 { 9537 {
9544 new_cursor_type = HOLLOW_BOX_CURSOR; 9538 if (cursor_non_selected)
9539 new_cursor_type = HOLLOW_BOX_CURSOR;
9540 else
9541 new_cursor_type = NO_CURSOR;
9545 active_cursor = 0; 9542 active_cursor = 0;
9546 } 9543 }
9547 } 9544 }