diff options
| author | Adrian Robert | 2011-03-07 11:00:11 +0200 |
|---|---|---|
| committer | Adrian Robert | 2011-03-07 11:00:11 +0200 |
| commit | cf715c3c952706b13fe4a9a9279739b7ed480a15 (patch) | |
| tree | 0cce18f3d592a7029d21111b3d6b95037b814379 /src | |
| parent | 7e319d3cc31d6735616e9f68c81042b4920e43e8 (diff) | |
| download | emacs-cf715c3c952706b13fe4a9a9279739b7ed480a15.tar.gz emacs-cf715c3c952706b13fe4a9a9279739b7ed480a15.zip | |
* nsterm.m (ns_draw_window_cursor): Fix handling of 'cursor_width' parameter for hbar cursors. Based on a patch by Ben Key <bkey76@gmail.com>.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/nsterm.m | 18 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d7131096995..7fbf3e1ef6c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2011-03-07 Adrian Robert <Adrian.B.Robert@gmail.com> | ||
| 2 | |||
| 3 | * nsterm.m (ns_draw_window_cursor): Fix handling of "cursor_width" | ||
| 4 | parameter for hbar cursors. Based on a patch by Ben Key | ||
| 5 | <bkey76@gmail.com>. | ||
| 6 | |||
| 1 | 2011-03-06 Chong Yidong <cyd@stupidchicken.com> | 7 | 2011-03-06 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 8 | ||
| 3 | * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 | 9 | * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 |
diff --git a/src/nsterm.m b/src/nsterm.m index cc2c4cf9807..c7cd411c614 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -2235,7 +2235,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2235 | -------------------------------------------------------------------------- */ | 2235 | -------------------------------------------------------------------------- */ |
| 2236 | { | 2236 | { |
| 2237 | NSRect r, s; | 2237 | NSRect r, s; |
| 2238 | int fx, fy, h; | 2238 | int fx, fy, h, cursor_height; |
| 2239 | struct frame *f = WINDOW_XFRAME (w); | 2239 | struct frame *f = WINDOW_XFRAME (w); |
| 2240 | struct glyph *phys_cursor_glyph; | 2240 | struct glyph *phys_cursor_glyph; |
| 2241 | int overspill; | 2241 | int overspill; |
| @@ -2279,13 +2279,20 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2279 | get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h); | 2279 | get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h); |
| 2280 | 2280 | ||
| 2281 | /* The above get_phys_cursor_geometry call set w->phys_cursor_width | 2281 | /* The above get_phys_cursor_geometry call set w->phys_cursor_width |
| 2282 | to the glyph width; replace with CURSOR_WIDTH for bar cursors. */ | 2282 | to the glyph width; replace with CURSOR_WIDTH for (V)BAR cursors. */ |
| 2283 | if (cursor_type == BAR_CURSOR || cursor_type == HBAR_CURSOR) | 2283 | if (cursor_type == BAR_CURSOR) |
| 2284 | { | 2284 | { |
| 2285 | if (cursor_width < 1) | 2285 | if (cursor_width < 1) |
| 2286 | cursor_width = max (FRAME_CURSOR_WIDTH (f), 1); | 2286 | cursor_width = max (FRAME_CURSOR_WIDTH (f), 1); |
| 2287 | w->phys_cursor_width = cursor_width; | 2287 | w->phys_cursor_width = cursor_width; |
| 2288 | } | 2288 | } |
| 2289 | /* If we have an HBAR, "cursor_width" MAY specify height. */ | ||
| 2290 | else if (cursor_type == HBAR_CURSOR) | ||
| 2291 | { | ||
| 2292 | cursor_height = (cursor_width < 1) ? lrint (0.25 * h) : cursor_width; | ||
| 2293 | fy += h - cursor_height; | ||
| 2294 | h = cursor_height; | ||
| 2295 | } | ||
| 2289 | 2296 | ||
| 2290 | r.origin.x = fx, r.origin.y = fy; | 2297 | r.origin.x = fx, r.origin.y = fy; |
| 2291 | r.size.height = h; | 2298 | r.size.height = h; |
| @@ -2337,10 +2344,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2337 | [FRAME_CURSOR_COLOR (f) set]; | 2344 | [FRAME_CURSOR_COLOR (f) set]; |
| 2338 | break; | 2345 | break; |
| 2339 | case HBAR_CURSOR: | 2346 | case HBAR_CURSOR: |
| 2340 | s = r; | 2347 | NSRectFill (r); |
| 2341 | s.origin.y += lrint (0.75 * s.size.height); | ||
| 2342 | s.size.height = lrint (s.size.height * 0.25); | ||
| 2343 | NSRectFill (s); | ||
| 2344 | break; | 2348 | break; |
| 2345 | case BAR_CURSOR: | 2349 | case BAR_CURSOR: |
| 2346 | s = r; | 2350 | s = r; |