diff options
| author | Jan Djärv | 2012-09-08 14:48:33 +0200 |
|---|---|---|
| committer | Jan Djärv | 2012-09-08 14:48:33 +0200 |
| commit | aa7d57c5079024458c5e25cd5f304d1b967bcbe6 (patch) | |
| tree | 993f2b96f8ab28bac99660b97613930c1beaa4d2 /src | |
| parent | a30cb5dd2cc88d0c38566ee256ac81856a904150 (diff) | |
| download | emacs-aa7d57c5079024458c5e25cd5f304d1b967bcbe6.tar.gz emacs-aa7d57c5079024458c5e25cd5f304d1b967bcbe6.zip | |
* nsterm.h (EmacsView): Add updateFrameSize.
* nsterm.m (ns_clip_to_row): Remove code that deals with drawing fringe
in the internal border.
(x_set_window_size): Remove static variables and their usage.
(ns_redraw_scroll_bars): Fix NSTRACE arg.
(ns_after_update_window_line, ns_draw_fringe_bitmap): Remove
fringe/internal border adjustment.
(ns_draw_fringe_bitmap): Make code more like other terms (xterm.c).
(ns_draw_window_cursor): Remove fringe/internal border adjustment.
(ns_fix_rect_ibw): Remove.
(ns_get_glyph_string_clip_rect): Remove call to ns_fix_rect_ibw.
(ns_dumpglyphs_box_or_relief): Ditto.
(ns_maybe_dumpglyphs_background): Remove fringe/internal border
adjustment.
(ns_dumpglyphs_image): Ditto.
(ns_dumpglyphs_stretch): Fix coding style. Remove fringe/internal
border adjustment.
(ns_set_vertical_scroll_bar): Remove variables barOnVeryLeft/Right and
their usage. Add fringe_extended_p and its use as in other terms.
(ns_judge_scroll_bars): Code style fix. Call updateFrameSize if
scroll bar was removed.
(updateFrameSize): New function.
(windowDidResize): Move code to updateFrameSize and call it.
Fixes: debbugs:11052
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 27 | ||||
| -rw-r--r-- | src/nsterm.h | 1 | ||||
| -rw-r--r-- | src/nsterm.m | 332 |
3 files changed, 170 insertions, 190 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index bdbc97fdb1c..40647d79589 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,30 @@ | |||
| 1 | 2012-09-08 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * nsterm.m (ns_clip_to_row): Remove code that deals with drawing fringe | ||
| 4 | in the internal border. | ||
| 5 | (x_set_window_size): Remove static variables and their usage. | ||
| 6 | (ns_redraw_scroll_bars): Fix NSTRACE arg. | ||
| 7 | (ns_after_update_window_line, ns_draw_fringe_bitmap): Remove | ||
| 8 | fringe/internal border adjustment (Bug#11052). | ||
| 9 | (ns_draw_fringe_bitmap): Make code more like other terms (xterm.c). | ||
| 10 | (ns_draw_window_cursor): Remove fringe/internal border adjustment. | ||
| 11 | (ns_fix_rect_ibw): Remove. | ||
| 12 | (ns_get_glyph_string_clip_rect): Remove call to ns_fix_rect_ibw. | ||
| 13 | (ns_dumpglyphs_box_or_relief): Ditto. | ||
| 14 | (ns_maybe_dumpglyphs_background): Remove fringe/internal border | ||
| 15 | adjustment. | ||
| 16 | (ns_dumpglyphs_image): Ditto. | ||
| 17 | (ns_dumpglyphs_stretch): Fix coding style. Remove fringe/internal | ||
| 18 | border adjustment. | ||
| 19 | (ns_set_vertical_scroll_bar): Remove variables barOnVeryLeft/Right and | ||
| 20 | their usage. Add fringe_extended_p and its use as in other terms. | ||
| 21 | (ns_judge_scroll_bars): Code style fix. Call updateFrameSize if | ||
| 22 | scroll bar was removed. | ||
| 23 | (updateFrameSize): New function. | ||
| 24 | (windowDidResize): Move code to updateFrameSize and call it. | ||
| 25 | |||
| 26 | * nsterm.h (EmacsView): Add updateFrameSize. | ||
| 27 | |||
| 1 | 2012-09-07 Chong Yidong <cyd@gnu.org> | 28 | 2012-09-07 Chong Yidong <cyd@gnu.org> |
| 2 | 29 | ||
| 3 | * textprop.c (Fget_text_property): Minor doc fix (Bug#12323). | 30 | * textprop.c (Fget_text_property): Minor doc fix (Bug#12323). |
diff --git a/src/nsterm.h b/src/nsterm.h index f0cae193005..b1836692b2c 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -103,6 +103,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 103 | - (void) setWindowClosing: (BOOL)closing; | 103 | - (void) setWindowClosing: (BOOL)closing; |
| 104 | - (EmacsToolbar *) toolbar; | 104 | - (EmacsToolbar *) toolbar; |
| 105 | - (void) deleteWorkingText; | 105 | - (void) deleteWorkingText; |
| 106 | - (void) updateFrameSize; | ||
| 106 | 107 | ||
| 107 | #ifdef NS_IMPL_GNUSTEP | 108 | #ifdef NS_IMPL_GNUSTEP |
| 108 | /* Not declared, but useful. */ | 109 | /* Not declared, but useful. */ |
diff --git a/src/nsterm.m b/src/nsterm.m index a7d6732d5bd..73372238cf4 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -871,25 +871,12 @@ ns_clip_to_row (struct window *w, struct glyph_row *row, int area, BOOL gc) | |||
| 871 | 871 | ||
| 872 | window_box (w, area, &window_x, &window_y, &window_width, 0); | 872 | window_box (w, area, &window_x, &window_y, &window_width, 0); |
| 873 | 873 | ||
| 874 | clip_rect.origin.x = window_x - FRAME_INTERNAL_BORDER_WIDTH (f); | 874 | clip_rect.origin.x = window_x; |
| 875 | clip_rect.origin.y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, row->y)); | 875 | clip_rect.origin.y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, row->y)); |
| 876 | clip_rect.origin.y = max (clip_rect.origin.y, window_y); | 876 | clip_rect.origin.y = max (clip_rect.origin.y, window_y); |
| 877 | clip_rect.size.width = window_width + 2 * FRAME_INTERNAL_BORDER_WIDTH (f); | 877 | clip_rect.size.width = window_width; |
| 878 | clip_rect.size.height = row->visible_height; | 878 | clip_rect.size.height = row->visible_height; |
| 879 | 879 | ||
| 880 | /* allow a full-height row at the top when requested | ||
| 881 | (used to draw fringe all the way through internal border area) */ | ||
| 882 | if (gc && clip_rect.origin.y < 5) | ||
| 883 | { | ||
| 884 | clip_rect.origin.y -= FRAME_INTERNAL_BORDER_WIDTH (f); | ||
| 885 | clip_rect.size.height += FRAME_INTERNAL_BORDER_WIDTH (f); | ||
| 886 | } | ||
| 887 | |||
| 888 | /* likewise at bottom */ | ||
| 889 | if (gc && | ||
| 890 | FRAME_PIXEL_HEIGHT (f) - (clip_rect.origin.y + clip_rect.size.height) < 5) | ||
| 891 | clip_rect.size.height += FRAME_INTERNAL_BORDER_WIDTH (f); | ||
| 892 | |||
| 893 | ns_focus (f, &clip_rect, 1); | 880 | ns_focus (f, &clip_rect, 1); |
| 894 | } | 881 | } |
| 895 | 882 | ||
| @@ -1237,18 +1224,10 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows) | |||
| 1237 | NSRect wr = [window frame]; | 1224 | NSRect wr = [window frame]; |
| 1238 | int tb = FRAME_EXTERNAL_TOOL_BAR (f); | 1225 | int tb = FRAME_EXTERNAL_TOOL_BAR (f); |
| 1239 | int pixelwidth, pixelheight; | 1226 | int pixelwidth, pixelheight; |
| 1240 | static int oldRows, oldCols, oldFontWidth, oldFontHeight; | ||
| 1241 | static int oldTB; | ||
| 1242 | static struct frame *oldF; | ||
| 1243 | 1227 | ||
| 1244 | NSTRACE (x_set_window_size); | 1228 | NSTRACE (x_set_window_size); |
| 1245 | 1229 | ||
| 1246 | if (view == nil || | 1230 | if (view == nil) |
| 1247 | (f == oldF | ||
| 1248 | && rows == oldRows && cols == oldCols | ||
| 1249 | && oldFontWidth == FRAME_COLUMN_WIDTH (f) | ||
| 1250 | && oldFontHeight == FRAME_LINE_HEIGHT (f) | ||
| 1251 | && oldTB == tb)) | ||
| 1252 | return; | 1231 | return; |
| 1253 | 1232 | ||
| 1254 | /*fprintf (stderr, "\tsetWindowSize: %d x %d, font size %d x %d\n", cols, rows, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); */ | 1233 | /*fprintf (stderr, "\tsetWindowSize: %d x %d, font size %d x %d\n", cols, rows, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); */ |
| @@ -1256,12 +1235,6 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows) | |||
| 1256 | BLOCK_INPUT; | 1235 | BLOCK_INPUT; |
| 1257 | 1236 | ||
| 1258 | check_frame_size (f, &rows, &cols); | 1237 | check_frame_size (f, &rows, &cols); |
| 1259 | oldF = f; | ||
| 1260 | oldRows = rows; | ||
| 1261 | oldCols = cols; | ||
| 1262 | oldFontWidth = FRAME_COLUMN_WIDTH (f); | ||
| 1263 | oldFontHeight = FRAME_LINE_HEIGHT (f); | ||
| 1264 | oldTB = tb; | ||
| 1265 | 1238 | ||
| 1266 | f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f); | 1239 | f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f); |
| 1267 | compute_fringe_widths (f, 0); | 1240 | compute_fringe_widths (f, 0); |
| @@ -1939,7 +1912,7 @@ ns_redraw_scroll_bars (struct frame *f) | |||
| 1939 | int i; | 1912 | int i; |
| 1940 | id view; | 1913 | id view; |
| 1941 | NSArray *subviews = [[FRAME_NS_VIEW (f) superview] subviews]; | 1914 | NSArray *subviews = [[FRAME_NS_VIEW (f) superview] subviews]; |
| 1942 | NSTRACE (ns_judge_scroll_bars); | 1915 | NSTRACE (ns_redraw_scroll_bars); |
| 1943 | for (i =[subviews count]-1; i >= 0; i--) | 1916 | for (i =[subviews count]-1; i >= 0; i--) |
| 1944 | { | 1917 | { |
| 1945 | view = [subviews objectAtIndex: i]; | 1918 | view = [subviews objectAtIndex: i]; |
| @@ -2125,9 +2098,9 @@ ns_after_update_window_line (struct glyph_row *desired_row) | |||
| 2125 | desired_row->redraw_fringe_bitmaps_p = 1; | 2098 | desired_row->redraw_fringe_bitmaps_p = 1; |
| 2126 | 2099 | ||
| 2127 | /* When a window has disappeared, make sure that no rest of | 2100 | /* When a window has disappeared, make sure that no rest of |
| 2128 | full-width rows stays visible in the internal border. | 2101 | full-width rows stays visible in the internal border. */ |
| 2129 | Under NS this is drawn inside the fringes. */ | ||
| 2130 | if (windows_or_buffers_changed | 2102 | if (windows_or_buffers_changed |
| 2103 | && desired_row->full_width_p | ||
| 2131 | && (f = XFRAME (w->frame), | 2104 | && (f = XFRAME (w->frame), |
| 2132 | width = FRAME_INTERNAL_BORDER_WIDTH (f), | 2105 | width = FRAME_INTERNAL_BORDER_WIDTH (f), |
| 2133 | width != 0) | 2106 | width != 0) |
| @@ -2136,24 +2109,11 @@ ns_after_update_window_line (struct glyph_row *desired_row) | |||
| 2136 | { | 2109 | { |
| 2137 | int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); | 2110 | int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); |
| 2138 | 2111 | ||
| 2139 | /* Internal border is drawn below the tool bar. */ | ||
| 2140 | if (WINDOWP (f->tool_bar_window) | ||
| 2141 | && w == XWINDOW (f->tool_bar_window)) | ||
| 2142 | y -= width; | ||
| 2143 | /* end copy from other terms */ | ||
| 2144 | |||
| 2145 | BLOCK_INPUT; | 2112 | BLOCK_INPUT; |
| 2146 | if (!desired_row->full_width_p) | 2113 | ns_clear_frame_area (f, 0, y, width, height); |
| 2147 | { | 2114 | ns_clear_frame_area (f, |
| 2148 | int x1 = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w) | 2115 | FRAME_PIXEL_WIDTH (f) - width, |
| 2149 | + WINDOW_LEFT_FRINGE_WIDTH (w); | 2116 | y, width, height); |
| 2150 | int x2 = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w) | ||
| 2151 | + FRAME_PIXEL_WIDTH (f) - NS_SCROLL_BAR_WIDTH (f) | ||
| 2152 | - WINDOW_RIGHT_FRINGE_WIDTH (w) | ||
| 2153 | - FRAME_INTERNAL_BORDER_WIDTH (f); | ||
| 2154 | ns_clear_frame_area (f, x1, y, width, height); | ||
| 2155 | ns_clear_frame_area (f, x2, y, width, height); | ||
| 2156 | } | ||
| 2157 | UNBLOCK_INPUT; | 2117 | UNBLOCK_INPUT; |
| 2158 | } | 2118 | } |
| 2159 | } | 2119 | } |
| @@ -2238,17 +2198,6 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2238 | int rowY; | 2198 | int rowY; |
| 2239 | static EmacsImage **bimgs = NULL; | 2199 | static EmacsImage **bimgs = NULL; |
| 2240 | static int nBimgs = 0; | 2200 | static int nBimgs = 0; |
| 2241 | /* NS-specific: move internal border inside fringe */ | ||
| 2242 | int x = p->bx < 0 ? p->x : p->bx; | ||
| 2243 | int wd = p->bx < 0 ? p->wd : p->nx; | ||
| 2244 | BOOL fringeOnVeryLeft | ||
| 2245 | = x - WINDOW_LEFT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) | ||
| 2246 | - FRAME_INTERNAL_BORDER_WIDTH (f) < 10; | ||
| 2247 | BOOL fringeOnVeryRight | ||
| 2248 | = FRAME_PIXEL_WIDTH (f) - x - wd - FRAME_INTERNAL_BORDER_WIDTH (f) | ||
| 2249 | - WINDOW_RIGHT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) < 10; | ||
| 2250 | int xAdjust = FRAME_INTERNAL_BORDER_WIDTH (f) * | ||
| 2251 | (fringeOnVeryLeft ? -1 : (fringeOnVeryRight ? 1 : 0)); | ||
| 2252 | 2201 | ||
| 2253 | /* grow bimgs if needed */ | 2202 | /* grow bimgs if needed */ |
| 2254 | if (nBimgs < max_used_fringe_bitmap) | 2203 | if (nBimgs < max_used_fringe_bitmap) |
| @@ -2263,22 +2212,68 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2263 | rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); | 2212 | rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); |
| 2264 | ns_clip_to_row (w, row, -1, YES); | 2213 | ns_clip_to_row (w, row, -1, YES); |
| 2265 | 2214 | ||
| 2266 | if (p->bx >= 0 && !p->overlay_p) | 2215 | if (!p->overlay_p) |
| 2267 | { | 2216 | { |
| 2268 | int yAdjust = rowY - FRAME_INTERNAL_BORDER_WIDTH (f) < 5 ? | 2217 | int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny; |
| 2269 | -FRAME_INTERNAL_BORDER_WIDTH (f) : 0; | 2218 | |
| 2270 | int yIncr = FRAME_PIXEL_HEIGHT (f) - (p->by+yAdjust + p->ny) < 5 ? | 2219 | /* If the fringe is adjacent to the left (right) scroll bar of a |
| 2271 | FRAME_INTERNAL_BORDER_WIDTH (f) : 0 | 2220 | leftmost (rightmost, respectively) window, then extend its |
| 2272 | + (yAdjust ? FRAME_INTERNAL_BORDER_WIDTH (f) : 0); | 2221 | background to the gap between the fringe and the bar. */ |
| 2273 | NSRect r = NSMakeRect (p->bx+xAdjust, p->by+yAdjust, p->nx, p->ny+yIncr); | 2222 | if ((WINDOW_LEFTMOST_P (w) |
| 2274 | NSRectClip (r); | 2223 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) |
| 2275 | [ns_lookup_indexed_color(face->background, f) set]; | 2224 | || (WINDOW_RIGHTMOST_P (w) |
| 2276 | NSRectFill (r); | 2225 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))) |
| 2226 | { | ||
| 2227 | int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 2228 | |||
| 2229 | if (sb_width > 0) | ||
| 2230 | { | ||
| 2231 | int bar_area_x = WINDOW_SCROLL_BAR_AREA_X (w); | ||
| 2232 | int bar_area_width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w) | ||
| 2233 | * FRAME_COLUMN_WIDTH (f)); | ||
| 2234 | |||
| 2235 | if (bx < 0) | ||
| 2236 | { | ||
| 2237 | /* Bitmap fills the fringe. */ | ||
| 2238 | if (bar_area_x + bar_area_width == p->x) | ||
| 2239 | bx = bar_area_x + sb_width; | ||
| 2240 | else if (p->x + p->wd == bar_area_x) | ||
| 2241 | bx = bar_area_x; | ||
| 2242 | if (bx >= 0) | ||
| 2243 | { | ||
| 2244 | int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); | ||
| 2245 | |||
| 2246 | nx = bar_area_width - sb_width; | ||
| 2247 | by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, | ||
| 2248 | row->y)); | ||
| 2249 | ny = row->visible_height; | ||
| 2250 | } | ||
| 2251 | } | ||
| 2252 | else | ||
| 2253 | { | ||
| 2254 | if (bar_area_x + bar_area_width == bx) | ||
| 2255 | { | ||
| 2256 | bx = bar_area_x + sb_width; | ||
| 2257 | nx += bar_area_width - sb_width; | ||
| 2258 | } | ||
| 2259 | else if (bx + nx == bar_area_x) | ||
| 2260 | nx += bar_area_width - sb_width; | ||
| 2261 | } | ||
| 2262 | } | ||
| 2263 | } | ||
| 2264 | |||
| 2265 | if (bx >= 0 && nx > 0) | ||
| 2266 | { | ||
| 2267 | NSRect r = NSMakeRect (bx, by, nx, ny); | ||
| 2268 | NSRectClip (r); | ||
| 2269 | [ns_lookup_indexed_color (face->background, f) set]; | ||
| 2270 | NSRectFill (r); | ||
| 2271 | } | ||
| 2277 | } | 2272 | } |
| 2278 | 2273 | ||
| 2279 | if (p->which) | 2274 | if (p->which) |
| 2280 | { | 2275 | { |
| 2281 | NSRect r = NSMakeRect (p->x+xAdjust, p->y, p->wd, p->h); | 2276 | NSRect r = NSMakeRect (p->x, p->y, p->wd, p->h); |
| 2282 | EmacsImage *img = bimgs[p->which - 1]; | 2277 | EmacsImage *img = bimgs[p->which - 1]; |
| 2283 | 2278 | ||
| 2284 | if (!img) | 2279 | if (!img) |
| @@ -2288,7 +2283,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2288 | int i; | 2283 | int i; |
| 2289 | unsigned char *cbits = xmalloc (len); | 2284 | unsigned char *cbits = xmalloc (len); |
| 2290 | 2285 | ||
| 2291 | for (i =0; i<len; i++) | 2286 | for (i = 0; i < len; i++) |
| 2292 | cbits[i] = ~(bits[i] & 0xff); | 2287 | cbits[i] = ~(bits[i] & 0xff); |
| 2293 | img = [[EmacsImage alloc] initFromXBM: cbits width: 8 height: p->h | 2288 | img = [[EmacsImage alloc] initFromXBM: cbits width: 8 height: p->h |
| 2294 | flip: NO]; | 2289 | flip: NO]; |
| @@ -2386,14 +2381,6 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2386 | r.size.height = h; | 2381 | r.size.height = h; |
| 2387 | r.size.width = w->phys_cursor_width; | 2382 | r.size.width = w->phys_cursor_width; |
| 2388 | 2383 | ||
| 2389 | /* FIXME: if we overwrite the internal border area, it does not get erased; | ||
| 2390 | fix by truncating cursor, but better would be to erase properly */ | ||
| 2391 | overspill = r.origin.x + r.size.width - | ||
| 2392 | WINDOW_TEXT_TO_FRAME_PIXEL_X (w, WINDOW_BOX_RIGHT_EDGE_X (w) | ||
| 2393 | - WINDOW_TOTAL_FRINGE_WIDTH (w) - FRAME_INTERNAL_BORDER_WIDTH (f)); | ||
| 2394 | if (overspill > 0) | ||
| 2395 | r.size.width -= overspill; | ||
| 2396 | |||
| 2397 | /* TODO: only needed in rare cases with last-resort font in HELLO.. | 2384 | /* TODO: only needed in rare cases with last-resort font in HELLO.. |
| 2398 | should we do this more efficiently? */ | 2385 | should we do this more efficiently? */ |
| 2399 | ns_clip_to_row (w, glyph_row, -1, NO); /* do ns_focus(f, &r, 1); if remove */ | 2386 | ns_clip_to_row (w, glyph_row, -1, NO); /* do ns_focus(f, &r, 1); if remove */ |
| @@ -2517,31 +2504,6 @@ hide_hourglass (void) | |||
| 2517 | 2504 | ||
| 2518 | ========================================================================== */ | 2505 | ========================================================================== */ |
| 2519 | 2506 | ||
| 2520 | |||
| 2521 | static inline NSRect | ||
| 2522 | ns_fix_rect_ibw (NSRect r, int fibw, int frame_pixel_width) | ||
| 2523 | /* -------------------------------------------------------------------------- | ||
| 2524 | Under NS we draw internal borders inside fringes, and want full-width | ||
| 2525 | rendering to go all the way to edge. This function makes that correction. | ||
| 2526 | -------------------------------------------------------------------------- */ | ||
| 2527 | { | ||
| 2528 | if (r.origin.y <= fibw+1) | ||
| 2529 | { | ||
| 2530 | r.size.height += r.origin.y; | ||
| 2531 | r.origin.y = 0; | ||
| 2532 | } | ||
| 2533 | if (r.origin.x <= fibw+1) | ||
| 2534 | { | ||
| 2535 | r.size.width += r.origin.x; | ||
| 2536 | r.origin.x = 0; | ||
| 2537 | } | ||
| 2538 | if (frame_pixel_width - (r.origin.x+r.size.width) <= fibw+1) | ||
| 2539 | r.size.width += fibw; | ||
| 2540 | |||
| 2541 | return r; | ||
| 2542 | } | ||
| 2543 | |||
| 2544 | |||
| 2545 | static int | 2507 | static int |
| 2546 | ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr) | 2508 | ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr) |
| 2547 | /* -------------------------------------------------------------------------- | 2509 | /* -------------------------------------------------------------------------- |
| @@ -2551,14 +2513,6 @@ ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr) | |||
| 2551 | -------------------------------------------------------------------------- */ | 2513 | -------------------------------------------------------------------------- */ |
| 2552 | { | 2514 | { |
| 2553 | int n = get_glyph_string_clip_rects (s, nr, 2); | 2515 | int n = get_glyph_string_clip_rects (s, nr, 2); |
| 2554 | if (s->row->full_width_p) | ||
| 2555 | { | ||
| 2556 | *nr = ns_fix_rect_ibw (*nr, FRAME_INTERNAL_BORDER_WIDTH (s->f), | ||
| 2557 | FRAME_PIXEL_WIDTH (s->f)); | ||
| 2558 | if (n == 2) | ||
| 2559 | *nr = ns_fix_rect_ibw (*(nr+1), FRAME_INTERNAL_BORDER_WIDTH (s->f), | ||
| 2560 | FRAME_PIXEL_WIDTH (s->f)); | ||
| 2561 | } | ||
| 2562 | return n; | 2516 | return n; |
| 2563 | } | 2517 | } |
| 2564 | 2518 | ||
| @@ -2883,11 +2837,6 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s) | |||
| 2883 | 2837 | ||
| 2884 | r = NSMakeRect (s->x, s->y, right_x - s->x + 1, s->height); | 2838 | r = NSMakeRect (s->x, s->y, right_x - s->x + 1, s->height); |
| 2885 | 2839 | ||
| 2886 | /* expand full-width row over internal borders */ | ||
| 2887 | if (s->row->full_width_p) | ||
| 2888 | r = ns_fix_rect_ibw (r, FRAME_INTERNAL_BORDER_WIDTH (s->f), | ||
| 2889 | FRAME_PIXEL_WIDTH (s->f)); | ||
| 2890 | |||
| 2891 | /* TODO: Sometimes box_color is 0 and this seems wrong; should investigate. */ | 2840 | /* TODO: Sometimes box_color is 0 and this seems wrong; should investigate. */ |
| 2892 | if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color) | 2841 | if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color) |
| 2893 | { | 2842 | { |
| @@ -2943,26 +2892,6 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, char force_p) | |||
| 2943 | NSRect r = NSMakeRect (s->x, s->y + box_line_width, | 2892 | NSRect r = NSMakeRect (s->x, s->y + box_line_width, |
| 2944 | s->background_width, | 2893 | s->background_width, |
| 2945 | s->height-2*box_line_width); | 2894 | s->height-2*box_line_width); |
| 2946 | |||
| 2947 | /* expand full-width row over internal borders */ | ||
| 2948 | if (s->row->full_width_p) | ||
| 2949 | { | ||
| 2950 | int fibw = FRAME_INTERNAL_BORDER_WIDTH (s->f); | ||
| 2951 | if (r.origin.y <= fibw+1 + box_line_width) | ||
| 2952 | { | ||
| 2953 | r.size.height += r.origin.y; | ||
| 2954 | r.origin.y = 0; | ||
| 2955 | } | ||
| 2956 | if (r.origin.x <= fibw+1) | ||
| 2957 | { | ||
| 2958 | r.size.width += 2*r.origin.x; | ||
| 2959 | r.origin.x = 0; | ||
| 2960 | } | ||
| 2961 | if (FRAME_PIXEL_WIDTH (s->f) - (r.origin.x + r.size.width) | ||
| 2962 | <= fibw+1) | ||
| 2963 | r.size.width += fibw; | ||
| 2964 | } | ||
| 2965 | |||
| 2966 | NSRectFill (r); | 2895 | NSRectFill (r); |
| 2967 | } | 2896 | } |
| 2968 | 2897 | ||
| @@ -3028,24 +2957,6 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) | |||
| 3028 | br = NSMakeRect (x, y, s->slice.width, s->slice.height); | 2957 | br = NSMakeRect (x, y, s->slice.width, s->slice.height); |
| 3029 | } | 2958 | } |
| 3030 | 2959 | ||
| 3031 | /* expand full-width row over internal borders */ | ||
| 3032 | if (s->row->full_width_p) | ||
| 3033 | { | ||
| 3034 | int fibw = FRAME_INTERNAL_BORDER_WIDTH (s->f); | ||
| 3035 | if (br.origin.y <= fibw+1 + box_line_vwidth) | ||
| 3036 | { | ||
| 3037 | br.size.height += br.origin.y; | ||
| 3038 | br.origin.y = 0; | ||
| 3039 | } | ||
| 3040 | if (br.origin.x <= fibw+1 + box_line_vwidth) | ||
| 3041 | { | ||
| 3042 | br.size.width += br.origin.x; | ||
| 3043 | br.origin.x = 0; | ||
| 3044 | } | ||
| 3045 | if (FRAME_PIXEL_WIDTH (s->f) - (br.origin.x + br.size.width) <= fibw+1) | ||
| 3046 | br.size.width += fibw; | ||
| 3047 | } | ||
| 3048 | |||
| 3049 | NSRectFill (br); | 2960 | NSRectFill (br); |
| 3050 | 2961 | ||
| 3051 | /* Draw the image.. do we need to draw placeholder if img ==nil? */ | 2962 | /* Draw the image.. do we need to draw placeholder if img ==nil? */ |
| @@ -3143,7 +3054,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s) | |||
| 3143 | bgCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f); | 3054 | bgCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f); |
| 3144 | fgCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f); | 3055 | fgCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f); |
| 3145 | 3056 | ||
| 3146 | for (i=0; i<n; i++) | 3057 | for (i = 0; i < n; ++i) |
| 3147 | { | 3058 | { |
| 3148 | if (!s->row->full_width_p) | 3059 | if (!s->row->full_width_p) |
| 3149 | { | 3060 | { |
| @@ -3173,13 +3084,6 @@ ns_dumpglyphs_stretch (struct glyph_string *s) | |||
| 3173 | r[i].size.height = min (s->height, s->row->visible_height); | 3084 | r[i].size.height = min (s->height, s->row->visible_height); |
| 3174 | } | 3085 | } |
| 3175 | 3086 | ||
| 3176 | /* expand full-width rows over internal borders */ | ||
| 3177 | else | ||
| 3178 | { | ||
| 3179 | r[i] = ns_fix_rect_ibw (r[i], FRAME_INTERNAL_BORDER_WIDTH (s->f), | ||
| 3180 | FRAME_PIXEL_WIDTH (s->f)); | ||
| 3181 | } | ||
| 3182 | |||
| 3183 | [bgCol set]; | 3087 | [bgCol set]; |
| 3184 | 3088 | ||
| 3185 | /* NOTE: under NS this is NOT used to draw cursors, but we must avoid | 3089 | /* NOTE: under NS this is NOT used to draw cursors, but we must avoid |
| @@ -3639,9 +3543,9 @@ ns_set_vertical_scroll_bar (struct window *window, | |||
| 3639 | struct frame *f = XFRAME (WINDOW_FRAME (window)); | 3543 | struct frame *f = XFRAME (WINDOW_FRAME (window)); |
| 3640 | EmacsView *view = FRAME_NS_VIEW (f); | 3544 | EmacsView *view = FRAME_NS_VIEW (f); |
| 3641 | int window_y, window_height; | 3545 | int window_y, window_height; |
| 3642 | BOOL barOnVeryLeft, barOnVeryRight; | ||
| 3643 | int top, left, height, width, sb_width, sb_left; | 3546 | int top, left, height, width, sb_width, sb_left; |
| 3644 | EmacsScroller *bar; | 3547 | EmacsScroller *bar; |
| 3548 | BOOL fringe_extended_p; | ||
| 3645 | 3549 | ||
| 3646 | /* optimization; display engine sends WAY too many of these.. */ | 3550 | /* optimization; display engine sends WAY too many of these.. */ |
| 3647 | if (!NILP (window->vertical_scroll_bar)) | 3551 | if (!NILP (window->vertical_scroll_bar)) |
| @@ -3668,26 +3572,27 @@ ns_set_vertical_scroll_bar (struct window *window, | |||
| 3668 | width = WINDOW_CONFIG_SCROLL_BAR_COLS (window) * FRAME_COLUMN_WIDTH (f); | 3572 | width = WINDOW_CONFIG_SCROLL_BAR_COLS (window) * FRAME_COLUMN_WIDTH (f); |
| 3669 | left = WINDOW_SCROLL_BAR_AREA_X (window); | 3573 | left = WINDOW_SCROLL_BAR_AREA_X (window); |
| 3670 | 3574 | ||
| 3671 | if (top < 5) /* top scrollbar adjustment */ | ||
| 3672 | { | ||
| 3673 | top -= FRAME_INTERNAL_BORDER_WIDTH (f); | ||
| 3674 | height += FRAME_INTERNAL_BORDER_WIDTH (f); | ||
| 3675 | } | ||
| 3676 | |||
| 3677 | /* allow for displaying a skinnier scrollbar than char area allotted */ | 3575 | /* allow for displaying a skinnier scrollbar than char area allotted */ |
| 3678 | sb_width = (WINDOW_CONFIG_SCROLL_BAR_WIDTH (window) > 0) ? | 3576 | sb_width = (WINDOW_CONFIG_SCROLL_BAR_WIDTH (window) > 0) ? |
| 3679 | WINDOW_CONFIG_SCROLL_BAR_WIDTH (window) : width; | 3577 | WINDOW_CONFIG_SCROLL_BAR_WIDTH (window) : width; |
| 3680 | 3578 | sb_left = left; | |
| 3681 | barOnVeryLeft = left < 5; | ||
| 3682 | barOnVeryRight = FRAME_PIXEL_WIDTH (f) - left - width < 5; | ||
| 3683 | sb_left = left + FRAME_INTERNAL_BORDER_WIDTH (f) | ||
| 3684 | * (barOnVeryLeft ? -1 : (barOnVeryRight ? 1 : 0)); | ||
| 3685 | 3579 | ||
| 3686 | r = NSMakeRect (sb_left, top, sb_width, height); | 3580 | r = NSMakeRect (sb_left, top, sb_width, height); |
| 3687 | /* the parent view is flipped, so we need to flip y value */ | 3581 | /* the parent view is flipped, so we need to flip y value */ |
| 3688 | v = [view frame]; | 3582 | v = [view frame]; |
| 3689 | r.origin.y = (v.size.height - r.size.height - r.origin.y); | 3583 | r.origin.y = (v.size.height - r.size.height - r.origin.y); |
| 3690 | 3584 | ||
| 3585 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (window)) | ||
| 3586 | fringe_extended_p = (WINDOW_LEFTMOST_P (window) | ||
| 3587 | && WINDOW_LEFT_FRINGE_WIDTH (window) | ||
| 3588 | && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (window) | ||
| 3589 | || WINDOW_LEFT_MARGIN_COLS (window) == 0)); | ||
| 3590 | else | ||
| 3591 | fringe_extended_p = (WINDOW_RIGHTMOST_P (window) | ||
| 3592 | && WINDOW_RIGHT_FRINGE_WIDTH (window) | ||
| 3593 | && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (window) | ||
| 3594 | || WINDOW_RIGHT_MARGIN_COLS (window) == 0)); | ||
| 3595 | |||
| 3691 | XSETWINDOW (win, window); | 3596 | XSETWINDOW (win, window); |
| 3692 | BLOCK_INPUT; | 3597 | BLOCK_INPUT; |
| 3693 | 3598 | ||
| @@ -3707,7 +3612,14 @@ ns_set_vertical_scroll_bar (struct window *window, | |||
| 3707 | 3612 | ||
| 3708 | if (NILP (window->vertical_scroll_bar)) | 3613 | if (NILP (window->vertical_scroll_bar)) |
| 3709 | { | 3614 | { |
| 3710 | ns_clear_frame_area (f, sb_left, top, width, height); | 3615 | if (width > 0 && height > 0) |
| 3616 | { | ||
| 3617 | if (fringe_extended_p) | ||
| 3618 | ns_clear_frame_area (f, sb_left, top, sb_width, height); | ||
| 3619 | else | ||
| 3620 | ns_clear_frame_area (f, left, top, width, height); | ||
| 3621 | } | ||
| 3622 | |||
| 3711 | bar = [[EmacsScroller alloc] initFrame: r window: win]; | 3623 | bar = [[EmacsScroller alloc] initFrame: r window: win]; |
| 3712 | wset_vertical_scroll_bar (window, make_save_value (bar, 0)); | 3624 | wset_vertical_scroll_bar (window, make_save_value (bar, 0)); |
| 3713 | } | 3625 | } |
| @@ -3778,14 +3690,21 @@ ns_judge_scroll_bars (struct frame *f) | |||
| 3778 | { | 3690 | { |
| 3779 | int i; | 3691 | int i; |
| 3780 | id view; | 3692 | id view; |
| 3781 | NSArray *subviews = [[FRAME_NS_VIEW (f) superview] subviews]; | 3693 | EmacsView *eview = FRAME_NS_VIEW (f); |
| 3694 | NSArray *subviews = [[eview superview] subviews]; | ||
| 3695 | BOOL removed = NO; | ||
| 3696 | |||
| 3782 | NSTRACE (ns_judge_scroll_bars); | 3697 | NSTRACE (ns_judge_scroll_bars); |
| 3783 | for (i =[subviews count]-1; i >= 0; i--) | 3698 | for (i = [subviews count]-1; i >= 0; --i) |
| 3784 | { | 3699 | { |
| 3785 | view = [subviews objectAtIndex: i]; | 3700 | view = [subviews objectAtIndex: i]; |
| 3786 | if (![view isKindOfClass: [EmacsScroller class]]) continue; | 3701 | if (![view isKindOfClass: [EmacsScroller class]]) continue; |
| 3787 | [view judge]; | 3702 | [view judge]; |
| 3703 | removed = YES; | ||
| 3788 | } | 3704 | } |
| 3705 | |||
| 3706 | if (removed) | ||
| 3707 | [eview updateFrameSize]; | ||
| 3789 | } | 3708 | } |
| 3790 | 3709 | ||
| 3791 | 3710 | ||
| @@ -5420,6 +5339,48 @@ not_in_argv (NSString *arg) | |||
| 5420 | return NO; | 5339 | return NO; |
| 5421 | } | 5340 | } |
| 5422 | 5341 | ||
| 5342 | - (void) updateFrameSize | ||
| 5343 | { | ||
| 5344 | NSWindow *window = [self window]; | ||
| 5345 | NSRect wr = [window frame]; | ||
| 5346 | #ifdef NS_IMPL_GNUSTEP | ||
| 5347 | int extra = 3; | ||
| 5348 | #else | ||
| 5349 | int extra = 0; | ||
| 5350 | #endif | ||
| 5351 | |||
| 5352 | int oldc = cols, oldr = rows; | ||
| 5353 | int oldw = FRAME_PIXEL_WIDTH (emacsframe), | ||
| 5354 | oldh = FRAME_PIXEL_HEIGHT (emacsframe); | ||
| 5355 | int neww, newh; | ||
| 5356 | |||
| 5357 | cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, wr.size.width + extra); | ||
| 5358 | |||
| 5359 | if (cols < MINWIDTH) | ||
| 5360 | cols = MINWIDTH; | ||
| 5361 | |||
| 5362 | rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES | ||
| 5363 | (emacsframe, wr.size.height | ||
| 5364 | - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + extra | ||
| 5365 | - FRAME_TOOLBAR_HEIGHT (emacsframe)); | ||
| 5366 | |||
| 5367 | if (rows < MINHEIGHT) | ||
| 5368 | rows = MINHEIGHT; | ||
| 5369 | |||
| 5370 | neww = (int)wr.size.width - emacsframe->border_width; | ||
| 5371 | newh = ((int)wr.size.height | ||
| 5372 | - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) | ||
| 5373 | - FRAME_TOOLBAR_HEIGHT (emacsframe)); | ||
| 5374 | |||
| 5375 | if (oldr != rows || oldc != cols || neww != oldw || newh != oldh) | ||
| 5376 | { | ||
| 5377 | FRAME_PIXEL_WIDTH (emacsframe) = neww; | ||
| 5378 | FRAME_PIXEL_HEIGHT (emacsframe) = newh; | ||
| 5379 | change_frame_size (emacsframe, rows, cols, 0, 0, 1); | ||
| 5380 | SET_FRAME_GARBAGED (emacsframe); | ||
| 5381 | cancel_mouse_face (emacsframe); | ||
| 5382 | } | ||
| 5383 | } | ||
| 5423 | 5384 | ||
| 5424 | - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize | 5385 | - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize |
| 5425 | /* normalize frame to gridded text size */ | 5386 | /* normalize frame to gridded text size */ |
| @@ -5517,16 +5478,7 @@ not_in_argv (NSString *arg) | |||
| 5517 | x_set_window_size (emacsframe, 0, cols, rows); | 5478 | x_set_window_size (emacsframe, 0, cols, rows); |
| 5518 | else | 5479 | else |
| 5519 | { | 5480 | { |
| 5520 | NSWindow *window = [self window]; | 5481 | [self updateFrameSize]; |
| 5521 | NSRect wr = [window frame]; | ||
| 5522 | FRAME_PIXEL_WIDTH (emacsframe) = (int)wr.size.width | ||
| 5523 | - emacsframe->border_width; | ||
| 5524 | FRAME_PIXEL_HEIGHT (emacsframe) = (int)wr.size.height | ||
| 5525 | - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) | ||
| 5526 | - FRAME_TOOLBAR_HEIGHT (emacsframe); | ||
| 5527 | change_frame_size (emacsframe, rows, cols, 0, 0, 1); | ||
| 5528 | SET_FRAME_GARBAGED (emacsframe); | ||
| 5529 | cancel_mouse_face (emacsframe); | ||
| 5530 | } | 5482 | } |
| 5531 | } | 5483 | } |
| 5532 | #endif | 5484 | #endif |