aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2003-05-24 22:00:34 +0000
committerKim F. Storm2003-05-24 22:00:34 +0000
commitf1a83aabaaae4b22393fad978c6b4caf6287c78b (patch)
tree6ebdeed49f654220e10202903ec12e9a23eb1482 /src
parenta3168f58f02b355386ee42203517ba8e5b65591c (diff)
downloademacs-f1a83aabaaae4b22393fad978c6b4caf6287c78b.tar.gz
emacs-f1a83aabaaae4b22393fad978c6b4caf6287c78b.zip
Make (several) trivial substitutions for renamed and
new macros in dispextern.h, frame.h and window.h. (x_draw_glyph_string_box): Adapt to per-window fringes and scroll-bars. (glyph_rect): Use window coordinates returned from window_from_coordinates rather than frame_to_window_pixel_xy. (XTset_vertical_scroll_bar): Adapt to per-window fringes and scroll-bars. (x_clip_to_row): Remove superfluous whole_line_p arg and code (fringes are now inside margins, i.e. always in the clipping area). All callers changed. (x_new_font): Set FRAME_COLUMN_WIDTH and FRAME_LINE_HEIGHT directly, then call compute_fringe_widths. Don't call frame_update_line_height.
Diffstat (limited to 'src')
-rw-r--r--src/macterm.c233
1 files changed, 109 insertions, 124 deletions
diff --git a/src/macterm.c b/src/macterm.c
index dcad5b38442..0bcf85f6ff2 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -306,8 +306,7 @@ static void XTframe_rehighlight P_ ((struct frame *));
306static void x_frame_rehighlight P_ ((struct x_display_info *)); 306static void x_frame_rehighlight P_ ((struct x_display_info *));
307static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *)); 307static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
308static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int)); 308static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int));
309static void x_clip_to_row P_ ((struct window *, struct glyph_row *, 309static void x_clip_to_row P_ ((struct window *, struct glyph_row *, GC));
310 GC, int));
311static void x_flush P_ ((struct frame *f)); 310static void x_flush P_ ((struct frame *f));
312static void x_update_begin P_ ((struct frame *)); 311static void x_update_begin P_ ((struct frame *));
313static void x_update_window_begin P_ ((struct window *)); 312static void x_update_window_begin P_ ((struct window *));
@@ -1273,7 +1272,7 @@ x_after_update_window_line (desired_row)
1273 XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), 1272 XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
1274 0, y, width, height, 0); 1273 0, y, width, height, 0);
1275 XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), 1274 XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
1276 f->output_data.mac->pixel_width - width, y, 1275 FRAME_PIXEL_WIDTH (f) - width, y,
1277 width, height, 0); 1276 width, height, 0);
1278 1277
1279 UNBLOCK_INPUT; 1278 UNBLOCK_INPUT;
@@ -1300,7 +1299,7 @@ x_draw_fringe_bitmap (w, row, p)
1300 struct face *face = p->face; 1299 struct face *face = p->face;
1301 1300
1302 /* Must clip because of partially visible lines. */ 1301 /* Must clip because of partially visible lines. */
1303 x_clip_to_row (w, row, gc, 1); 1302 x_clip_to_row (w, row, gc);
1304 1303
1305 if (p->bx >= 0) 1304 if (p->bx >= 0)
1306 { 1305 {
@@ -2352,9 +2351,10 @@ x_draw_glyph_string_box (s)
2352 if (s->row->full_width_p 2351 if (s->row->full_width_p
2353 && !s->w->pseudo_window_p) 2352 && !s->w->pseudo_window_p)
2354 { 2353 {
2355 last_x += FRAME_X_RIGHT_FRINGE_WIDTH (s->f); 2354 last_x += WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w);
2356 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f)) 2355 if (s->area != RIGHT_MARGIN_AREA
2357 last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f); 2356 || WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
2357 last_x += WINDOW_RIGHT_FRINGE_WIDTH (s->w);
2358 } 2358 }
2359 2359
2360 /* The glyph that may have a right box line. */ 2360 /* The glyph that may have a right box line. */
@@ -2744,7 +2744,7 @@ x_draw_stretch_glyph_string (s)
2744 { 2744 {
2745 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor 2745 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
2746 as wide as the stretch glyph. */ 2746 as wide as the stretch glyph. */
2747 int width = min (CANON_X_UNIT (s->f), s->background_width); 2747 int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width);
2748 2748
2749 /* Draw cursor. */ 2749 /* Draw cursor. */
2750 x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); 2750 x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height);
@@ -3147,8 +3147,6 @@ x_scroll_run (w, run)
3147 without mode lines. Include in this box the left and right 3147 without mode lines. Include in this box the left and right
3148 fringes of W. */ 3148 fringes of W. */
3149 window_box (w, -1, &x, &y, &width, &height); 3149 window_box (w, -1, &x, &y, &width, &height);
3150 width += FRAME_X_FRINGE_WIDTH (f);
3151 x -= FRAME_X_LEFT_FRINGE_WIDTH (f);
3152 3150
3153 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); 3151 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y);
3154 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); 3152 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y);
@@ -3591,15 +3589,14 @@ glyph_rect (f, x, y, rect)
3591{ 3589{
3592 Lisp_Object window; 3590 Lisp_Object window;
3593 3591
3594 window = window_from_coordinates (f, x, y, 0, 0); 3592 window = window_from_coordinates (f, x, y, 0, &x, &y, 0);
3593
3595 if (!NILP (window)) 3594 if (!NILP (window))
3596 { 3595 {
3597 struct window *w = XWINDOW (window); 3596 struct window *w = XWINDOW (window);
3598 struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 3597 struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
3599 struct glyph_row *end = r + w->current_matrix->nrows - 1; 3598 struct glyph_row *end = r + w->current_matrix->nrows - 1;
3600 3599
3601 frame_to_window_pixel_xy (w, &x, &y);
3602
3603 for (; r < end && r->enabled_p; ++r) 3600 for (; r < end && r->enabled_p; ++r)
3604 if (r->y <= y && r->y + r->height > y) 3601 if (r->y <= y && r->y + r->height > y)
3605 { 3602 {
@@ -3614,7 +3611,10 @@ glyph_rect (f, x, y, rect)
3614 if (x < r->x) 3611 if (x < r->x)
3615 { 3612 {
3616 /* x is to the left of the first glyph in the row. */ 3613 /* x is to the left of the first glyph in the row. */
3617 rect->left = XINT (w->left); 3614 /* Shouldn't this be a pixel value?
3615 WINDOW_LEFT_EDGE_X (w) seems to be the right value.
3616 ++KFS */
3617 rect->left = WINDOW_LEFT_EDGE_COL (w);
3618 rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x); 3618 rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x);
3619 return 1; 3619 return 1;
3620 } 3620 }
@@ -3630,7 +3630,10 @@ glyph_rect (f, x, y, rect)
3630 3630
3631 /* x is to the right of the last glyph in the row. */ 3631 /* x is to the right of the last glyph in the row. */
3632 rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx); 3632 rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx);
3633 rect->right = XINT (w->left) + XINT (w->width); 3633 /* Shouldn't this be a pixel value?
3634 WINDOW_RIGHT_EDGE_X (w) seems to be the right value.
3635 ++KFS */
3636 rect->right = WINDOW_RIGHT_EDGE_COL (w);
3634 return 1; 3637 return 1;
3635 } 3638 }
3636 } 3639 }
@@ -3652,7 +3655,7 @@ remember_mouse_glyph (f1, gx, gy)
3652 int width = FRAME_SMALLEST_CHAR_WIDTH (f1); 3655 int width = FRAME_SMALLEST_CHAR_WIDTH (f1);
3653 int height = FRAME_SMALLEST_FONT_HEIGHT (f1); 3656 int height = FRAME_SMALLEST_FONT_HEIGHT (f1);
3654 3657
3655 /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to 3658 /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to
3656 round down even for negative values. */ 3659 round down even for negative values. */
3657 if (gx < 0) 3660 if (gx < 0)
3658 gx -= width - 1; 3661 gx -= width - 1;
@@ -3938,35 +3941,30 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
3938 struct frame *f = XFRAME (w->frame); 3941 struct frame *f = XFRAME (w->frame);
3939 struct scroll_bar *bar; 3942 struct scroll_bar *bar;
3940 int top, height, left, sb_left, width, sb_width, disp_top, disp_height; 3943 int top, height, left, sb_left, width, sb_width, disp_top, disp_height;
3941 int window_x, window_y, window_width, window_height; 3944 int window_y, window_height;
3942 3945
3943 /* Get window dimensions. */ 3946 /* Get window dimensions. */
3944 window_box (w, -1, &window_x, &window_y, &window_width, &window_height); 3947 window_box (w, -1, 0, &window_y, 0, &window_height);
3945 top = window_y; 3948 top = window_y;
3946#ifdef MAC_OSX 3949#ifdef MAC_OSX
3947 width = 16; 3950 width = 16;
3948#else 3951#else
3949 width = FRAME_SCROLL_BAR_COLS (f) * CANON_X_UNIT (f); 3952 width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
3950#endif 3953#endif
3951 height = window_height; 3954 height = window_height;
3952 3955
3953 /* Compute the left edge of the scroll bar area. */ 3956 /* Compute the left edge of the scroll bar area. */
3954 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) 3957 left = WINDOW_SCROLL_BAR_AREA_X (w);
3955 left = XINT (w->left) + XINT (w->width) - FRAME_SCROLL_BAR_COLS (f);
3956 else
3957 left = XFASTINT (w->left);
3958 left *= CANON_X_UNIT (f);
3959 left += FRAME_INTERNAL_BORDER_WIDTH (f);
3960 3958
3961 /* Compute the width of the scroll bar which might be less than 3959 /* Compute the width of the scroll bar which might be less than
3962 the width of the area reserved for the scroll bar. */ 3960 the width of the area reserved for the scroll bar. */
3963 if (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0) 3961 if (WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) > 0)
3964 sb_width = FRAME_SCROLL_BAR_PIXEL_WIDTH (f); 3962 sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
3965 else 3963 else
3966 sb_width = width; 3964 sb_width = width;
3967 3965
3968 /* Compute the left edge of the scroll bar. */ 3966 /* Compute the left edge of the scroll bar. */
3969 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) 3967 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
3970 sb_left = left + width - sb_width - (width - sb_width) / 2; 3968 sb_left = left + width - sb_width - (width - sb_width) / 2;
3971 else 3969 else
3972 sb_left = left + (width - sb_width) / 2; 3970 sb_left = left + (width - sb_width) / 2;
@@ -3979,13 +3977,13 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
3979 disp_top = -1; 3977 disp_top = -1;
3980 disp_height++; 3978 disp_height++;
3981 } 3979 }
3982 else if (disp_top == PIXEL_HEIGHT (f) - 16) 3980 else if (disp_top == FRAME_PIXEL_HEIGHT (f) - 16)
3983 { 3981 {
3984 disp_top++; 3982 disp_top++;
3985 disp_height--; 3983 disp_height--;
3986 } 3984 }
3987 3985
3988 if (sb_left + sb_width == PIXEL_WIDTH (f)) 3986 if (sb_left + sb_width == FRAME_PIXEL_WIDTH (f))
3989 sb_left++; 3987 sb_left++;
3990 3988
3991 /* Does the scroll bar exist yet? */ 3989 /* Does the scroll bar exist yet? */
@@ -4021,12 +4019,12 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
4021 wide as the area reserved for it . This makes sure a 4019 wide as the area reserved for it . This makes sure a
4022 previous mode line display is cleared after C-x 2 C-x 1, for 4020 previous mode line display is cleared after C-x 2 C-x 1, for
4023 example. */ 4021 example. */
4024 int area_width = FRAME_SCROLL_BAR_COLS (f) * CANON_X_UNIT (f); 4022 int area_width = WINDOW_SCROLL_BAR_AREA_WIDTH (w);
4025 XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), 4023 XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
4026 left, top, area_width, height, 0); 4024 left, top, area_width, height, 0);
4027 4025
4028#if 0 4026#if 0
4029 if (sb_left + sb_width >= PIXEL_WIDTH (f)) 4027 if (sb_left + sb_width >= FRAME_PIXEL_WIDTH (f))
4030 XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), 4028 XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
4031 sb_left - 1, top, 1, height, 0); 4029 sb_left - 1, top, 1, height, 0);
4032#endif 4030#endif
@@ -4369,25 +4367,22 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
4369 4367
4370/* Set clipping for output in glyph row ROW. W is the window in which 4368/* Set clipping for output in glyph row ROW. W is the window in which
4371 we operate. GC is the graphics context to set clipping in. 4369 we operate. GC is the graphics context to set clipping in.
4372 WHOLE_LINE_P non-zero means include the areas used for truncation
4373 mark display and alike in the clipping rectangle.
4374 4370
4375 ROW may be a text row or, e.g., a mode line. Text rows must be 4371 ROW may be a text row or, e.g., a mode line. Text rows must be
4376 clipped to the interior of the window dedicated to text display, 4372 clipped to the interior of the window dedicated to text display,
4377 mode lines must be clipped to the whole window. */ 4373 mode lines must be clipped to the whole window. */
4378 4374
4379static void 4375static void
4380x_clip_to_row (w, row, gc, whole_line_p) 4376x_clip_to_row (w, row, gc)
4381 struct window *w; 4377 struct window *w;
4382 struct glyph_row *row; 4378 struct glyph_row *row;
4383 GC gc; 4379 GC gc;
4384 int whole_line_p;
4385{ 4380{
4386 struct frame *f = XFRAME (WINDOW_FRAME (w)); 4381 struct frame *f = XFRAME (WINDOW_FRAME (w));
4387 Rect clip_rect; 4382 Rect clip_rect;
4388 int window_x, window_y, window_width, window_height; 4383 int window_y, window_width;
4389 4384
4390 window_box (w, -1, &window_x, &window_y, &window_width, &window_height); 4385 window_box (w, -1, 0, &window_y, &window_width, 0);
4391 4386
4392 clip_rect.left = WINDOW_TO_FRAME_PIXEL_X (w, 0); 4387 clip_rect.left = WINDOW_TO_FRAME_PIXEL_X (w, 0);
4393 clip_rect.top = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); 4388 clip_rect.top = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
@@ -4395,14 +4390,6 @@ x_clip_to_row (w, row, gc, whole_line_p)
4395 clip_rect.right = clip_rect.left + window_width; 4390 clip_rect.right = clip_rect.left + window_width;
4396 clip_rect.bottom = clip_rect.top + row->visible_height; 4391 clip_rect.bottom = clip_rect.top + row->visible_height;
4397 4392
4398 /* If clipping to the whole line, including trunc marks, extend
4399 the rectangle to the left and increase its width. */
4400 if (whole_line_p)
4401 {
4402 clip_rect.left -= FRAME_X_LEFT_FRINGE_WIDTH (f);
4403 clip_rect.right += FRAME_X_FRINGE_WIDTH (f);
4404 }
4405
4406 mac_set_clip_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), &clip_rect); 4393 mac_set_clip_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), &clip_rect);
4407} 4394}
4408 4395
@@ -4442,7 +4429,7 @@ x_draw_hollow_cursor (w, row)
4442 wd = cursor_glyph->pixel_width - 1; 4429 wd = cursor_glyph->pixel_width - 1;
4443 if (cursor_glyph->type == STRETCH_GLYPH 4430 if (cursor_glyph->type == STRETCH_GLYPH
4444 && !x_stretch_cursor_p) 4431 && !x_stretch_cursor_p)
4445 wd = min (CANON_X_UNIT (f), wd); 4432 wd = min (FRAME_COLUMN_WIDTH (f), wd);
4446 4433
4447 /* The foreground of cursor_gc is typically the same as the normal 4434 /* The foreground of cursor_gc is typically the same as the normal
4448 background color, which can cause the cursor box to be invisible. */ 4435 background color, which can cause the cursor box to be invisible. */
@@ -4455,7 +4442,7 @@ x_draw_hollow_cursor (w, row)
4455 gc = dpyinfo->scratch_cursor_gc; 4442 gc = dpyinfo->scratch_cursor_gc;
4456 4443
4457 /* Set clipping, draw the rectangle, and reset clipping again. */ 4444 /* Set clipping, draw the rectangle, and reset clipping again. */
4458 x_clip_to_row (w, row, gc, 0); 4445 x_clip_to_row (w, row, gc);
4459 mac_draw_rectangle (dpy, FRAME_MAC_WINDOW (f), gc, x, y, wd, h); 4446 mac_draw_rectangle (dpy, FRAME_MAC_WINDOW (f), gc, x, y, wd, h);
4460 mac_reset_clipping (dpy, FRAME_MAC_WINDOW (f)); 4447 mac_reset_clipping (dpy, FRAME_MAC_WINDOW (f));
4461} 4448}
@@ -4511,7 +4498,7 @@ x_draw_bar_cursor (w, row, width)
4511 width = FRAME_CURSOR_WIDTH (f); 4498 width = FRAME_CURSOR_WIDTH (f);
4512 4499
4513 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 4500 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
4514 x_clip_to_row (w, row, gc, 0); 4501 x_clip_to_row (w, row, gc);
4515 XFillRectangle (dpy, window, gc, 4502 XFillRectangle (dpy, window, gc,
4516 x, 4503 x,
4517 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), 4504 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
@@ -4685,36 +4672,37 @@ x_new_font (f, fontname)
4685 FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; 4672 FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;
4686 FRAME_FONTSET (f) = -1; 4673 FRAME_FONTSET (f) = -1;
4687 4674
4675 FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f));
4676 FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f));
4677
4678 compute_fringe_widths (f, 1);
4679
4688 /* Compute the scroll bar width in character columns. */ 4680 /* Compute the scroll bar width in character columns. */
4689 if (f->scroll_bar_pixel_width > 0) 4681 if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
4690 { 4682 {
4691 int wid = FONT_WIDTH (FRAME_FONT (f)); 4683 int wid = FRAME_COLUMN_WIDTH (f);
4692 f->scroll_bar_cols = (f->scroll_bar_pixel_width + wid-1) / wid; 4684 FRAME_CONFIG_SCROLL_BAR_COLS (f)
4685 = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid-1) / wid;
4693 } 4686 }
4694 else 4687 else
4695 { 4688 {
4696 int wid = FONT_WIDTH (FRAME_FONT (f)); 4689 int wid = FRAME_COLUMN_WIDTH (f);
4697 f->scroll_bar_cols = (14 + wid - 1) / wid; 4690 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
4698 } 4691 }
4699 4692
4700 /* Now make the frame display the given font. */ 4693 /* Now make the frame display the given font. */
4701 if (FRAME_MAC_WINDOW (f) != 0) 4694 if (FRAME_MAC_WINDOW (f) != 0)
4702 { 4695 {
4703 XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->normal_gc, 4696 XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->normal_gc,
4704 f->output_data.mac->font); 4697 FRAME_FONT (f));
4705 XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->reverse_gc, 4698 XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->reverse_gc,
4706 f->output_data.mac->font); 4699 FRAME_FONT (f));
4707 XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->cursor_gc, 4700 XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->cursor_gc,
4708 f->output_data.mac->font); 4701 FRAME_FONT (f));
4709 4702
4710 frame_update_line_height (f);
4711 if (NILP (tip_frame) || XFRAME (tip_frame) != f) 4703 if (NILP (tip_frame) || XFRAME (tip_frame) != f)
4712 x_set_window_size (f, 0, f->width, f->height); 4704 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
4713 } 4705 }
4714 else
4715 /* If we are setting a new frame's font for the first time,
4716 there are no faces yet, so this font's height is the line height. */
4717 f->output_data.mac->line_height = FONT_HEIGHT (FRAME_FONT (f));
4718 4706
4719 return build_string (fontp->full_name); 4707 return build_string (fontp->full_name);
4720} 4708}
@@ -4776,7 +4764,7 @@ x_calc_absolute_position (f)
4776 struct frame *f; 4764 struct frame *f;
4777{ 4765{
4778 Point pt; 4766 Point pt;
4779 int flags = f->output_data.mac->size_hint_flags; 4767 int flags = f->size_hint_flags;
4780 4768
4781 pt.h = pt.v = 0; 4769 pt.h = pt.v = 0;
4782 4770
@@ -4810,20 +4798,20 @@ x_calc_absolute_position (f)
4810 /* Treat negative positions as relative to the leftmost bottommost 4798 /* Treat negative positions as relative to the leftmost bottommost
4811 position that fits on the screen. */ 4799 position that fits on the screen. */
4812 if (flags & XNegative) 4800 if (flags & XNegative)
4813 f->output_data.mac->left_pos = (FRAME_MAC_DISPLAY_INFO (f)->width 4801 f->left_pos = (FRAME_MAC_DISPLAY_INFO (f)->width
4814 - 2 * f->output_data.mac->border_width - pt.h 4802 - 2 * f->border_width - pt.h
4815 - PIXEL_WIDTH (f) 4803 - FRAME_PIXEL_WIDTH (f)
4816 + f->output_data.mac->left_pos); 4804 + f->left_pos);
4817 /* NTEMACS_TODO: Subtract menubar height? */ 4805 /* NTEMACS_TODO: Subtract menubar height? */
4818 if (flags & YNegative) 4806 if (flags & YNegative)
4819 f->output_data.mac->top_pos = (FRAME_MAC_DISPLAY_INFO (f)->height 4807 f->top_pos = (FRAME_MAC_DISPLAY_INFO (f)->height
4820 - 2 * f->output_data.mac->border_width - pt.v 4808 - 2 * f->border_width - pt.v
4821 - PIXEL_HEIGHT (f) 4809 - FRAME_PIXEL_HEIGHT (f)
4822 + f->output_data.mac->top_pos); 4810 + f->top_pos);
4823 /* The left_pos and top_pos 4811 /* The left_pos and top_pos
4824 are now relative to the top and left screen edges, 4812 are now relative to the top and left screen edges,
4825 so the flags should correspond. */ 4813 so the flags should correspond. */
4826 f->output_data.mac->size_hint_flags &= ~ (XNegative | YNegative); 4814 f->size_hint_flags &= ~ (XNegative | YNegative);
4827} 4815}
4828 4816
4829/* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, 4817/* CHANGE_GRAVITY is 1 when calling from Fset_frame_position,
@@ -4842,22 +4830,22 @@ x_set_offset (f, xoff, yoff, change_gravity)
4842 4830
4843 if (change_gravity > 0) 4831 if (change_gravity > 0)
4844 { 4832 {
4845 f->output_data.mac->top_pos = yoff; 4833 f->top_pos = yoff;
4846 f->output_data.mac->left_pos = xoff; 4834 f->left_pos = xoff;
4847 f->output_data.mac->size_hint_flags &= ~ (XNegative | YNegative); 4835 f->size_hint_flags &= ~ (XNegative | YNegative);
4848 if (xoff < 0) 4836 if (xoff < 0)
4849 f->output_data.mac->size_hint_flags |= XNegative; 4837 f->size_hint_flags |= XNegative;
4850 if (yoff < 0) 4838 if (yoff < 0)
4851 f->output_data.mac->size_hint_flags |= YNegative; 4839 f->size_hint_flags |= YNegative;
4852 f->output_data.mac->win_gravity = NorthWestGravity; 4840 f->win_gravity = NorthWestGravity;
4853 } 4841 }
4854 x_calc_absolute_position (f); 4842 x_calc_absolute_position (f);
4855 4843
4856 BLOCK_INPUT; 4844 BLOCK_INPUT;
4857 x_wm_set_size_hint (f, (long) 0, 0); 4845 x_wm_set_size_hint (f, (long) 0, 0);
4858 4846
4859 modified_left = f->output_data.mac->left_pos; 4847 modified_left = f->left_pos;
4860 modified_top = f->output_data.mac->top_pos; 4848 modified_top = f->top_pos;
4861 4849
4862 MoveWindow (f->output_data.mac->mWP, modified_left + 6, 4850 MoveWindow (f->output_data.mac->mWP, modified_left + 6,
4863 modified_top + 42, false); 4851 modified_top + 42, false);
@@ -4881,17 +4869,15 @@ x_set_window_size (f, change_gravity, cols, rows)
4881 BLOCK_INPUT; 4869 BLOCK_INPUT;
4882 4870
4883 check_frame_size (f, &rows, &cols); 4871 check_frame_size (f, &rows, &cols);
4884 f->output_data.mac->vertical_scroll_bar_extra 4872 f->scroll_bar_actual_width
4885 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) 4873 = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f);
4886 ? 0
4887 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.mac->font)));
4888 4874
4889 compute_fringe_widths (f, 0); 4875 compute_fringe_widths (f, 0);
4890 4876
4891 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); 4877 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols);
4892 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); 4878 pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
4893 4879
4894 f->output_data.mac->win_gravity = NorthWestGravity; 4880 f->win_gravity = NorthWestGravity;
4895 x_wm_set_size_hint (f, (long) 0, 0); 4881 x_wm_set_size_hint (f, (long) 0, 0);
4896 4882
4897 SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0); 4883 SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0);
@@ -4910,8 +4896,8 @@ x_set_window_size (f, change_gravity, cols, rows)
4910 We pass 1 for DELAY since we can't run Lisp code inside of 4896 We pass 1 for DELAY since we can't run Lisp code inside of
4911 a BLOCK_INPUT. */ 4897 a BLOCK_INPUT. */
4912 change_frame_size (f, rows, cols, 0, 1, 0); 4898 change_frame_size (f, rows, cols, 0, 1, 0);
4913 PIXEL_WIDTH (f) = pixelwidth; 4899 FRAME_PIXEL_WIDTH (f) = pixelwidth;
4914 PIXEL_HEIGHT (f) = pixelheight; 4900 FRAME_PIXEL_HEIGHT (f) = pixelheight;
4915 4901
4916 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to 4902 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to
4917 receive in the ConfigureNotify event; if we get what we asked 4903 receive in the ConfigureNotify event; if we get what we asked
@@ -4944,14 +4930,14 @@ x_set_mouse_position (f, x, y)
4944{ 4930{
4945 int pix_x, pix_y; 4931 int pix_x, pix_y;
4946 4932
4947 pix_x = CHAR_TO_PIXEL_COL (f, x) + FONT_WIDTH (f->output_data.mac->font) / 2; 4933 pix_x = FRAME_COL_TO_PIXEL_X (f, x) + FRAME_COLUMN_WIDTH (f) / 2;
4948 pix_y = CHAR_TO_PIXEL_ROW (f, y) + f->output_data.mac->line_height / 2; 4934 pix_y = FRAME_LINE_TO_PIXEL_Y (f, y) + FRAME_LINE_HEIGHT (f) / 2;
4949 4935
4950 if (pix_x < 0) pix_x = 0; 4936 if (pix_x < 0) pix_x = 0;
4951 if (pix_x > PIXEL_WIDTH (f)) pix_x = PIXEL_WIDTH (f); 4937 if (pix_x > FRAME_PIXEL_WIDTH (f)) pix_x = FRAME_PIXEL_WIDTH (f);
4952 4938
4953 if (pix_y < 0) pix_y = 0; 4939 if (pix_y < 0) pix_y = 0;
4954 if (pix_y > PIXEL_HEIGHT (f)) pix_y = PIXEL_HEIGHT (f); 4940 if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f);
4955 4941
4956 x_set_mouse_pixel_position (f, pix_x, pix_y); 4942 x_set_mouse_pixel_position (f, pix_x, pix_y);
4957} 4943}
@@ -5050,8 +5036,7 @@ x_make_frame_visible (f)
5050 before the window gets really visible. */ 5036 before the window gets really visible. */
5051 if (! FRAME_ICONIFIED_P (f) 5037 if (! FRAME_ICONIFIED_P (f)
5052 && ! f->output_data.mac->asked_for_visible) 5038 && ! f->output_data.mac->asked_for_visible)
5053 x_set_offset (f, f->output_data.mac->left_pos, 5039 x_set_offset (f, f->left_pos, f->top_pos, 0);
5054 f->output_data.mac->top_pos, 0);
5055 5040
5056 f->output_data.mac->asked_for_visible = 1; 5041 f->output_data.mac->asked_for_visible = 1;
5057 5042
@@ -5228,8 +5213,8 @@ x_wm_set_size_hint (f, flags, user_position)
5228 /* Setting PMaxSize caused various problems. */ 5213 /* Setting PMaxSize caused various problems. */
5229 size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */; 5214 size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */;
5230 5215
5231 size_hints.x = f->output_data.x->left_pos; 5216 size_hints.x = f->left_pos;
5232 size_hints.y = f->output_data.x->top_pos; 5217 size_hints.y = f->top_pos;
5233 5218
5234#ifdef USE_X_TOOLKIT 5219#ifdef USE_X_TOOLKIT
5235 XtSetArg (al[ac], XtNwidth, &widget_width); ac++; 5220 XtSetArg (al[ac], XtNwidth, &widget_width); ac++;
@@ -5238,16 +5223,16 @@ x_wm_set_size_hint (f, flags, user_position)
5238 size_hints.height = widget_height; 5223 size_hints.height = widget_height;
5239 size_hints.width = widget_width; 5224 size_hints.width = widget_width;
5240#else /* not USE_X_TOOLKIT */ 5225#else /* not USE_X_TOOLKIT */
5241 size_hints.height = PIXEL_HEIGHT (f); 5226 size_hints.height = FRAME_PIXEL_HEIGHT (f);
5242 size_hints.width = PIXEL_WIDTH (f); 5227 size_hints.width = FRAME_PIXEL_WIDTH (f);
5243#endif /* not USE_X_TOOLKIT */ 5228#endif /* not USE_X_TOOLKIT */
5244 5229
5245 size_hints.width_inc = FONT_WIDTH (f->output_data.x->font); 5230 size_hints.width_inc = FRAME_COLUMN_WIDTH (f);
5246 size_hints.height_inc = f->output_data.x->line_height; 5231 size_hints.height_inc = FRAME_LINE_HEIGHT (f);
5247 size_hints.max_width 5232 size_hints.max_width
5248 = FRAME_X_DISPLAY_INFO (f)->width - CHAR_TO_PIXEL_WIDTH (f, 0); 5233 = FRAME_X_DISPLAY_INFO (f)->width - FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0);
5249 size_hints.max_height 5234 size_hints.max_height
5250 = FRAME_X_DISPLAY_INFO (f)->height - CHAR_TO_PIXEL_HEIGHT (f, 0); 5235 = FRAME_X_DISPLAY_INFO (f)->height - FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0);
5251 5236
5252 /* Calculate the base and minimum sizes. 5237 /* Calculate the base and minimum sizes.
5253 5238
@@ -5258,8 +5243,8 @@ x_wm_set_size_hint (f, flags, user_position)
5258 int base_width, base_height; 5243 int base_width, base_height;
5259 int min_rows = 0, min_cols = 0; 5244 int min_rows = 0, min_cols = 0;
5260 5245
5261 base_width = CHAR_TO_PIXEL_WIDTH (f, 0); 5246 base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0);
5262 base_height = CHAR_TO_PIXEL_HEIGHT (f, 0); 5247 base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0);
5263 5248
5264 check_frame_size (f, &min_rows, &min_cols); 5249 check_frame_size (f, &min_rows, &min_cols);
5265 5250
@@ -5334,7 +5319,7 @@ x_wm_set_size_hint (f, flags, user_position)
5334#endif 5319#endif
5335 5320
5336#ifdef PWinGravity 5321#ifdef PWinGravity
5337 size_hints.win_gravity = f->output_data.x->win_gravity; 5322 size_hints.win_gravity = f->win_gravity;
5338 size_hints.flags |= PWinGravity; 5323 size_hints.flags |= PWinGravity;
5339 5324
5340 if (user_position) 5325 if (user_position)
@@ -7016,8 +7001,8 @@ do_grow_window (WindowPtr w, EventRecord *e)
7016 /* see if it really changed size */ 7001 /* see if it really changed size */
7017 if (grow_size != 0) 7002 if (grow_size != 0)
7018 { 7003 {
7019 rows = PIXEL_TO_CHAR_HEIGHT (f, HiWord (grow_size)); 7004 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, HiWord (grow_size));
7020 columns = PIXEL_TO_CHAR_WIDTH (f, LoWord (grow_size)); 7005 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, LoWord (grow_size));
7021 7006
7022 x_set_window_size (f, 0, columns, rows); 7007 x_set_window_size (f, 0, columns, rows);
7023 } 7008 }
@@ -7069,7 +7054,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
7069 InsetRect (&zoom_rect, 8, 4); /* not too tight */ 7054 InsetRect (&zoom_rect, 8, 4); /* not too tight */
7070 7055
7071 zoom_rect.right = zoom_rect.left 7056 zoom_rect.right = zoom_rect.left
7072 + CHAR_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); 7057 + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
7073 7058
7074 SetWindowStandardState (w, &zoom_rect); 7059 SetWindowStandardState (w, &zoom_rect);
7075 } 7060 }
@@ -7091,7 +7076,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
7091 InsetRect (&zoom_rect, 8, 4); /* not too tight */ 7076 InsetRect (&zoom_rect, 8, 4); /* not too tight */
7092 7077
7093 zoom_rect.right = zoom_rect.left 7078 zoom_rect.right = zoom_rect.left
7094 + CHAR_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); 7079 + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
7095 7080
7096 (**((WStateDataHandle) ((WindowPeek) w)->dataHandle)).stdState 7081 (**((WStateDataHandle) ((WindowPeek) w)->dataHandle)).stdState
7097 = zoom_rect; 7082 = zoom_rect;
@@ -7106,8 +7091,8 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
7106#else 7091#else
7107 port_rect = w->portRect; 7092 port_rect = w->portRect;
7108#endif 7093#endif
7109 rows = PIXEL_TO_CHAR_HEIGHT (f, port_rect.bottom - port_rect.top); 7094 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top);
7110 columns = PIXEL_TO_CHAR_WIDTH (f, port_rect.right - port_rect.left); 7095 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left);
7111 x_set_window_size (mwp->mFP, 0, columns, rows); 7096 x_set_window_size (mwp->mFP, 0, columns, rows);
7112 7097
7113 SetPort (save_port); 7098 SetPort (save_port);
@@ -8256,7 +8241,7 @@ NewMacWindow (FRAME_PTR fp)
8256 8241
8257 mwp->fontset = -1; 8242 mwp->fontset = -1;
8258 8243
8259 SizeWindow (mwp->mWP, mwp->pixel_width, mwp->pixel_height, false); 8244 SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false);
8260 ShowWindow (mwp->mWP); 8245 ShowWindow (mwp->mWP);
8261 8246
8262} 8247}
@@ -8277,23 +8262,23 @@ make_mac_frame (struct frame *f)
8277 f->output_data.mac->mouse_pixel = 0xff00ff; 8262 f->output_data.mac->mouse_pixel = 0xff00ff;
8278 f->output_data.mac->cursor_foreground_pixel = 0x0000ff; 8263 f->output_data.mac->cursor_foreground_pixel = 0x0000ff;
8279 8264
8280 f->output_data.mac->fontset = -1; 8265 FRAME_FONTSET (f) = -1;
8281 f->output_data.mac->scroll_bar_foreground_pixel = -1; 8266 f->output_data.mac->scroll_bar_foreground_pixel = -1;
8282 f->output_data.mac->scroll_bar_background_pixel = -1; 8267 f->output_data.mac->scroll_bar_background_pixel = -1;
8283 f->output_data.mac->left_pos = 4;
8284 f->output_data.mac->top_pos = 4;
8285 f->output_data.mac->border_width = 0;
8286 f->output_data.mac->explicit_parent = 0; 8268 f->output_data.mac->explicit_parent = 0;
8269 f->left_pos = 4;
8270 f->top_pos = 4;
8271 f->border_width = 0;
8287 8272
8288 f->output_data.mac->internal_border_width = 0; 8273 f->internal_border_width = 0;
8289 8274
8290 f->output_method = output_mac; 8275 f->output_method = output_mac;
8291 8276
8292 f->auto_raise = 1; 8277 f->auto_raise = 1;
8293 f->auto_lower = 1; 8278 f->auto_lower = 1;
8294 8279
8295 f->new_width = 0; 8280 f->new_text_cols = 0;
8296 f->new_height = 0; 8281 f->new_text_lines = 0;
8297} 8282}
8298 8283
8299void 8284void
@@ -8307,14 +8292,14 @@ make_mac_terminal_frame (struct frame *f)
8307 f->output_data.mac = (struct mac_output *) 8292 f->output_data.mac = (struct mac_output *)
8308 xmalloc (sizeof (struct mac_output)); 8293 xmalloc (sizeof (struct mac_output));
8309 bzero (f->output_data.mac, sizeof (struct mac_output)); 8294 bzero (f->output_data.mac, sizeof (struct mac_output));
8310 f->output_data.mac->fontset = -1; 8295 FRAME_FONTSET (f) = -1;
8311 f->output_data.mac->scroll_bar_foreground_pixel = -1; 8296 f->output_data.mac->scroll_bar_foreground_pixel = -1;
8312 f->output_data.mac->scroll_bar_background_pixel = -1; 8297 f->output_data.mac->scroll_bar_background_pixel = -1;
8313 8298
8314 XSETFRAME (FRAME_KBOARD (f)->Vdefault_minibuffer_frame, f); 8299 XSETFRAME (FRAME_KBOARD (f)->Vdefault_minibuffer_frame, f);
8315 8300
8316 f->width = 96; 8301 FRAME_COLS (f) = 96;
8317 f->height = 4; 8302 FRAME_LINES (f) = 4;
8318 8303
8319 make_mac_frame (f); 8304 make_mac_frame (f);
8320 8305