diff options
| author | Jason Rumney | 2009-04-19 15:09:25 +0000 |
|---|---|---|
| committer | Jason Rumney | 2009-04-19 15:09:25 +0000 |
| commit | 705af33f7ed44c4cc71165d45836f0b5a769f27d (patch) | |
| tree | 4b115f73346b1ae99c2987225d655d5dfe495435 /src | |
| parent | dc2933ebde70fc2c236e352d6ae8d548568f1eb1 (diff) | |
| download | emacs-705af33f7ed44c4cc71165d45836f0b5a769f27d.tar.gz emacs-705af33f7ed44c4cc71165d45836f0b5a769f27d.zip | |
The following changes fix Bug#3005 for wide glyphs on each platform,
without reintroducing Bug#1258 for stretch glyphs.
* xterm.c (x_draw_bar_cursor): Limit cursor width differently for
BAR_CURSOR and HBAR_CURSOR. Calculate width of HBAR_CURSOR using
get_phys_cursor_geometry.
* w32term.c (x_draw_bar_cursor): Limit cursor width differently
for BAR_CURSOR and HBAR_CURSOR. Calculate width of HBAR_CURSOR
using get_phys_cursor_geometry.
* nsterm.m (ns_draw_window_cursor): HBAR_CURSOR width already
correctly calculated.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 16 | ||||
| -rw-r--r-- | src/nsterm.m | 1 | ||||
| -rw-r--r-- | src/w32term.c | 29 | ||||
| -rw-r--r-- | src/xterm.c | 30 |
4 files changed, 56 insertions, 20 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5c66a973443..cdde8a597f2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | 2009-04-19 Jason Rumney <jasonr@gnu.org> | ||
| 2 | |||
| 3 | The following changes fix Bug#3005 for wide glyphs on each platform, | ||
| 4 | without reintroducing Bug#1258 for stretch glyphs. | ||
| 5 | |||
| 6 | * xterm.c (x_draw_bar_cursor): Limit cursor width differently for | ||
| 7 | BAR_CURSOR and HBAR_CURSOR. Calculate width of HBAR_CURSOR using | ||
| 8 | get_phys_cursor_geometry. | ||
| 9 | |||
| 10 | * w32term.c (x_draw_bar_cursor): Limit cursor width differently | ||
| 11 | for BAR_CURSOR and HBAR_CURSOR. Calculate width of HBAR_CURSOR | ||
| 12 | using get_phys_cursor_geometry. | ||
| 13 | |||
| 14 | * nsterm.m (ns_draw_window_cursor): HBAR_CURSOR width already | ||
| 15 | correctly calculated. | ||
| 16 | |||
| 1 | 2009-04-19 Jan Djärv <jan.h.d@swipnet.se> | 17 | 2009-04-19 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 18 | ||
| 3 | * gtkutil.c (xg_tool_bar_menu_proxy, update_frame_tool_bar): Use | 19 | * gtkutil.c (xg_tool_bar_menu_proxy, update_frame_tool_bar): Use |
diff --git a/src/nsterm.m b/src/nsterm.m index 07acc8d8013..5085679e04a 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -2412,7 +2412,6 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2412 | case HBAR_CURSOR: | 2412 | case HBAR_CURSOR: |
| 2413 | s = r; | 2413 | s = r; |
| 2414 | s.origin.y += lrint (0.75 * s.size.height); | 2414 | s.origin.y += lrint (0.75 * s.size.height); |
| 2415 | s.size.width = min (FRAME_COLUMN_WIDTH (f), s.size.width); | ||
| 2416 | s.size.height = lrint (s.size.height * 0.25); | 2415 | s.size.height = lrint (s.size.height * 0.25); |
| 2417 | NSRectFill (s); | 2416 | NSRectFill (s); |
| 2418 | break; | 2417 | break; |
diff --git a/src/w32term.c b/src/w32term.c index bc76ac58d1a..f38895b6312 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -4970,8 +4970,6 @@ x_draw_bar_cursor (w, row, width, kind) | |||
| 4970 | { | 4970 | { |
| 4971 | struct frame *f = XFRAME (w->frame); | 4971 | struct frame *f = XFRAME (w->frame); |
| 4972 | struct glyph *cursor_glyph; | 4972 | struct glyph *cursor_glyph; |
| 4973 | int x; | ||
| 4974 | HDC hdc; | ||
| 4975 | 4973 | ||
| 4976 | /* If cursor is out of bounds, don't draw garbage. This can happen | 4974 | /* If cursor is out of bounds, don't draw garbage. This can happen |
| 4977 | in mini-buffer windows when switching between echo area glyphs | 4975 | in mini-buffer windows when switching between echo area glyphs |
| @@ -4993,6 +4991,8 @@ x_draw_bar_cursor (w, row, width, kind) | |||
| 4993 | { | 4991 | { |
| 4994 | COLORREF cursor_color = f->output_data.w32->cursor_pixel; | 4992 | COLORREF cursor_color = f->output_data.w32->cursor_pixel; |
| 4995 | struct face *face = FACE_FROM_ID (f, cursor_glyph->face_id); | 4993 | struct face *face = FACE_FROM_ID (f, cursor_glyph->face_id); |
| 4994 | int x; | ||
| 4995 | HDC hdc; | ||
| 4996 | 4996 | ||
| 4997 | /* If the glyph's background equals the color we normally draw | 4997 | /* If the glyph's background equals the color we normally draw |
| 4998 | the bar cursor in, the bar cursor in its normal color is | 4998 | the bar cursor in, the bar cursor in its normal color is |
| @@ -5004,29 +5004,36 @@ x_draw_bar_cursor (w, row, width, kind) | |||
| 5004 | 5004 | ||
| 5005 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 5005 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); |
| 5006 | 5006 | ||
| 5007 | if (width < 0) | ||
| 5008 | width = FRAME_CURSOR_WIDTH (f); | ||
| 5009 | width = min (cursor_glyph->pixel_width, width); | ||
| 5010 | |||
| 5011 | w->phys_cursor_width = width; | ||
| 5012 | |||
| 5013 | |||
| 5014 | hdc = get_frame_dc (f); | 5007 | hdc = get_frame_dc (f); |
| 5015 | w32_clip_to_row (w, row, TEXT_AREA, hdc); | 5008 | w32_clip_to_row (w, row, TEXT_AREA, hdc); |
| 5016 | 5009 | ||
| 5017 | if (kind == BAR_CURSOR) | 5010 | if (kind == BAR_CURSOR) |
| 5018 | { | 5011 | { |
| 5012 | if (width < 0) | ||
| 5013 | width = FRAME_CURSOR_WIDTH (f); | ||
| 5014 | width = min (cursor_glyph->pixel_width, width); | ||
| 5015 | |||
| 5016 | w->phys_cursor_width = width; | ||
| 5017 | |||
| 5019 | w32_fill_area (f, hdc, cursor_color, x, | 5018 | w32_fill_area (f, hdc, cursor_color, x, |
| 5020 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), | 5019 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
| 5021 | width, row->height); | 5020 | width, row->height); |
| 5022 | } | 5021 | } |
| 5023 | else | 5022 | else |
| 5024 | { | 5023 | { |
| 5024 | int dummy_x, dummy_y, dummy_h; | ||
| 5025 | |||
| 5026 | if (width < 0) | ||
| 5027 | width = row->height; | ||
| 5028 | |||
| 5029 | width = min (row->height, width); | ||
| 5030 | |||
| 5031 | get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x, | ||
| 5032 | &dummy_y, &dummy_h); | ||
| 5025 | w32_fill_area (f, hdc, cursor_color, x, | 5033 | w32_fill_area (f, hdc, cursor_color, x, |
| 5026 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + | 5034 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + |
| 5027 | row->height - width), | 5035 | row->height - width), |
| 5028 | min (FRAME_COLUMN_WIDTH (f), cursor_glyph->pixel_width), | 5036 | w->phys_cursor_width, width); |
| 5029 | width); | ||
| 5030 | } | 5037 | } |
| 5031 | 5038 | ||
| 5032 | w32_set_clip_rectangle (hdc, NULL); | 5039 | w32_set_clip_rectangle (hdc, NULL); |
diff --git a/src/xterm.c b/src/xterm.c index 76beb62e4e3..e5f8a0c17c9 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -7426,7 +7426,7 @@ x_draw_bar_cursor (w, row, width, kind) | |||
| 7426 | XGCValues xgcv; | 7426 | XGCValues xgcv; |
| 7427 | 7427 | ||
| 7428 | /* If the glyph's background equals the color we normally draw | 7428 | /* If the glyph's background equals the color we normally draw |
| 7429 | the bar cursor in, the bar cursor in its normal color is | 7429 | the bars cursor in, the bar cursor in its normal color is |
| 7430 | invisible. Use the glyph's foreground color instead in this | 7430 | invisible. Use the glyph's foreground color instead in this |
| 7431 | case, on the assumption that the glyph's colors are chosen so | 7431 | case, on the assumption that the glyph's colors are chosen so |
| 7432 | that the glyph is legible. */ | 7432 | that the glyph is legible. */ |
| @@ -7444,25 +7444,39 @@ x_draw_bar_cursor (w, row, width, kind) | |||
| 7444 | FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc = gc; | 7444 | FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc = gc; |
| 7445 | } | 7445 | } |
| 7446 | 7446 | ||
| 7447 | if (width < 0) | ||
| 7448 | width = FRAME_CURSOR_WIDTH (f); | ||
| 7449 | width = min (cursor_glyph->pixel_width, width); | ||
| 7450 | |||
| 7451 | w->phys_cursor_width = width; | ||
| 7452 | x_clip_to_row (w, row, TEXT_AREA, gc); | 7447 | x_clip_to_row (w, row, TEXT_AREA, gc); |
| 7453 | 7448 | ||
| 7454 | if (kind == BAR_CURSOR) | 7449 | if (kind == BAR_CURSOR) |
| 7450 | { | ||
| 7451 | if (width < 0) | ||
| 7452 | width = FRAME_CURSOR_WIDTH (f); | ||
| 7453 | width = min (cursor_glyph->pixel_width, width); | ||
| 7454 | |||
| 7455 | w->phys_cursor_width = width; | ||
| 7456 | |||
| 7455 | XFillRectangle (dpy, window, gc, | 7457 | XFillRectangle (dpy, window, gc, |
| 7456 | WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), | 7458 | WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), |
| 7457 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), | 7459 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
| 7458 | width, row->height); | 7460 | width, row->height); |
| 7461 | } | ||
| 7459 | else | 7462 | else |
| 7463 | { | ||
| 7464 | int dummy_x, dummy_y, dummy_h; | ||
| 7465 | |||
| 7466 | if (width < 0) | ||
| 7467 | width = row->height; | ||
| 7468 | |||
| 7469 | width = min (row->height, width); | ||
| 7470 | |||
| 7471 | get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x, | ||
| 7472 | &dummy_y, &dummy_h); | ||
| 7473 | |||
| 7460 | XFillRectangle (dpy, window, gc, | 7474 | XFillRectangle (dpy, window, gc, |
| 7461 | WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), | 7475 | WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), |
| 7462 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + | 7476 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + |
| 7463 | row->height - width), | 7477 | row->height - width), |
| 7464 | min (FRAME_COLUMN_WIDTH (f), cursor_glyph->pixel_width), | 7478 | w->phys_cursor_width, width); |
| 7465 | width); | 7479 | } |
| 7466 | 7480 | ||
| 7467 | XSetClipMask (dpy, gc, None); | 7481 | XSetClipMask (dpy, gc, None); |
| 7468 | } | 7482 | } |