aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2003-05-24 22:06:19 +0000
committerKim F. Storm2003-05-24 22:06:19 +0000
commit62e50ec61732d350ecd55cf179e49fa4d87fcd39 (patch)
tree06fe0a849404b2e70ea3dab95dea9e25da2465c5 /src
parent498eff1d31b2e6bb5f1c71e96c5a77fed92f1c93 (diff)
downloademacs-62e50ec61732d350ecd55cf179e49fa4d87fcd39.tar.gz
emacs-62e50ec61732d350ecd55cf179e49fa4d87fcd39.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. (w32_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/w32term.c232
1 files changed, 108 insertions, 124 deletions
diff --git a/src/w32term.c b/src/w32term.c
index 3656ff90b31..8ee27b8be7e 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -256,8 +256,7 @@ static void x_frame_rehighlight P_ ((struct w32_display_info *));
256static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *)); 256static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
257static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int, 257static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int,
258 enum text_cursor_kinds)); 258 enum text_cursor_kinds));
259static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, 259static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, HDC));
260 HDC, int));
261 260
262static Lisp_Object Qvendor_specific_keysyms; 261static Lisp_Object Qvendor_specific_keysyms;
263 262
@@ -653,7 +652,7 @@ x_after_update_window_line (desired_row)
653 { 652 {
654 HDC hdc = get_frame_dc (f); 653 HDC hdc = get_frame_dc (f);
655 w32_clear_area (f, hdc, 0, y, width, height); 654 w32_clear_area (f, hdc, 0, y, width, height);
656 w32_clear_area (f, hdc, f->output_data.w32->pixel_width - width, 655 w32_clear_area (f, hdc, FRAME_PIXEL_WIDTH (f) - width,
657 y, width, height); 656 y, width, height);
658 release_frame_dc (f, hdc); 657 release_frame_dc (f, hdc);
659 } 658 }
@@ -680,7 +679,7 @@ w32_draw_fringe_bitmap (w, row, p)
680 hdc = get_frame_dc (f); 679 hdc = get_frame_dc (f);
681 680
682 /* Must clip because of partially visible lines. */ 681 /* Must clip because of partially visible lines. */
683 w32_clip_to_row (w, row, hdc, 1); 682 w32_clip_to_row (w, row, hdc);
684 683
685 if (p->bx >= 0) 684 if (p->bx >= 0)
686 { 685 {
@@ -1834,9 +1833,10 @@ x_draw_glyph_string_box (s)
1834 if (s->row->full_width_p 1833 if (s->row->full_width_p
1835 && !s->w->pseudo_window_p) 1834 && !s->w->pseudo_window_p)
1836 { 1835 {
1837 last_x += FRAME_X_RIGHT_FRINGE_WIDTH (s->f); 1836 last_x += WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w);
1838 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f)) 1837 if (s->area != RIGHT_MARGIN_AREA
1839 last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f); 1838 || WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
1839 last_x += WINDOW_RIGHT_FRINGE_WIDTH (s->w);
1840 } 1840 }
1841 1841
1842 /* The glyph that may have a right box line. */ 1842 /* The glyph that may have a right box line. */
@@ -2258,7 +2258,7 @@ x_draw_stretch_glyph_string (s)
2258 { 2258 {
2259 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor 2259 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
2260 as wide as the stretch glyph. */ 2260 as wide as the stretch glyph. */
2261 int width = min (CANON_X_UNIT (s->f), s->background_width); 2261 int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width);
2262 2262
2263 /* Draw cursor. */ 2263 /* Draw cursor. */
2264 x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); 2264 x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height);
@@ -2603,8 +2603,6 @@ x_scroll_run (w, run)
2603 without mode lines. Include in this box the left and right 2603 without mode lines. Include in this box the left and right
2604 fringes of W. */ 2604 fringes of W. */
2605 window_box (w, -1, &x, &y, &width, &height); 2605 window_box (w, -1, &x, &y, &width, &height);
2606 width += FRAME_X_FRINGE_WIDTH (f);
2607 x -= FRAME_X_LEFT_FRINGE_WIDTH (f);
2608 2606
2609 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); 2607 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y);
2610 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); 2608 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y);
@@ -3072,15 +3070,14 @@ glyph_rect (f, x, y, rect)
3072{ 3070{
3073 Lisp_Object window; 3071 Lisp_Object window;
3074 3072
3075 window = window_from_coordinates (f, x, y, 0, 0); 3073 window = window_from_coordinates (f, x, y, 0, &x, &y, 0);
3074
3076 if (!NILP (window)) 3075 if (!NILP (window))
3077 { 3076 {
3078 struct window *w = XWINDOW (window); 3077 struct window *w = XWINDOW (window);
3079 struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 3078 struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
3080 struct glyph_row *end = r + w->current_matrix->nrows - 1; 3079 struct glyph_row *end = r + w->current_matrix->nrows - 1;
3081 3080
3082 frame_to_window_pixel_xy (w, &x, &y);
3083
3084 for (; r < end && r->enabled_p; ++r) 3081 for (; r < end && r->enabled_p; ++r)
3085 if (r->y <= y && r->y + r->height > y) 3082 if (r->y <= y && r->y + r->height > y)
3086 { 3083 {
@@ -3095,7 +3092,10 @@ glyph_rect (f, x, y, rect)
3095 if (x < r->x) 3092 if (x < r->x)
3096 { 3093 {
3097 /* x is to the left of the first glyph in the row. */ 3094 /* x is to the left of the first glyph in the row. */
3098 rect->left = XINT (w->left); 3095 /* Shouldn't this be a pixel value?
3096 WINDOW_LEFT_EDGE_X (w) seems to be the right value.
3097 ++KFS */
3098 rect->left = WINDOW_LEFT_EDGE_COL (w);
3099 rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x); 3099 rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x);
3100 return 1; 3100 return 1;
3101 } 3101 }
@@ -3111,7 +3111,10 @@ glyph_rect (f, x, y, rect)
3111 3111
3112 /* x is to the right of the last glyph in the row. */ 3112 /* x is to the right of the last glyph in the row. */
3113 rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx); 3113 rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx);
3114 rect->right = XINT (w->left) + XINT (w->width); 3114 /* Shouldn't this be a pixel value?
3115 WINDOW_RIGHT_EDGE_X (w) seems to be the right value.
3116 ++KFS */
3117 rect->right = WINDOW_RIGHT_EDGE_COL (w);
3115 return 1; 3118 return 1;
3116 } 3119 }
3117 } 3120 }
@@ -3131,7 +3134,7 @@ remember_mouse_glyph (f1, gx, gy)
3131 int width = FRAME_SMALLEST_CHAR_WIDTH (f1); 3134 int width = FRAME_SMALLEST_CHAR_WIDTH (f1);
3132 int height = FRAME_SMALLEST_FONT_HEIGHT (f1); 3135 int height = FRAME_SMALLEST_FONT_HEIGHT (f1);
3133 3136
3134 /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to 3137 /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to
3135 round down even for negative values. */ 3138 round down even for negative values. */
3136 if (gx < 0) 3139 if (gx < 0)
3137 gx -= width - 1; 3140 gx -= width - 1;
@@ -3572,31 +3575,26 @@ w32_set_vertical_scroll_bar (w, portion, whole, position)
3572 struct frame *f = XFRAME (w->frame); 3575 struct frame *f = XFRAME (w->frame);
3573 struct scroll_bar *bar; 3576 struct scroll_bar *bar;
3574 int top, height, left, sb_left, width, sb_width; 3577 int top, height, left, sb_left, width, sb_width;
3575 int window_x, window_y, window_width, window_height; 3578 int window_y, window_height;
3576 3579
3577 /* Get window dimensions. */ 3580 /* Get window dimensions. */
3578 window_box (w, -1, &window_x, &window_y, &window_width, &window_height); 3581 window_box (w, -1, 0, &window_y, 0, &window_height);
3579 top = window_y; 3582 top = window_y;
3580 width = FRAME_SCROLL_BAR_COLS (f) * CANON_X_UNIT (f); 3583 width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
3581 height = window_height; 3584 height = window_height;
3582 3585
3583 /* Compute the left edge of the scroll bar area. */ 3586 /* Compute the left edge of the scroll bar area. */
3584 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) 3587 left = WINDOW_SCROLL_BAR_AREA_X (w);
3585 left = XINT (w->left) + XINT (w->width) - FRAME_SCROLL_BAR_COLS (f);
3586 else
3587 left = XFASTINT (w->left);
3588 left *= CANON_X_UNIT (f);
3589 left += FRAME_INTERNAL_BORDER_WIDTH (f);
3590 3588
3591 /* Compute the width of the scroll bar which might be less than 3589 /* Compute the width of the scroll bar which might be less than
3592 the width of the area reserved for the scroll bar. */ 3590 the width of the area reserved for the scroll bar. */
3593 if (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0) 3591 if (WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) > 0)
3594 sb_width = FRAME_SCROLL_BAR_PIXEL_WIDTH (f); 3592 sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
3595 else 3593 else
3596 sb_width = width; 3594 sb_width = width;
3597 3595
3598 /* Compute the left edge of the scroll bar. */ 3596 /* Compute the left edge of the scroll bar. */
3599 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) 3597 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
3600 sb_left = left + width - sb_width - (width - sb_width) / 2; 3598 sb_left = left + width - sb_width - (width - sb_width) / 2;
3601 else 3599 else
3602 sb_left = left + (width - sb_width) / 2; 3600 sb_left = left + (width - sb_width) / 2;
@@ -4248,7 +4246,7 @@ w32_read_socket (sd, bufp, numchars, expected)
4248 int x = LOWORD (msg.msg.lParam); 4246 int x = LOWORD (msg.msg.lParam);
4249 int y = HIWORD (msg.msg.lParam); 4247 int y = HIWORD (msg.msg.lParam);
4250 4248
4251 window = window_from_coordinates (f, x, y, 0, 0); 4249 window = window_from_coordinates (f, x, y, 0, 0, 0, 0);
4252 4250
4253 /* Window will be selected only when it is not 4251 /* Window will be selected only when it is not
4254 selected now and last mouse movement event was 4252 selected now and last mouse movement event was
@@ -4333,13 +4331,13 @@ w32_read_socket (sd, bufp, numchars, expected)
4333 4331
4334 /* Is this in the tool-bar? */ 4332 /* Is this in the tool-bar? */
4335 if (WINDOWP (f->tool_bar_window) 4333 if (WINDOWP (f->tool_bar_window)
4336 && XFASTINT (XWINDOW (f->tool_bar_window)->height)) 4334 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)))
4337 { 4335 {
4338 Lisp_Object window; 4336 Lisp_Object window;
4339 int x = XFASTINT (emacs_event.x); 4337 int x = XFASTINT (emacs_event.x);
4340 int y = XFASTINT (emacs_event.y); 4338 int y = XFASTINT (emacs_event.y);
4341 4339
4342 window = window_from_coordinates (f, x, y, 0, 1); 4340 window = window_from_coordinates (f, x, y, 0, 0, 0, 1);
4343 4341
4344 if (EQ (window, f->tool_bar_window)) 4342 if (EQ (window, f->tool_bar_window))
4345 { 4343 {
@@ -4439,9 +4437,8 @@ w32_read_socket (sd, bufp, numchars, expected)
4439 if (f) 4437 if (f)
4440 { 4438 {
4441 x_check_fullscreen_move(f); 4439 x_check_fullscreen_move(f);
4442 if (f->output_data.w32->want_fullscreen & FULLSCREEN_WAIT) 4440 if (f->want_fullscreen & FULLSCREEN_WAIT)
4443 f->output_data.w32->want_fullscreen &= 4441 f->want_fullscreen &= ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH);
4444 ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH);
4445 } 4442 }
4446 check_visibility = 1; 4443 check_visibility = 1;
4447 break; 4444 break;
@@ -4462,8 +4459,8 @@ w32_read_socket (sd, bufp, numchars, expected)
4462 int x, y; 4459 int x, y;
4463 4460
4464 x_real_positions (f, &x, &y); 4461 x_real_positions (f, &x, &y);
4465 f->output_data.w32->left_pos = x; 4462 f->left_pos = x;
4466 f->output_data.w32->top_pos = y; 4463 f->top_pos = y;
4467 } 4464 }
4468 4465
4469 check_visibility = 1; 4466 check_visibility = 1;
@@ -4535,8 +4532,8 @@ w32_read_socket (sd, bufp, numchars, expected)
4535 when the Window is iconified, with 3000,3000 4532 when the Window is iconified, with 3000,3000
4536 as the co-ords. */ 4533 as the co-ords. */
4537 x_real_positions (f, &x, &y); 4534 x_real_positions (f, &x, &y);
4538 f->output_data.w32->left_pos = x; 4535 f->left_pos = x;
4539 f->output_data.w32->top_pos = y; 4536 f->top_pos = y;
4540 4537
4541 bufp->kind = DEICONIFY_EVENT; 4538 bufp->kind = DEICONIFY_EVENT;
4542 XSETFRAME (bufp->frame_or_window, f); 4539 XSETFRAME (bufp->frame_or_window, f);
@@ -4568,8 +4565,8 @@ w32_read_socket (sd, bufp, numchars, expected)
4568 height = rect.bottom - rect.top; 4565 height = rect.bottom - rect.top;
4569 width = rect.right - rect.left; 4566 width = rect.right - rect.left;
4570 4567
4571 rows = PIXEL_TO_CHAR_HEIGHT (f, height); 4568 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height);
4572 columns = PIXEL_TO_CHAR_WIDTH (f, width); 4569 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width);
4573 4570
4574 /* TODO: Clip size to the screen dimensions. */ 4571 /* TODO: Clip size to the screen dimensions. */
4575 4572
@@ -4577,17 +4574,17 @@ w32_read_socket (sd, bufp, numchars, expected)
4577 not changed, the font size may have changed, so we need 4574 not changed, the font size may have changed, so we need
4578 to check the pixel dimensions as well. */ 4575 to check the pixel dimensions as well. */
4579 4576
4580 if (columns != f->width 4577 if (columns != FRAME_COLS (f)
4581 || rows != f->height 4578 || rows != FRAME_LINES (f)
4582 || width != f->output_data.w32->pixel_width 4579 || width != FRAME_PIXEL_WIDTH (f)
4583 || height != f->output_data.w32->pixel_height) 4580 || height != FRAME_PIXEL_HEIGHT (f))
4584 { 4581 {
4585 change_frame_size (f, rows, columns, 0, 1, 0); 4582 change_frame_size (f, rows, columns, 0, 1, 0);
4586 SET_FRAME_GARBAGED (f); 4583 SET_FRAME_GARBAGED (f);
4587 cancel_mouse_face (f); 4584 cancel_mouse_face (f);
4588 f->output_data.w32->pixel_width = width; 4585 FRAME_PIXEL_WIDTH (f) = width;
4589 f->output_data.w32->pixel_height = height; 4586 FRAME_PIXEL_HEIGHT (f) = height;
4590 f->output_data.w32->win_gravity = NorthWestGravity; 4587 f->win_gravity = NorthWestGravity;
4591 } 4588 }
4592 } 4589 }
4593 4590
@@ -4868,25 +4865,22 @@ w32_read_socket (sd, bufp, numchars, expected)
4868 4865
4869/* Set clipping for output in glyph row ROW. W is the window in which 4866/* Set clipping for output in glyph row ROW. W is the window in which
4870 we operate. GC is the graphics context to set clipping in. 4867 we operate. GC is the graphics context to set clipping in.
4871 WHOLE_LINE_P non-zero means include the areas used for truncation
4872 mark display and alike in the clipping rectangle.
4873 4868
4874 ROW may be a text row or, e.g., a mode line. Text rows must be 4869 ROW may be a text row or, e.g., a mode line. Text rows must be
4875 clipped to the interior of the window dedicated to text display, 4870 clipped to the interior of the window dedicated to text display,
4876 mode lines must be clipped to the whole window. */ 4871 mode lines must be clipped to the whole window. */
4877 4872
4878static void 4873static void
4879w32_clip_to_row (w, row, hdc, whole_line_p) 4874w32_clip_to_row (w, row, hdc)
4880 struct window *w; 4875 struct window *w;
4881 struct glyph_row *row; 4876 struct glyph_row *row;
4882 HDC hdc; 4877 HDC hdc;
4883 int whole_line_p;
4884{ 4878{
4885 struct frame *f = XFRAME (WINDOW_FRAME (w)); 4879 struct frame *f = XFRAME (WINDOW_FRAME (w));
4886 RECT clip_rect; 4880 RECT clip_rect;
4887 int window_x, window_y, window_width, window_height; 4881 int window_y, window_width;
4888 4882
4889 window_box (w, -1, &window_x, &window_y, &window_width, &window_height); 4883 window_box (w, -1, 0, &window_y, &window_width, 0);
4890 4884
4891 clip_rect.left = WINDOW_TO_FRAME_PIXEL_X (w, 0); 4885 clip_rect.left = WINDOW_TO_FRAME_PIXEL_X (w, 0);
4892 clip_rect.top = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); 4886 clip_rect.top = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
@@ -4894,14 +4888,6 @@ w32_clip_to_row (w, row, hdc, whole_line_p)
4894 clip_rect.right = clip_rect.left + window_width; 4888 clip_rect.right = clip_rect.left + window_width;
4895 clip_rect.bottom = clip_rect.top + row->visible_height; 4889 clip_rect.bottom = clip_rect.top + row->visible_height;
4896 4890
4897 /* If clipping to the whole line, including trunc marks, extend
4898 the rectangle to the left and increase its width. */
4899 if (whole_line_p)
4900 {
4901 clip_rect.left -= FRAME_X_LEFT_FRINGE_WIDTH (f);
4902 clip_rect.right += FRAME_X_FRINGE_WIDTH (f);
4903 }
4904
4905 w32_set_clip_rectangle (hdc, &clip_rect); 4891 w32_set_clip_rectangle (hdc, &clip_rect);
4906} 4892}
4907 4893
@@ -4940,13 +4926,13 @@ x_draw_hollow_cursor (w, row)
4940 wd = cursor_glyph->pixel_width; 4926 wd = cursor_glyph->pixel_width;
4941 if (cursor_glyph->type == STRETCH_GLYPH 4927 if (cursor_glyph->type == STRETCH_GLYPH
4942 && !x_stretch_cursor_p) 4928 && !x_stretch_cursor_p)
4943 wd = min (CANON_X_UNIT (f), wd); 4929 wd = min (FRAME_COLUMN_WIDTH (f), wd);
4944 w->phys_cursor_width = wd; 4930 w->phys_cursor_width = wd;
4945 4931
4946 rect.right = rect.left + wd; 4932 rect.right = rect.left + wd;
4947 hdc = get_frame_dc (f); 4933 hdc = get_frame_dc (f);
4948 /* Set clipping, draw the rectangle, and reset clipping again. */ 4934 /* Set clipping, draw the rectangle, and reset clipping again. */
4949 w32_clip_to_row (w, row, hdc, 0); 4935 w32_clip_to_row (w, row, hdc);
4950 FrameRect (hdc, &rect, hb); 4936 FrameRect (hdc, &rect, hb);
4951 DeleteObject (hb); 4937 DeleteObject (hb);
4952 w32_set_clip_rectangle (hdc, NULL); 4938 w32_set_clip_rectangle (hdc, NULL);
@@ -5012,7 +4998,7 @@ x_draw_bar_cursor (w, row, width, kind)
5012 4998
5013 4999
5014 hdc = get_frame_dc (f); 5000 hdc = get_frame_dc (f);
5015 w32_clip_to_row (w, row, hdc, 0); 5001 w32_clip_to_row (w, row, hdc);
5016 5002
5017 if (kind == BAR_CURSOR) 5003 if (kind == BAR_CURSOR)
5018 { 5004 {
@@ -5241,29 +5227,30 @@ x_new_font (f, fontname)
5241 FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; 5227 FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;
5242 FRAME_FONTSET (f) = -1; 5228 FRAME_FONTSET (f) = -1;
5243 5229
5230 FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f));
5231 FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f));
5232
5233 compute_fringe_widths (f, 1);
5234
5244 /* Compute the scroll bar width in character columns. */ 5235 /* Compute the scroll bar width in character columns. */
5245 if (f->scroll_bar_pixel_width > 0) 5236 if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
5246 { 5237 {
5247 int wid = FONT_WIDTH (FRAME_FONT (f)); 5238 int wid = FRAME_COLUMN_WIDTH (f);
5248 f->scroll_bar_cols = (f->scroll_bar_pixel_width + wid-1) / wid; 5239 FRAME_CONFIG_SCROLL_BAR_COLS (f)
5240 = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid-1) / wid;
5249 } 5241 }
5250 else 5242 else
5251 { 5243 {
5252 int wid = FONT_WIDTH (FRAME_FONT (f)); 5244 int wid = FRAME_COLUMN_WIDTH (f);
5253 f->scroll_bar_cols = (14 + wid - 1) / wid; 5245 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
5254 } 5246 }
5255 5247
5256 /* Now make the frame display the given font. */ 5248 /* Now make the frame display the given font. */
5257 if (FRAME_W32_WINDOW (f) != 0) 5249 if (FRAME_W32_WINDOW (f) != 0)
5258 { 5250 {
5259 frame_update_line_height (f);
5260 if (NILP (tip_frame) || XFRAME (tip_frame) != f) 5251 if (NILP (tip_frame) || XFRAME (tip_frame) != f)
5261 x_set_window_size (f, 0, f->width, f->height); 5252 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
5262 } 5253 }
5263 else
5264 /* If we are setting a new frame's font for the first time,
5265 there are no faces yet, so this font's height is the line height. */
5266 f->output_data.w32->line_height = FONT_HEIGHT (FRAME_FONT (f));
5267 5254
5268 return build_string (fontp->full_name); 5255 return build_string (fontp->full_name);
5269} 5256}
@@ -5325,7 +5312,7 @@ x_calc_absolute_position (f)
5325 struct frame *f; 5312 struct frame *f;
5326{ 5313{
5327 POINT pt; 5314 POINT pt;
5328 int flags = f->output_data.w32->size_hint_flags; 5315 int flags = f->size_hint_flags;
5329 5316
5330 pt.x = pt.y = 0; 5317 pt.x = pt.y = 0;
5331 5318
@@ -5357,20 +5344,20 @@ x_calc_absolute_position (f)
5357 /* Treat negative positions as relative to the leftmost bottommost 5344 /* Treat negative positions as relative to the leftmost bottommost
5358 position that fits on the screen. */ 5345 position that fits on the screen. */
5359 if (flags & XNegative) 5346 if (flags & XNegative)
5360 f->output_data.w32->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width 5347 f->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width
5361 - 2 * f->output_data.w32->border_width - pt.x 5348 - 2 * f->border_width - pt.x
5362 - PIXEL_WIDTH (f) 5349 - FRAME_PIXEL_WIDTH (f)
5363 + f->output_data.w32->left_pos); 5350 + f->left_pos);
5364 5351
5365 if (flags & YNegative) 5352 if (flags & YNegative)
5366 f->output_data.w32->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height 5353 f->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height
5367 - 2 * f->output_data.w32->border_width - pt.y 5354 - 2 * f->border_width - pt.y
5368 - PIXEL_HEIGHT (f) 5355 - FRAME_PIXEL_HEIGHT (f)
5369 + f->output_data.w32->top_pos); 5356 + f->top_pos);
5370 /* The left_pos and top_pos 5357 /* The left_pos and top_pos
5371 are now relative to the top and left screen edges, 5358 are now relative to the top and left screen edges,
5372 so the flags should correspond. */ 5359 so the flags should correspond. */
5373 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative); 5360 f->size_hint_flags &= ~ (XNegative | YNegative);
5374} 5361}
5375 5362
5376/* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, 5363/* CHANGE_GRAVITY is 1 when calling from Fset_frame_position,
@@ -5389,22 +5376,22 @@ x_set_offset (f, xoff, yoff, change_gravity)
5389 5376
5390 if (change_gravity > 0) 5377 if (change_gravity > 0)
5391 { 5378 {
5392 f->output_data.w32->top_pos = yoff; 5379 f->top_pos = yoff;
5393 f->output_data.w32->left_pos = xoff; 5380 f->left_pos = xoff;
5394 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative); 5381 f->size_hint_flags &= ~ (XNegative | YNegative);
5395 if (xoff < 0) 5382 if (xoff < 0)
5396 f->output_data.w32->size_hint_flags |= XNegative; 5383 f->size_hint_flags |= XNegative;
5397 if (yoff < 0) 5384 if (yoff < 0)
5398 f->output_data.w32->size_hint_flags |= YNegative; 5385 f->size_hint_flags |= YNegative;
5399 f->output_data.w32->win_gravity = NorthWestGravity; 5386 f->win_gravity = NorthWestGravity;
5400 } 5387 }
5401 x_calc_absolute_position (f); 5388 x_calc_absolute_position (f);
5402 5389
5403 BLOCK_INPUT; 5390 BLOCK_INPUT;
5404 x_wm_set_size_hint (f, (long) 0, 0); 5391 x_wm_set_size_hint (f, (long) 0, 0);
5405 5392
5406 modified_left = f->output_data.w32->left_pos; 5393 modified_left = f->left_pos;
5407 modified_top = f->output_data.w32->top_pos; 5394 modified_top = f->top_pos;
5408 5395
5409 my_set_window_pos (FRAME_W32_WINDOW (f), 5396 my_set_window_pos (FRAME_W32_WINDOW (f),
5410 NULL, 5397 NULL,
@@ -5421,12 +5408,11 @@ static void
5421x_check_fullscreen (f) 5408x_check_fullscreen (f)
5422 struct frame *f; 5409 struct frame *f;
5423{ 5410{
5424 if (f->output_data.w32->want_fullscreen & FULLSCREEN_BOTH) 5411 if (f->want_fullscreen & FULLSCREEN_BOTH)
5425 { 5412 {
5426 int width, height, ign; 5413 int width, height, ign;
5427 5414
5428 x_real_positions (f, &f->output_data.w32->left_pos, 5415 x_real_positions (f, &f->left_pos, &f->top_pos);
5429 &f->output_data.w32->top_pos);
5430 5416
5431 x_fullscreen_adjust (f, &width, &height, &ign, &ign); 5417 x_fullscreen_adjust (f, &width, &height, &ign, &ign);
5432 5418
@@ -5434,14 +5420,14 @@ x_check_fullscreen (f)
5434 when setting WM manager hints. 5420 when setting WM manager hints.
5435 If the frame is visible already, the position is checked by 5421 If the frame is visible already, the position is checked by
5436 x_check_fullscreen_move. */ 5422 x_check_fullscreen_move. */
5437 if (f->width != width || f->height != height) 5423 if (FRAME_COLS (f) != width || FRAME_LINES (f) != height)
5438 { 5424 {
5439 change_frame_size (f, height, width, 0, 1, 0); 5425 change_frame_size (f, height, width, 0, 1, 0);
5440 SET_FRAME_GARBAGED (f); 5426 SET_FRAME_GARBAGED (f);
5441 cancel_mouse_face (f); 5427 cancel_mouse_face (f);
5442 5428
5443 /* Wait for the change of frame size to occur */ 5429 /* Wait for the change of frame size to occur */
5444 f->output_data.w32->want_fullscreen |= FULLSCREEN_WAIT; 5430 f->want_fullscreen |= FULLSCREEN_WAIT;
5445 } 5431 }
5446 } 5432 }
5447} 5433}
@@ -5456,22 +5442,22 @@ static void
5456x_check_fullscreen_move (f) 5442x_check_fullscreen_move (f)
5457 struct frame *f; 5443 struct frame *f;
5458{ 5444{
5459 if (f->output_data.w32->want_fullscreen & FULLSCREEN_MOVE_WAIT) 5445 if (f->want_fullscreen & FULLSCREEN_MOVE_WAIT)
5460 { 5446 {
5461 int expect_top = f->output_data.w32->top_pos; 5447 int expect_top = f->top_pos;
5462 int expect_left = f->output_data.w32->left_pos; 5448 int expect_left = f->left_pos;
5463 5449
5464 if (f->output_data.w32->want_fullscreen & FULLSCREEN_HEIGHT) 5450 if (f->want_fullscreen & FULLSCREEN_HEIGHT)
5465 expect_top = 0; 5451 expect_top = 0;
5466 if (f->output_data.w32->want_fullscreen & FULLSCREEN_WIDTH) 5452 if (f->want_fullscreen & FULLSCREEN_WIDTH)
5467 expect_left = 0; 5453 expect_left = 0;
5468 5454
5469 if (expect_top != f->output_data.w32->top_pos 5455 if (expect_top != f->top_pos
5470 || expect_left != f->output_data.w32->left_pos) 5456 || expect_left != f->left_pos)
5471 x_set_offset (f, expect_left, expect_top, 1); 5457 x_set_offset (f, expect_left, expect_top, 1);
5472 5458
5473 /* Just do this once */ 5459 /* Just do this once */
5474 f->output_data.w32->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT; 5460 f->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT;
5475 } 5461 }
5476} 5462}
5477 5463
@@ -5492,17 +5478,15 @@ x_set_window_size (f, change_gravity, cols, rows)
5492 BLOCK_INPUT; 5478 BLOCK_INPUT;
5493 5479
5494 check_frame_size (f, &rows, &cols); 5480 check_frame_size (f, &rows, &cols);
5495 f->output_data.w32->vertical_scroll_bar_extra 5481 f->scroll_bar_actual_width
5496 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) 5482 = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f);
5497 ? 0
5498 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font)));
5499 5483
5500 compute_fringe_widths (f, 0); 5484 compute_fringe_widths (f, 0);
5501 5485
5502 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); 5486 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols);
5503 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); 5487 pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
5504 5488
5505 f->output_data.w32->win_gravity = NorthWestGravity; 5489 f->win_gravity = NorthWestGravity;
5506 x_wm_set_size_hint (f, (long) 0, 0); 5490 x_wm_set_size_hint (f, (long) 0, 0);
5507 5491
5508 { 5492 {
@@ -5537,8 +5521,8 @@ x_set_window_size (f, change_gravity, cols, rows)
5537 We pass 1 for DELAY since we can't run Lisp code inside of 5521 We pass 1 for DELAY since we can't run Lisp code inside of
5538 a BLOCK_INPUT. */ 5522 a BLOCK_INPUT. */
5539 change_frame_size (f, rows, cols, 0, 1, 0); 5523 change_frame_size (f, rows, cols, 0, 1, 0);
5540 PIXEL_WIDTH (f) = pixelwidth; 5524 FRAME_PIXEL_WIDTH (f) = pixelwidth;
5541 PIXEL_HEIGHT (f) = pixelheight; 5525 FRAME_PIXEL_HEIGHT (f) = pixelheight;
5542 5526
5543 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to 5527 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to
5544 receive in the ConfigureNotify event; if we get what we asked 5528 receive in the ConfigureNotify event; if we get what we asked
@@ -5569,14 +5553,14 @@ x_set_mouse_position (f, x, y)
5569{ 5553{
5570 int pix_x, pix_y; 5554 int pix_x, pix_y;
5571 5555
5572 pix_x = CHAR_TO_PIXEL_COL (f, x) + FONT_WIDTH (f->output_data.w32->font) / 2; 5556 pix_x = FRAME_COL_TO_PIXEL_X (f, x) + FRAME_COLUMN_WIDTH (f) / 2;
5573 pix_y = CHAR_TO_PIXEL_ROW (f, y) + f->output_data.w32->line_height / 2; 5557 pix_y = FRAME_LINE_TO_PIXEL_Y (f, y) + FRAME_LINE_HEIGHT (f) / 2;
5574 5558
5575 if (pix_x < 0) pix_x = 0; 5559 if (pix_x < 0) pix_x = 0;
5576 if (pix_x > PIXEL_WIDTH (f)) pix_x = PIXEL_WIDTH (f); 5560 if (pix_x > FRAME_PIXEL_WIDTH (f)) pix_x = FRAME_PIXEL_WIDTH (f);
5577 5561
5578 if (pix_y < 0) pix_y = 0; 5562 if (pix_y < 0) pix_y = 0;
5579 if (pix_y > PIXEL_HEIGHT (f)) pix_y = PIXEL_HEIGHT (f); 5563 if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f);
5580 5564
5581 x_set_mouse_pixel_position (f, pix_x, pix_y); 5565 x_set_mouse_pixel_position (f, pix_x, pix_y);
5582} 5566}
@@ -5744,7 +5728,7 @@ x_make_frame_visible (f)
5744 before the window gets really visible. */ 5728 before the window gets really visible. */
5745 if (! FRAME_ICONIFIED_P (f) 5729 if (! FRAME_ICONIFIED_P (f)
5746 && ! f->output_data.w32->asked_for_visible) 5730 && ! f->output_data.w32->asked_for_visible)
5747 x_set_offset (f, f->output_data.w32->left_pos, f->output_data.w32->top_pos, 0); 5731 x_set_offset (f, f->left_pos, f->top_pos, 0);
5748 5732
5749 f->output_data.w32->asked_for_visible = 1; 5733 f->output_data.w32->asked_for_visible = 1;
5750 5734
@@ -5932,10 +5916,10 @@ x_wm_set_size_hint (f, flags, user_position)
5932 5916
5933 enter_crit (); 5917 enter_crit ();
5934 5918
5935 SetWindowLong (window, WND_FONTWIDTH_INDEX, FONT_WIDTH (f->output_data.w32->font)); 5919 SetWindowLong (window, WND_FONTWIDTH_INDEX, FRAME_COLUMN_WIDTH (f));
5936 SetWindowLong (window, WND_LINEHEIGHT_INDEX, f->output_data.w32->line_height); 5920 SetWindowLong (window, WND_LINEHEIGHT_INDEX, FRAME_LINE_HEIGHT (f));
5937 SetWindowLong (window, WND_BORDER_INDEX, f->output_data.w32->internal_border_width); 5921 SetWindowLong (window, WND_BORDER_INDEX, FRAME_INTERNAL_BORDER_WIDTH (f));
5938 SetWindowLong (window, WND_SCROLLBAR_INDEX, f->output_data.w32->vertical_scroll_bar_extra); 5922 SetWindowLong (window, WND_SCROLLBAR_INDEX, f->scroll_bar_actual_width);
5939 5923
5940 leave_crit (); 5924 leave_crit ();
5941} 5925}