Mercurial > emacs
comparison src/w32term.c @ 59748:1df465faf1df
(x_draw_hollow_cursor): Use get_phys_cursor_geometry.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Thu, 27 Jan 2005 22:33:39 +0000 |
parents | 369714ad80ed |
children | 03a8b8b9ebef 3dcba0bc766b f8a7a9ba3d08 |
comparison
equal
deleted
inserted
replaced
59747:40cb8cb02621 | 59748:1df465faf1df |
---|---|
4935 struct glyph_row *row; | 4935 struct glyph_row *row; |
4936 { | 4936 { |
4937 struct frame *f = XFRAME (WINDOW_FRAME (w)); | 4937 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
4938 HDC hdc; | 4938 HDC hdc; |
4939 RECT rect; | 4939 RECT rect; |
4940 int wd, h; | 4940 int h; |
4941 struct glyph *cursor_glyph; | 4941 struct glyph *cursor_glyph; |
4942 HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel); | 4942 HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel); |
4943 | 4943 |
4944 /* Get the glyph the cursor is on. If we can't tell because | 4944 /* Get the glyph the cursor is on. If we can't tell because |
4945 the current matrix is invalid or such, give up. */ | 4945 the current matrix is invalid or such, give up. */ |
4946 cursor_glyph = get_phys_cursor_glyph (w); | 4946 cursor_glyph = get_phys_cursor_glyph (w); |
4947 if (cursor_glyph == NULL) | 4947 if (cursor_glyph == NULL) |
4948 return; | 4948 return; |
4949 | 4949 |
4950 /* Compute frame-relative coordinates from window-relative | 4950 /* Compute frame-relative coordinates for phys cursor. */ |
4951 coordinates. */ | |
4952 rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 4951 rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); |
4953 rect.top = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y) | 4952 rect.top = get_phys_cursor_geometry (w, row, cursor_glyph, &h); |
4954 + row->ascent - w->phys_cursor_ascent); | |
4955 | |
4956 /* Compute the proper height and ascent of the rectangle, based | |
4957 on the actual glyph. Using the full height of the row looks | |
4958 bad when there are tall images on that row. */ | |
4959 h = max (min (FRAME_LINE_HEIGHT (f), row->height), | |
4960 cursor_glyph->ascent + cursor_glyph->descent); | |
4961 if (h < row->height) | |
4962 rect.top += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h; | |
4963 h--; | |
4964 | |
4965 rect.bottom = rect.top + h; | 4953 rect.bottom = rect.top + h; |
4966 | 4954 rect.right = rect.left + w->phys_cursor_width; |
4967 /* Compute the width of the rectangle to draw. If on a stretch | 4955 |
4968 glyph, and `x-stretch-block-cursor' is nil, don't draw a | |
4969 rectangle as wide as the glyph, but use a canonical character | |
4970 width instead. */ | |
4971 wd = cursor_glyph->pixel_width; /* TODO: Why off by one compared with X? */ | |
4972 if (cursor_glyph->type == STRETCH_GLYPH | |
4973 && !x_stretch_cursor_p) | |
4974 wd = min (FRAME_COLUMN_WIDTH (f), wd); | |
4975 w->phys_cursor_width = wd; | |
4976 | |
4977 rect.right = rect.left + wd; | |
4978 hdc = get_frame_dc (f); | 4956 hdc = get_frame_dc (f); |
4979 /* Set clipping, draw the rectangle, and reset clipping again. */ | 4957 /* Set clipping, draw the rectangle, and reset clipping again. */ |
4980 w32_clip_to_row (w, row, TEXT_AREA, hdc); | 4958 w32_clip_to_row (w, row, TEXT_AREA, hdc); |
4981 FrameRect (hdc, &rect, hb); | 4959 FrameRect (hdc, &rect, hb); |
4982 DeleteObject (hb); | 4960 DeleteObject (hb); |