aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2013-03-22 00:21:20 +0900
committerKenichi Handa2013-03-22 00:21:20 +0900
commit022039da8ea1166498c507dda4944afd9c49c9fe (patch)
treef6fef85c61f1483cadf977775b7f99c98f63514b /src
parent8bc369d4a23a3a8040d77e3ce89a7f63b1ecff97 (diff)
parentafff09d015b0e17c059e68fe4a8f1d31014a3700 (diff)
downloademacs-022039da8ea1166498c507dda4944afd9c49c9fe.tar.gz
emacs-022039da8ea1166498c507dda4944afd9c49c9fe.zip
merge trunk
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog27
-rw-r--r--src/dispnew.c22
-rw-r--r--src/font.c13
-rw-r--r--src/frame.c14
-rw-r--r--src/frame.h54
-rw-r--r--src/image.c4
-rw-r--r--src/nsfns.m3
-rw-r--r--src/w32fns.c20
-rw-r--r--src/w32font.c2
-rw-r--r--src/window.c159
-rw-r--r--src/window.h57
-rw-r--r--src/xdisp.c40
-rw-r--r--src/xfaces.c4
-rw-r--r--src/xfns.c22
-rw-r--r--src/xsettings.c9
15 files changed, 228 insertions, 222 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2498bc8c974..0634ec7cc1d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -4,6 +4,33 @@
4 4
5 * insdel.c (insert_from_gap): Fix previous change. 5 * insdel.c (insert_from_gap): Fix previous change.
6 6
72013-03-20 Dmitry Antipov <dmantipov@yandex.ru>
8
9 * window.h (struct window): Convert left_col, top_line, total_lines
10 and total_cols from Lisp_Objects to integers. Adjust comments.
11 (wset_left_col, wset_top_line, wset_total_cols, wset_total_lines):
12 Remove.
13 (WINDOW_TOTAL_COLS, WINDOW_TOTAL_LINES, WINDOW_LEFT_EDGE_COL)
14 (WINDOW_TOP_EDGE_LINE): Drop Lisp_Object to integer conversion.
15 * dispnew.c, frame.c, w32fns.c, window.c, xdisp.c, xfns.c:
16 Adjust users where appropriate.
17
182013-03-20 Dmitry Antipov <dmantipov@yandex.ru>
19
20 * frame.h (struct frame): Drop resx and resy because the same data is
21 available from window system-specific output context. Adjust users.
22 (default_pixels_per_inch_x, default_pixels_per_inch_y): New
23 functions to provide defaults when no window system available.
24 (FRAME_RES_X, FRAME_RES_Y): New macros.
25 (NUMVAL): Moved from xdisp.c.
26 * font.c (font_pixel_size, font_find_for_lface, font_open_for_lface)
27 (Ffont_face_attributes, Fopen_font):
28 * image.c (gs_load):
29 * w32font.c (fill_in_logfont):
30 * xdisp.c (calc_pixel_width_or_height):
31 * xfaces.c (Fx_family_fonts, set_lface_from_font): Use them.
32 * xsettings.c (apply_xft_settings): Drop frame loop and adjust comment.
33
72013-03-20 Kenichi Handa <handa@gnu.org> 342013-03-20 Kenichi Handa <handa@gnu.org>
8 35
9 * coding.c (syms_of_coding): Initialize disable_ascii_optimization 36 * coding.c (syms_of_coding): Initialize disable_ascii_optimization
diff --git a/src/dispnew.c b/src/dispnew.c
index f23562cb97a..bc65050605a 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -363,7 +363,7 @@ margin_glyphs_to_reserve (struct window *w, int total_glyphs, Lisp_Object margin
363 363
364 if (NUMBERP (margin)) 364 if (NUMBERP (margin))
365 { 365 {
366 int width = XFASTINT (w->total_cols); 366 int width = w->total_cols;
367 double d = max (0, XFLOATINT (margin)); 367 double d = max (0, XFLOATINT (margin));
368 d = min (width / 2 - 1, d); 368 d = min (width / 2 - 1, d);
369 n = (int) ((double) total_glyphs / width * d); 369 n = (int) ((double) total_glyphs / width * d);
@@ -1776,7 +1776,7 @@ required_matrix_width (struct window *w)
1776 } 1776 }
1777#endif /* HAVE_WINDOW_SYSTEM */ 1777#endif /* HAVE_WINDOW_SYSTEM */
1778 1778
1779 return XINT (w->total_cols); 1779 return w->total_cols;
1780} 1780}
1781 1781
1782 1782
@@ -2114,10 +2114,10 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2114 2114
2115 /* Set window dimensions to frame dimensions and allocate or 2115 /* Set window dimensions to frame dimensions and allocate or
2116 adjust glyph matrices of W. */ 2116 adjust glyph matrices of W. */
2117 wset_top_line (w, make_number (0)); 2117 w->top_line = 0;
2118 wset_left_col (w, make_number (0)); 2118 w->left_col = 0;
2119 wset_total_lines (w, make_number (FRAME_MENU_BAR_LINES (f))); 2119 w->total_lines = FRAME_MENU_BAR_LINES (f);
2120 wset_total_cols (w, make_number (FRAME_TOTAL_COLS (f))); 2120 w->total_cols = FRAME_TOTAL_COLS (f);
2121 allocate_matrices_for_window_redisplay (w); 2121 allocate_matrices_for_window_redisplay (w);
2122 } 2122 }
2123#endif /* not USE_X_TOOLKIT && not USE_GTK */ 2123#endif /* not USE_X_TOOLKIT && not USE_GTK */
@@ -2140,10 +2140,10 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2140 else 2140 else
2141 w = XWINDOW (f->tool_bar_window); 2141 w = XWINDOW (f->tool_bar_window);
2142 2142
2143 wset_top_line (w, make_number (FRAME_MENU_BAR_LINES (f))); 2143 w->top_line = FRAME_MENU_BAR_LINES (f);
2144 wset_left_col (w, make_number (0)); 2144 w->left_col = 0;
2145 wset_total_lines (w, make_number (FRAME_TOOL_BAR_LINES (f))); 2145 w->total_lines = FRAME_TOOL_BAR_LINES (f);
2146 wset_total_cols (w, make_number (FRAME_TOTAL_COLS (f))); 2146 w->total_cols = FRAME_TOTAL_COLS (f);
2147 allocate_matrices_for_window_redisplay (w); 2147 allocate_matrices_for_window_redisplay (w);
2148 } 2148 }
2149#endif 2149#endif
@@ -5583,7 +5583,7 @@ change_frame_size_1 (struct frame *f, int newheight, int newwidth,
5583 FrameCols (FRAME_TTY (f)) = newwidth; 5583 FrameCols (FRAME_TTY (f)) = newwidth;
5584 5584
5585 if (WINDOWP (f->tool_bar_window)) 5585 if (WINDOWP (f->tool_bar_window))
5586 wset_total_cols (XWINDOW (f->tool_bar_window), make_number (newwidth)); 5586 XWINDOW (f->tool_bar_window)->total_cols = newwidth;
5587 } 5587 }
5588 5588
5589 FRAME_LINES (f) = newheight; 5589 FRAME_LINES (f) = newheight;
diff --git a/src/font.c b/src/font.c
index db7bf352c94..ba98d19afa0 100644
--- a/src/font.c
+++ b/src/font.c
@@ -287,7 +287,7 @@ font_pixel_size (FRAME_PTR f, Lisp_Object spec)
287 if (INTEGERP (val)) 287 if (INTEGERP (val))
288 dpi = XINT (val); 288 dpi = XINT (val);
289 else 289 else
290 dpi = f->resy; 290 dpi = FRAME_RES_Y (f);
291 pixel_size = POINT_TO_PIXEL (point_size, dpi); 291 pixel_size = POINT_TO_PIXEL (point_size, dpi);
292 return pixel_size; 292 return pixel_size;
293#else 293#else
@@ -3117,7 +3117,7 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
3117 { 3117 {
3118 double pt = XINT (attrs[LFACE_HEIGHT_INDEX]); 3118 double pt = XINT (attrs[LFACE_HEIGHT_INDEX]);
3119 3119
3120 pixel_size = POINT_TO_PIXEL (pt / 10, f->resy); 3120 pixel_size = POINT_TO_PIXEL (pt / 10, FRAME_RES_Y (f));
3121 } 3121 }
3122 ASET (work, FONT_SIZE_INDEX, Qnil); 3122 ASET (work, FONT_SIZE_INDEX, Qnil);
3123 foundry[0] = AREF (work, FONT_FOUNDRY_INDEX); 3123 foundry[0] = AREF (work, FONT_FOUNDRY_INDEX);
@@ -3247,12 +3247,13 @@ font_open_for_lface (FRAME_PTR f, Lisp_Object entity, Lisp_Object *attrs, Lisp_O
3247 } 3247 }
3248 3248
3249 pt /= 10; 3249 pt /= 10;
3250 size = POINT_TO_PIXEL (pt, f->resy); 3250 size = POINT_TO_PIXEL (pt, FRAME_RES_Y (f));
3251#ifdef HAVE_NS 3251#ifdef HAVE_NS
3252 if (size == 0) 3252 if (size == 0)
3253 { 3253 {
3254 Lisp_Object ffsize = get_frame_param (f, Qfontsize); 3254 Lisp_Object ffsize = get_frame_param (f, Qfontsize);
3255 size = NUMBERP (ffsize) ? POINT_TO_PIXEL (XINT (ffsize), f->resy) : 0; 3255 size = (NUMBERP (ffsize)
3256 ? POINT_TO_PIXEL (XINT (ffsize), FRAME_RES_Y (f)) : 0);
3256 } 3257 }
3257#endif 3258#endif
3258 } 3259 }
@@ -4021,7 +4022,7 @@ are to be displayed on. If omitted, the selected frame is used. */)
4021 if (INTEGERP (val)) 4022 if (INTEGERP (val))
4022 { 4023 {
4023 Lisp_Object font_dpi = AREF (font, FONT_DPI_INDEX); 4024 Lisp_Object font_dpi = AREF (font, FONT_DPI_INDEX);
4024 int dpi = INTEGERP (font_dpi) ? XINT (font_dpi) : f->resy; 4025 int dpi = INTEGERP (font_dpi) ? XINT (font_dpi) : FRAME_RES_Y (f);
4025 plist[n++] = QCheight; 4026 plist[n++] = QCheight;
4026 plist[n++] = make_number (PIXEL_TO_POINT (XINT (val) * 10, dpi)); 4027 plist[n++] = make_number (PIXEL_TO_POINT (XINT (val) * 10, dpi));
4027 } 4028 }
@@ -4532,7 +4533,7 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,
4532 { 4533 {
4533 CHECK_NUMBER_OR_FLOAT (size); 4534 CHECK_NUMBER_OR_FLOAT (size);
4534 if (FLOATP (size)) 4535 if (FLOATP (size))
4535 isize = POINT_TO_PIXEL (XFLOAT_DATA (size), f->resy); 4536 isize = POINT_TO_PIXEL (XFLOAT_DATA (size), FRAME_RES_Y (f));
4536 else 4537 else
4537 isize = XINT (size); 4538 isize = XINT (size);
4538 if (! (INT_MIN <= isize && isize <= INT_MAX)) 4539 if (! (INT_MIN <= isize && isize <= INT_MAX))
diff --git a/src/frame.c b/src/frame.c
index 0fa821682f3..2ed2c5a2771 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -155,8 +155,8 @@ set_menu_bar_lines_1 (Lisp_Object window, int n)
155 struct window *w = XWINDOW (window); 155 struct window *w = XWINDOW (window);
156 156
157 w->last_modified = 0; 157 w->last_modified = 0;
158 wset_top_line (w, make_number (XFASTINT (w->top_line) + n)); 158 w->top_line += n;
159 wset_total_lines (w, make_number (XFASTINT (w->total_lines) - n)); 159 w->total_lines -= n;
160 160
161 /* Handle just the top child in a vertical split. */ 161 /* Handle just the top child in a vertical split. */
162 if (!NILP (w->vchild)) 162 if (!NILP (w->vchild))
@@ -332,14 +332,14 @@ make_frame (int mini_p)
332 SET_FRAME_COLS (f, 10); 332 SET_FRAME_COLS (f, 10);
333 FRAME_LINES (f) = 10; 333 FRAME_LINES (f) = 10;
334 334
335 wset_total_cols (XWINDOW (root_window), make_number (10)); 335 XWINDOW (root_window)->total_cols = 10;
336 wset_total_lines (XWINDOW (root_window), make_number (mini_p ? 9 : 10)); 336 XWINDOW (root_window)->total_lines = mini_p ? 9 : 10;
337 337
338 if (mini_p) 338 if (mini_p)
339 { 339 {
340 wset_total_cols (XWINDOW (mini_window), make_number (10)); 340 XWINDOW (mini_window)->total_cols = 10;
341 wset_top_line (XWINDOW (mini_window), make_number (9)); 341 XWINDOW (mini_window)->top_line = 9;
342 wset_total_lines (XWINDOW (mini_window), make_number (1)); 342 XWINDOW (mini_window)->total_lines = 1;
343 } 343 }
344 344
345 /* Choose a buffer for the frame's root window. */ 345 /* Choose a buffer for the frame's root window. */
diff --git a/src/frame.h b/src/frame.h
index c18b7662079..7a4943327eb 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -276,9 +276,6 @@ struct frame
276 /* Size of the frame window in pixels. */ 276 /* Size of the frame window in pixels. */
277 int pixel_height, pixel_width; 277 int pixel_height, pixel_width;
278 278
279 /* Dots per inch of the screen the frame is on. */
280 double resx, resy;
281
282 /* These many pixels are the difference between the outer window (i.e. the 279 /* These many pixels are the difference between the outer window (i.e. the
283 left and top of the window manager decoration) and FRAME_X_WINDOW. */ 280 left and top of the window manager decoration) and FRAME_X_WINDOW. */
284 int x_pixels_diff, y_pixels_diff; 281 int x_pixels_diff, y_pixels_diff;
@@ -569,6 +566,26 @@ fset_tool_bar_window (struct frame *f, Lisp_Object val)
569 f->tool_bar_window = val; 566 f->tool_bar_window = val;
570} 567}
571 568
569#define NUMVAL(X) ((INTEGERP (X) || FLOATP (X)) ? XFLOATINT (X) : -1)
570
571FRAME_INLINE double
572default_pixels_per_inch_x (void)
573{
574 Lisp_Object v = (CONSP (Vdisplay_pixels_per_inch)
575 ? XCAR (Vdisplay_pixels_per_inch)
576 : Vdisplay_pixels_per_inch);
577 return NUMVAL (v) > 0 ? NUMVAL (v) : 72.0;
578}
579
580FRAME_INLINE double
581default_pixels_per_inch_y (void)
582{
583 Lisp_Object v = (CONSP (Vdisplay_pixels_per_inch)
584 ? XCDR (Vdisplay_pixels_per_inch)
585 : Vdisplay_pixels_per_inch);
586 return NUMVAL (v) > 0 ? NUMVAL (v) : 72.0;
587}
588
572#define FRAME_KBOARD(f) ((f)->terminal->kboard) 589#define FRAME_KBOARD(f) ((f)->terminal->kboard)
573 590
574/* Return a pointer to the image cache of frame F. */ 591/* Return a pointer to the image cache of frame F. */
@@ -602,6 +619,37 @@ typedef struct frame *FRAME_PTR;
602#else 619#else
603#define FRAME_NS_P(f) ((f)->output_method == output_ns) 620#define FRAME_NS_P(f) ((f)->output_method == output_ns)
604#endif 621#endif
622
623/* Dots per inch of the screen the frame F is on. */
624
625#ifdef HAVE_X_WINDOWS
626#define FRAME_RES_X(f) \
627 (eassert (FRAME_X_P (f)), FRAME_X_DISPLAY_INFO (f)->resx)
628#define FRAME_RES_Y(f) \
629 (eassert (FRAME_X_P (f)), FRAME_X_DISPLAY_INFO (f)->resy)
630#endif
631
632#ifdef HAVE_NTGUI
633#define FRAME_RES_X(f) \
634 (eassert (FRAME_W32_P (f)), FRAME_W32_DISPLAY_INFO (f)->resx)
635#define FRAME_RES_Y(f) \
636 (eassert (FRAME_W32_P (f)), FRAME_W32_DISPLAY_INFO (f)->resy)
637#endif
638
639#ifdef HAVE_NS
640#define FRAME_RES_X(f) \
641 (eassert (FRAME_NS_P (f)), FRAME_NS_DISPLAY_INFO (f)->resx)
642#define FRAME_RES_Y(f) \
643 (eassert (FRAME_NS_P (f)), FRAME_NS_DISPLAY_INFO (f)->resy)
644#endif
645
646/* Defaults when no window system available. */
647
648#ifndef FRAME_RES_X
649#define FRAME_RES_X(f) default_pixels_per_inch_x ()
650#define FRAME_RES_Y(f) default_pixels_per_inch_y ()
651#endif
652
605/* FRAME_WINDOW_P tests whether the frame is a window, and is 653/* FRAME_WINDOW_P tests whether the frame is a window, and is
606 defined to be the predicate for the window system being used. */ 654 defined to be the predicate for the window system being used. */
607 655
diff --git a/src/image.c b/src/image.c
index 2c0f6e3b8c1..3eec8b6c13d 100644
--- a/src/image.c
+++ b/src/image.c
@@ -8554,10 +8554,10 @@ gs_load (struct frame *f, struct image *img)
8554 info. */ 8554 info. */
8555 pt_width = image_spec_value (img->spec, QCpt_width, NULL); 8555 pt_width = image_spec_value (img->spec, QCpt_width, NULL);
8556 in_width = INTEGERP (pt_width) ? XFASTINT (pt_width) / 72.0 : 0; 8556 in_width = INTEGERP (pt_width) ? XFASTINT (pt_width) / 72.0 : 0;
8557 in_width *= FRAME_X_DISPLAY_INFO (f)->resx; 8557 in_width *= FRAME_RES_X (f);
8558 pt_height = image_spec_value (img->spec, QCpt_height, NULL); 8558 pt_height = image_spec_value (img->spec, QCpt_height, NULL);
8559 in_height = INTEGERP (pt_height) ? XFASTINT (pt_height) / 72.0 : 0; 8559 in_height = INTEGERP (pt_height) ? XFASTINT (pt_height) / 72.0 : 0;
8560 in_height *= FRAME_X_DISPLAY_INFO (f)->resy; 8560 in_height *= FRAME_RES_Y (f);
8561 8561
8562 if (! (in_width <= INT_MAX && in_height <= INT_MAX 8562 if (! (in_width <= INT_MAX && in_height <= INT_MAX
8563 && check_image_size (f, in_width, in_height))) 8563 && check_image_size (f, in_width, in_height)))
diff --git a/src/nsfns.m b/src/nsfns.m
index ef18acaa045..9c3051a8c6a 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1243,9 +1243,6 @@ This function is an internal primitive--use `make-frame' instead. */)
1243 specbind (Qx_resource_name, name); 1243 specbind (Qx_resource_name, name);
1244 } 1244 }
1245 1245
1246 f->resx = dpyinfo->resx;
1247 f->resy = dpyinfo->resy;
1248
1249 block_input (); 1246 block_input ();
1250 register_font_driver (&nsfont_driver, f); 1247 register_font_driver (&nsfont_driver, f);
1251 x_default_parameter (f, parms, Qfont_backend, Qnil, 1248 x_default_parameter (f, parms, Qfont_backend, Qnil,
diff --git a/src/w32fns.c b/src/w32fns.c
index cef2009d7a1..4c47465e67b 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4353,9 +4353,6 @@ This function is an internal primitive--use `make-frame' instead. */)
4353 specbind (Qx_resource_name, name); 4353 specbind (Qx_resource_name, name);
4354 } 4354 }
4355 4355
4356 f->resx = dpyinfo->resx;
4357 f->resy = dpyinfo->resy;
4358
4359 if (uniscribe_available) 4356 if (uniscribe_available)
4360 register_font_driver (&uniscribe_font_driver, f); 4357 register_font_driver (&uniscribe_font_driver, f);
4361 register_font_driver (&w32font_driver, f); 4358 register_font_driver (&w32font_driver, f);
@@ -5420,9 +5417,6 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5420 specbind (Qx_resource_name, name); 5417 specbind (Qx_resource_name, name);
5421 } 5418 }
5422 5419
5423 f->resx = dpyinfo->resx;
5424 f->resy = dpyinfo->resy;
5425
5426 if (uniscribe_available) 5420 if (uniscribe_available)
5427 register_font_driver (&uniscribe_font_driver, f); 5421 register_font_driver (&uniscribe_font_driver, f);
5428 register_font_driver (&w32font_driver, f); 5422 register_font_driver (&w32font_driver, f);
@@ -5780,8 +5774,8 @@ Text larger than the specified size is clipped. */)
5780 5774
5781 /* Set up the frame's root window. */ 5775 /* Set up the frame's root window. */
5782 w = XWINDOW (FRAME_ROOT_WINDOW (f)); 5776 w = XWINDOW (FRAME_ROOT_WINDOW (f));
5783 wset_left_col (w, make_number (0)); 5777 w->left_col = 0;
5784 wset_top_line (w, make_number (0)); 5778 w->top_line = 0;
5785 5779
5786 if (CONSP (Vx_max_tooltip_size) 5780 if (CONSP (Vx_max_tooltip_size)
5787 && INTEGERP (XCAR (Vx_max_tooltip_size)) 5781 && INTEGERP (XCAR (Vx_max_tooltip_size))
@@ -5789,13 +5783,13 @@ Text larger than the specified size is clipped. */)
5789 && INTEGERP (XCDR (Vx_max_tooltip_size)) 5783 && INTEGERP (XCDR (Vx_max_tooltip_size))
5790 && XINT (XCDR (Vx_max_tooltip_size)) > 0) 5784 && XINT (XCDR (Vx_max_tooltip_size)) > 0)
5791 { 5785 {
5792 wset_total_cols (w, XCAR (Vx_max_tooltip_size)); 5786 w->total_cols = XFASTINT (XCAR (Vx_max_tooltip_size));
5793 wset_total_lines (w, XCDR (Vx_max_tooltip_size)); 5787 w->total_lines = XFASTINT (XCDR (Vx_max_tooltip_size));
5794 } 5788 }
5795 else 5789 else
5796 { 5790 {
5797 wset_total_cols (w, make_number (80)); 5791 w->total_cols = 80;
5798 wset_total_lines (w, make_number (40)); 5792 w->total_lines = 40;
5799 } 5793 }
5800 5794
5801 FRAME_TOTAL_COLS (f) = XINT (w->total_cols); 5795 FRAME_TOTAL_COLS (f) = XINT (w->total_cols);
@@ -5866,7 +5860,7 @@ Text larger than the specified size is clipped. */)
5866 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, 5860 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
5867 not in pixels. */ 5861 not in pixels. */
5868 width /= WINDOW_FRAME_COLUMN_WIDTH (w); 5862 width /= WINDOW_FRAME_COLUMN_WIDTH (w);
5869 wset_total_cols (w, make_number (width)); 5863 w->total_cols = width;
5870 FRAME_TOTAL_COLS (f) = width; 5864 FRAME_TOTAL_COLS (f) = width;
5871 adjust_glyphs (f); 5865 adjust_glyphs (f);
5872 w->pseudo_window_p = 1; 5866 w->pseudo_window_p = 1;
diff --git a/src/w32font.c b/src/w32font.c
index 5c5a15cc340..fb52376b9e1 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -1967,7 +1967,7 @@ static void
1967fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec) 1967fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec)
1968{ 1968{
1969 Lisp_Object tmp, extra; 1969 Lisp_Object tmp, extra;
1970 int dpi = FRAME_W32_DISPLAY_INFO (f)->resy; 1970 int dpi = FRAME_RES_Y (f);
1971 1971
1972 tmp = AREF (font_spec, FONT_DPI_INDEX); 1972 tmp = AREF (font_spec, FONT_DPI_INDEX);
1973 if (INTEGERP (tmp)) 1973 if (INTEGERP (tmp))
diff --git a/src/window.c b/src/window.c
index 5dc908f0a4d..875d7770277 100644
--- a/src/window.c
+++ b/src/window.c
@@ -692,7 +692,7 @@ On a graphical display, this total height is reported as an
692integer multiple of the default character height. */) 692integer multiple of the default character height. */)
693 (Lisp_Object window) 693 (Lisp_Object window)
694{ 694{
695 return decode_valid_window (window)->total_lines; 695 return make_number (decode_valid_window (window)->total_lines);
696} 696}
697 697
698DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, 698DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0,
@@ -707,7 +707,7 @@ On a graphical display, this total width is reported as an
707integer multiple of the default character width. */) 707integer multiple of the default character width. */)
708 (Lisp_Object window) 708 (Lisp_Object window)
709{ 709{
710 return decode_valid_window (window)->total_cols; 710 return make_number (decode_valid_window (window)->total_cols);
711} 711}
712 712
713DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, 713DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
@@ -746,7 +746,7 @@ value is 0 if there is no window to the left of WINDOW.
746WINDOW must be a valid window and defaults to the selected one. */) 746WINDOW must be a valid window and defaults to the selected one. */)
747 (Lisp_Object window) 747 (Lisp_Object window)
748{ 748{
749 return decode_valid_window (window)->left_col; 749 return make_number (decode_valid_window (window)->left_col);
750} 750}
751 751
752DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, 752DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0,
@@ -758,7 +758,7 @@ there is no window above WINDOW.
758WINDOW must be a valid window and defaults to the selected one. */) 758WINDOW must be a valid window and defaults to the selected one. */)
759 (Lisp_Object window) 759 (Lisp_Object window)
760{ 760{
761 return decode_valid_window (window)->top_line; 761 return make_number (decode_valid_window (window)->top_line);
762} 762}
763 763
764/* Return the number of lines of W's body. Don't count any mode or 764/* Return the number of lines of W's body. Don't count any mode or
@@ -767,7 +767,7 @@ WINDOW must be a valid window and defaults to the selected one. */)
767static int 767static int
768window_body_lines (struct window *w) 768window_body_lines (struct window *w)
769{ 769{
770 int height = XFASTINT (w->total_lines); 770 int height = w->total_lines;
771 771
772 if (!MINI_WINDOW_P (w)) 772 if (!MINI_WINDOW_P (w))
773 { 773 {
@@ -789,7 +789,7 @@ int
789window_body_cols (struct window *w) 789window_body_cols (struct window *w)
790{ 790{
791 struct frame *f = XFRAME (WINDOW_FRAME (w)); 791 struct frame *f = XFRAME (WINDOW_FRAME (w));
792 int width = XINT (w->total_cols); 792 int width = w->total_cols;
793 793
794 if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) 794 if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
795 /* Scroll bars occupy a few columns. */ 795 /* Scroll bars occupy a few columns. */
@@ -2007,12 +2007,12 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
2007 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) 2007 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame))))
2008 fset_root_window (XFRAME (o->frame), new); 2008 fset_root_window (XFRAME (o->frame), new);
2009 2009
2010 if (setflag) 2010 if (setflag)
2011 { 2011 {
2012 wset_left_col (n, o->left_col); 2012 n->left_col = o->left_col;
2013 wset_top_line (n, o->top_line); 2013 n->top_line = o->top_line;
2014 wset_total_cols (n, o->total_cols); 2014 n->total_cols = o->total_cols;
2015 wset_total_lines (n, o->total_lines); 2015 n->total_lines = o->total_lines;
2016 wset_normal_cols (n, o->normal_cols); 2016 wset_normal_cols (n, o->normal_cols);
2017 wset_normal_cols (o, make_float (1.0)); 2017 wset_normal_cols (o, make_float (1.0));
2018 wset_normal_lines (n, o->normal_lines); 2018 wset_normal_lines (n, o->normal_lines);
@@ -2097,12 +2097,12 @@ recombine_windows (Lisp_Object window)
2097 2097
2098 if (horflag) 2098 if (horflag)
2099 wset_normal_cols (c, 2099 wset_normal_cols (c,
2100 make_float (XFLOATINT (c->total_cols) 2100 make_float ((double) c->total_cols
2101 / XFLOATINT (p->total_cols))); 2101 / (double) p->total_cols));
2102 else 2102 else
2103 wset_normal_lines (c, 2103 wset_normal_lines (c,
2104 make_float (XFLOATINT (c->total_lines) 2104 make_float ((double) c->total_lines
2105 / XFLOATINT (p->total_lines))); 2105 / (double) p->total_lines));
2106 2106
2107 if (NILP (c->next)) 2107 if (NILP (c->next))
2108 { 2108 {
@@ -2861,9 +2861,8 @@ window-start value is reasonable when this function is called. */)
2861 if (NILP (w->buffer)) 2861 if (NILP (w->buffer))
2862 { 2862 {
2863 /* Resize child windows vertically. */ 2863 /* Resize child windows vertically. */
2864 XSETINT (delta, XINT (r->total_lines) 2864 XSETINT (delta, r->total_lines - w->total_lines);
2865 - XINT (w->total_lines)); 2865 w->top_line = r->top_line;
2866 wset_top_line (w, r->top_line);
2867 resize_root_window (window, delta, Qnil, Qnil); 2866 resize_root_window (window, delta, Qnil, Qnil);
2868 if (window_resize_check (w, 0)) 2867 if (window_resize_check (w, 0))
2869 window_resize_apply (w, 0); 2868 window_resize_apply (w, 0);
@@ -2879,10 +2878,8 @@ window-start value is reasonable when this function is called. */)
2879 /* Resize child windows horizontally. */ 2878 /* Resize child windows horizontally. */
2880 if (!resize_failed) 2879 if (!resize_failed)
2881 { 2880 {
2882 wset_left_col (w, r->left_col); 2881 w->left_col = r->left_col;
2883 XSETINT (delta, 2882 XSETINT (delta, r->total_cols - w->total_cols);
2884 XINT (r->total_cols) - XINT (w->total_cols));
2885 wset_left_col (w, r->left_col);
2886 resize_root_window (window, delta, Qt, Qnil); 2883 resize_root_window (window, delta, Qt, Qnil);
2887 if (window_resize_check (w, 1)) 2884 if (window_resize_check (w, 1))
2888 window_resize_apply (w, 1); 2885 window_resize_apply (w, 1);
@@ -3453,10 +3450,6 @@ make_window (void)
3453 w = allocate_window (); 3450 w = allocate_window ();
3454 /* Initialize Lisp data. Note that allocate_window initializes all 3451 /* Initialize Lisp data. Note that allocate_window initializes all
3455 Lisp data to nil, so do it only for slots which should not be nil. */ 3452 Lisp data to nil, so do it only for slots which should not be nil. */
3456 wset_left_col (w, make_number (0));
3457 wset_top_line (w, make_number (0));
3458 wset_total_lines (w, make_number (0));
3459 wset_total_cols (w, make_number (0));
3460 wset_normal_lines (w, make_float (1.0)); 3453 wset_normal_lines (w, make_float (1.0));
3461 wset_normal_cols (w, make_float (1.0)); 3454 wset_normal_cols (w, make_float (1.0));
3462 wset_new_total (w, make_number (0)); 3455 wset_new_total (w, make_number (0));
@@ -3617,19 +3610,19 @@ window_resize_apply (struct window *w, bool horflag)
3617 parent window has been set *before*. */ 3610 parent window has been set *before*. */
3618 if (horflag) 3611 if (horflag)
3619 { 3612 {
3620 wset_total_cols (w, w->new_total); 3613 w->total_cols = XFASTINT (w->new_total);
3621 if (NUMBERP (w->new_normal)) 3614 if (NUMBERP (w->new_normal))
3622 wset_normal_cols (w, w->new_normal); 3615 wset_normal_cols (w, w->new_normal);
3623 3616
3624 pos = XINT (w->left_col); 3617 pos = w->left_col;
3625 } 3618 }
3626 else 3619 else
3627 { 3620 {
3628 wset_total_lines (w, w->new_total); 3621 w->total_lines = XFASTINT (w->new_total);
3629 if (NUMBERP (w->new_normal)) 3622 if (NUMBERP (w->new_normal))
3630 wset_normal_lines (w, w->new_normal); 3623 wset_normal_lines (w, w->new_normal);
3631 3624
3632 pos = XINT (w->top_line); 3625 pos = w->top_line;
3633 } 3626 }
3634 3627
3635 if (!NILP (w->vchild)) 3628 if (!NILP (w->vchild))
@@ -3639,12 +3632,12 @@ window_resize_apply (struct window *w, bool horflag)
3639 while (c) 3632 while (c)
3640 { 3633 {
3641 if (horflag) 3634 if (horflag)
3642 wset_left_col (c, make_number (pos)); 3635 c->left_col = pos;
3643 else 3636 else
3644 wset_top_line (c, make_number (pos)); 3637 c->top_line = pos;
3645 window_resize_apply (c, horflag); 3638 window_resize_apply (c, horflag);
3646 if (!horflag) 3639 if (!horflag)
3647 pos = pos + XINT (c->total_lines); 3640 pos = pos + c->total_lines;
3648 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3641 c = NILP (c->next) ? 0 : XWINDOW (c->next);
3649 } 3642 }
3650 } 3643 }
@@ -3655,12 +3648,12 @@ window_resize_apply (struct window *w, bool horflag)
3655 while (c) 3648 while (c)
3656 { 3649 {
3657 if (horflag) 3650 if (horflag)
3658 wset_left_col (c, make_number (pos)); 3651 c->left_col = pos;
3659 else 3652 else
3660 wset_top_line (c, make_number (pos)); 3653 c->top_line = pos;
3661 window_resize_apply (c, horflag); 3654 window_resize_apply (c, horflag);
3662 if (horflag) 3655 if (horflag)
3663 pos = pos + XINT (c->total_cols); 3656 pos = pos + c->total_cols;
3664 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3657 c = NILP (c->next) ? 0 : XWINDOW (c->next);
3665 } 3658 }
3666 } 3659 }
@@ -3692,8 +3685,8 @@ be applied on the Elisp level. */)
3692 bool horflag = !NILP (horizontal); 3685 bool horflag = !NILP (horizontal);
3693 3686
3694 if (!window_resize_check (r, horflag) 3687 if (!window_resize_check (r, horflag)
3695 || ! EQ (r->new_total, 3688 || (XINT (r->new_total)
3696 (horflag ? r->total_cols : r->total_lines))) 3689 != (horflag ? r->total_cols : r->total_lines)))
3697 return Qnil; 3690 return Qnil;
3698 3691
3699 block_input (); 3692 block_input ();
@@ -3733,18 +3726,17 @@ resize_frame_windows (struct frame *f, int size, bool horflag)
3733 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) 3726 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f))
3734 ? 1 : 0))); 3727 ? 1 : 0)));
3735 3728
3736 wset_top_line (r, make_number (FRAME_TOP_MARGIN (f))); 3729 r->top_line = FRAME_TOP_MARGIN (f);
3737 if (NILP (r->vchild) && NILP (r->hchild)) 3730 if (NILP (r->vchild) && NILP (r->hchild))
3738 /* For a leaf root window just set the size. */ 3731 /* For a leaf root window just set the size. */
3739 if (horflag) 3732 if (horflag)
3740 wset_total_cols (r, make_number (new_size)); 3733 r->total_cols = new_size;
3741 else 3734 else
3742 wset_total_lines (r, make_number (new_size)); 3735 r->total_lines = new_size;
3743 else 3736 else
3744 { 3737 {
3745 /* old_size is the old size of the frame's root window. */ 3738 /* old_size is the old size of the frame's root window. */
3746 int old_size = XFASTINT (horflag ? r->total_cols 3739 int old_size = horflag ? r->total_cols : r->total_lines;
3747 : r->total_lines);
3748 Lisp_Object delta; 3740 Lisp_Object delta;
3749 3741
3750 XSETINT (delta, new_size - old_size); 3742 XSETINT (delta, new_size - old_size);
@@ -3774,9 +3766,9 @@ resize_frame_windows (struct frame *f, int size, bool horflag)
3774 root = f->selected_window; 3766 root = f->selected_window;
3775 Fdelete_other_windows_internal (root, Qnil); 3767 Fdelete_other_windows_internal (root, Qnil);
3776 if (horflag) 3768 if (horflag)
3777 wset_total_cols (XWINDOW (root), make_number (new_size)); 3769 XWINDOW (root)->total_cols = new_size;
3778 else 3770 else
3779 wset_total_lines (XWINDOW (root), make_number (new_size)); 3771 XWINDOW (root)->total_lines = new_size;
3780 } 3772 }
3781 } 3773 }
3782 } 3774 }
@@ -3786,13 +3778,12 @@ resize_frame_windows (struct frame *f, int size, bool horflag)
3786 { 3778 {
3787 m = XWINDOW (mini); 3779 m = XWINDOW (mini);
3788 if (horflag) 3780 if (horflag)
3789 wset_total_cols (m, make_number (size)); 3781 m->total_cols = size;
3790 else 3782 else
3791 { 3783 {
3792 /* Are we sure we always want 1 line here? */ 3784 /* Are we sure we always want 1 line here? */
3793 wset_total_lines (m, make_number (1)); 3785 m->total_lines = 1;
3794 wset_top_line 3786 m->top_line = r->top_line + r->total_lines;
3795 (m, make_number (XINT (r->top_line) + XINT (r->total_lines)));
3796 } 3787 }
3797 } 3788 }
3798 3789
@@ -3876,20 +3867,21 @@ set correctly. See the code of `split-window' for how this is done. */)
3876 p = XWINDOW (o->parent); 3867 p = XWINDOW (o->parent);
3877 /* Temporarily pretend we split the parent window. */ 3868 /* Temporarily pretend we split the parent window. */
3878 wset_new_total 3869 wset_new_total
3879 (p, make_number (XINT (horflag ? p->total_cols : p->total_lines) 3870 (p, make_number ((horflag ? p->total_cols : p->total_lines)
3880 - XINT (total_size))); 3871 - XINT (total_size)));
3881 if (!window_resize_check (p, horflag)) 3872 if (!window_resize_check (p, horflag))
3882 error ("Window sizes don't fit"); 3873 error ("Window sizes don't fit");
3883 else 3874 else
3884 /* Undo the temporary pretension. */ 3875 /* Undo the temporary pretension. */
3885 wset_new_total (p, horflag ? p->total_cols : p->total_lines); 3876 wset_new_total (p, make_number
3877 (horflag ? p->total_cols : p->total_lines));
3886 } 3878 }
3887 else 3879 else
3888 { 3880 {
3889 if (!window_resize_check (o, horflag)) 3881 if (!window_resize_check (o, horflag))
3890 error ("Resizing old window failed"); 3882 error ("Resizing old window failed");
3891 else if (XINT (total_size) + XINT (o->new_total) 3883 else if (XINT (total_size) + XINT (o->new_total)
3892 != XINT (horflag ? o->total_cols : o->total_lines)) 3884 != (horflag ? o->total_cols : o->total_lines))
3893 error ("Sum of sizes of old and new window don't fit"); 3885 error ("Sum of sizes of old and new window don't fit");
3894 } 3886 }
3895 3887
@@ -3909,7 +3901,8 @@ set correctly. See the code of `split-window' for how this is done. */)
3909 that its children get merged into another window. */ 3901 that its children get merged into another window. */
3910 wset_combination_limit (p, Qt); 3902 wset_combination_limit (p, Qt);
3911 /* These get applied below. */ 3903 /* These get applied below. */
3912 wset_new_total (p, horflag ? o->total_cols : o->total_lines); 3904 wset_new_total (p, make_number
3905 (horflag ? o->total_cols : o->total_lines));
3913 wset_new_normal (p, new_normal); 3906 wset_new_normal (p, new_normal);
3914 } 3907 }
3915 else 3908 else
@@ -3961,13 +3954,13 @@ set correctly. See the code of `split-window' for how this is done. */)
3961 /* Directly assign orthogonal coordinates and sizes. */ 3954 /* Directly assign orthogonal coordinates and sizes. */
3962 if (horflag) 3955 if (horflag)
3963 { 3956 {
3964 wset_top_line (n, o->top_line); 3957 n->top_line = o->top_line;
3965 wset_total_lines (n, o->total_lines); 3958 n->total_lines = o->total_lines;
3966 } 3959 }
3967 else 3960 else
3968 { 3961 {
3969 wset_left_col (n, o->left_col); 3962 n->left_col = o->left_col;
3970 wset_total_cols (n, o->total_cols); 3963 n->total_cols = o->total_cols;
3971 } 3964 }
3972 3965
3973 /* Iso-coordinates and sizes are assigned by window_resize_apply, 3966 /* Iso-coordinates and sizes are assigned by window_resize_apply,
@@ -4056,8 +4049,8 @@ Signal an error when WINDOW is the only window on its frame. */)
4056 } 4049 }
4057 4050
4058 if (window_resize_check (r, horflag) 4051 if (window_resize_check (r, horflag)
4059 && EQ (r->new_total, 4052 && (XINT (r->new_total)
4060 (horflag ? r->total_cols : r->total_lines))) 4053 == (horflag ? r->total_cols : r->total_lines)))
4061 /* We can delete WINDOW now. */ 4054 /* We can delete WINDOW now. */
4062 { 4055 {
4063 4056
@@ -4203,10 +4196,8 @@ grow_mini_window (struct window *w, int delta)
4203 window_resize_apply (r, 0); 4196 window_resize_apply (r, 0);
4204 4197
4205 /* Grow the mini-window. */ 4198 /* Grow the mini-window. */
4206 wset_top_line 4199 w->top_line = r->top_line + r->total_lines;
4207 (w, make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines))); 4200 w->total_lines -= XINT (value);
4208 wset_total_lines
4209 (w, make_number (XFASTINT (w->total_lines) - XINT (value)));
4210 w->last_modified = 0; 4201 w->last_modified = 0;
4211 w->last_overlay_modified = 0; 4202 w->last_overlay_modified = 0;
4212 4203
@@ -4228,7 +4219,7 @@ shrink_mini_window (struct window *w)
4228 4219
4229 eassert (MINI_WINDOW_P (w)); 4220 eassert (MINI_WINDOW_P (w));
4230 4221
4231 size = XINT (w->total_lines); 4222 size = w->total_lines;
4232 if (size > 1) 4223 if (size > 1)
4233 { 4224 {
4234 root = FRAME_ROOT_WINDOW (f); 4225 root = FRAME_ROOT_WINDOW (f);
@@ -4241,9 +4232,8 @@ shrink_mini_window (struct window *w)
4241 window_resize_apply (r, 0); 4232 window_resize_apply (r, 0);
4242 4233
4243 /* Shrink the mini-window. */ 4234 /* Shrink the mini-window. */
4244 wset_top_line (w, make_number (XFASTINT (r->top_line) 4235 w->top_line = r->top_line + r->total_lines;
4245 + XFASTINT (r->total_lines))); 4236 w->total_lines = 1;
4246 wset_total_lines (w, make_number (1));
4247 4237
4248 w->last_modified = 0; 4238 w->last_modified = 0;
4249 w->last_overlay_modified = 0; 4239 w->last_overlay_modified = 0;
@@ -4277,7 +4267,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4277 error ("Cannot resize a minibuffer-only frame"); 4267 error ("Cannot resize a minibuffer-only frame");
4278 4268
4279 r = XWINDOW (FRAME_ROOT_WINDOW (f)); 4269 r = XWINDOW (FRAME_ROOT_WINDOW (f));
4280 height = XINT (r->total_lines) + XINT (w->total_lines); 4270 height = r->total_lines + w->total_lines;
4281 if (window_resize_check (r, 0) 4271 if (window_resize_check (r, 0)
4282 && XINT (w->new_total) > 0 4272 && XINT (w->new_total) > 0
4283 && height == XINT (r->new_total) + XINT (w->new_total)) 4273 && height == XINT (r->new_total) + XINT (w->new_total))
@@ -4285,9 +4275,8 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4285 block_input (); 4275 block_input ();
4286 window_resize_apply (r, 0); 4276 window_resize_apply (r, 0);
4287 4277
4288 wset_total_lines (w, w->new_total); 4278 w->total_lines = XFASTINT (w->new_total);
4289 wset_top_line (w, make_number (XINT (r->top_line) 4279 w->top_line = r->top_line + r->total_lines;
4290 + XINT (r->total_lines)));
4291 4280
4292 windows_or_buffers_changed++; 4281 windows_or_buffers_changed++;
4293 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4282 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
@@ -4327,7 +4316,7 @@ mark_window_cursors_off (struct window *w)
4327int 4316int
4328window_internal_height (struct window *w) 4317window_internal_height (struct window *w)
4329{ 4318{
4330 int ht = XFASTINT (w->total_lines); 4319 int ht = w->total_lines;
4331 4320
4332 if (!MINI_WINDOW_P (w)) 4321 if (!MINI_WINDOW_P (w))
4333 { 4322 {
@@ -4637,7 +4626,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4637 even if there is a header line. */ 4626 even if there is a header line. */
4638 this_scroll_margin = max (0, scroll_margin); 4627 this_scroll_margin = max (0, scroll_margin);
4639 this_scroll_margin 4628 this_scroll_margin
4640 = min (this_scroll_margin, XFASTINT (w->total_lines) / 4); 4629 = min (this_scroll_margin, w->total_lines / 4);
4641 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); 4630 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
4642 4631
4643 if (n > 0) 4632 if (n > 0)
@@ -4814,7 +4803,7 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
4814 { 4803 {
4815 /* Don't use a scroll margin that is negative or too large. */ 4804 /* Don't use a scroll margin that is negative or too large. */
4816 int this_scroll_margin = 4805 int this_scroll_margin =
4817 max (0, min (scroll_margin, XINT (w->total_lines) / 4)); 4806 max (0, min (scroll_margin, w->total_lines / 4));
4818 4807
4819 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); 4808 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte);
4820 w->start_at_line_beg = !NILP (bolp); 4809 w->start_at_line_beg = !NILP (bolp);
@@ -5231,7 +5220,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5231 /* Do this after making BUF current 5220 /* Do this after making BUF current
5232 in case scroll_margin is buffer-local. */ 5221 in case scroll_margin is buffer-local. */
5233 this_scroll_margin = 5222 this_scroll_margin =
5234 max (0, min (scroll_margin, XFASTINT (w->total_lines) / 4)); 5223 max (0, min (scroll_margin, w->total_lines / 4));
5235 5224
5236 /* Handle centering on a graphical frame specially. Such frames can 5225 /* Handle centering on a graphical frame specially. Such frames can
5237 have variable-height lines and centering point on the basis of 5226 have variable-height lines and centering point on the basis of
@@ -5705,7 +5694,7 @@ the return value is nil. Otherwise the value is t. */)
5705 wset_prev (w, Qnil); 5694 wset_prev (w, Qnil);
5706 if (!NILP (w->parent)) 5695 if (!NILP (w->parent))
5707 { 5696 {
5708 if (EQ (p->total_cols, XWINDOW (w->parent)->total_cols)) 5697 if (XINT (p->total_cols) == XWINDOW (w->parent)->total_cols)
5709 { 5698 {
5710 wset_vchild (XWINDOW (w->parent), p->window); 5699 wset_vchild (XWINDOW (w->parent), p->window);
5711 wset_hchild (XWINDOW (w->parent), Qnil); 5700 wset_hchild (XWINDOW (w->parent), Qnil);
@@ -5721,10 +5710,10 @@ the return value is nil. Otherwise the value is t. */)
5721 /* If we squirreled away the buffer, restore it now. */ 5710 /* If we squirreled away the buffer, restore it now. */
5722 if (BUFFERP (w->combination_limit)) 5711 if (BUFFERP (w->combination_limit))
5723 wset_buffer (w, w->combination_limit); 5712 wset_buffer (w, w->combination_limit);
5724 wset_left_col (w, p->left_col); 5713 w->left_col = XFASTINT (p->left_col);
5725 wset_top_line (w, p->top_line); 5714 w->top_line = XFASTINT (p->top_line);
5726 wset_total_cols (w, p->total_cols); 5715 w->total_cols = XFASTINT (p->total_cols);
5727 wset_total_lines (w, p->total_lines); 5716 w->total_lines = XFASTINT (p->total_lines);
5728 wset_normal_cols (w, p->normal_cols); 5717 wset_normal_cols (w, p->normal_cols);
5729 wset_normal_lines (w, p->normal_lines); 5718 wset_normal_lines (w, p->normal_lines);
5730 w->hscroll = XFASTINT (p->hscroll); 5719 w->hscroll = XFASTINT (p->hscroll);
@@ -6038,10 +6027,10 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
6038 wset_temslot (w, make_number (i)); i++; 6027 wset_temslot (w, make_number (i)); i++;
6039 p->window = window; 6028 p->window = window;
6040 p->buffer = w->buffer; 6029 p->buffer = w->buffer;
6041 p->left_col = w->left_col; 6030 p->left_col = make_number (w->left_col);
6042 p->top_line = w->top_line; 6031 p->top_line = make_number (w->top_line);
6043 p->total_cols = w->total_cols; 6032 p->total_cols = make_number (w->total_cols);
6044 p->total_lines = w->total_lines; 6033 p->total_lines = make_number (w->total_lines);
6045 p->normal_cols = w->normal_cols; 6034 p->normal_cols = w->normal_cols;
6046 p->normal_lines = w->normal_lines; 6035 p->normal_lines = w->normal_lines;
6047 XSETFASTINT (p->hscroll, w->hscroll); 6036 XSETFASTINT (p->hscroll, w->hscroll);
diff --git a/src/window.h b/src/window.h
index 4af8dbf1591..4f6374b9d3e 100644
--- a/src/window.h
+++ b/src/window.h
@@ -112,20 +112,14 @@ struct window
112 /* The window this one is a child of. */ 112 /* The window this one is a child of. */
113 Lisp_Object parent; 113 Lisp_Object parent;
114 114
115 /* The upper left corner coordinates of this window, as integers 115 /* The normal size of the window. These are fractions, but we do
116 relative to upper left corner of frame = 0, 0. */ 116 not use C doubles to avoid creating new Lisp_Float objects while
117 Lisp_Object left_col; 117 interfacing Lisp in Fwindow_normal_size. */
118 Lisp_Object top_line;
119
120 /* The size of the window. */
121 Lisp_Object total_lines;
122 Lisp_Object total_cols;
123
124 /* The normal size of the window. */
125 Lisp_Object normal_lines; 118 Lisp_Object normal_lines;
126 Lisp_Object normal_cols; 119 Lisp_Object normal_cols;
127 120
128 /* New sizes of the window. */ 121 /* New sizes of the window. Note that Lisp code may set new_normal
122 to something beyond an integer, so C int can't be used here. */
129 Lisp_Object new_total; 123 Lisp_Object new_total;
130 Lisp_Object new_normal; 124 Lisp_Object new_normal;
131 125
@@ -221,6 +215,15 @@ struct window
221 /* Number saying how recently window was selected. */ 215 /* Number saying how recently window was selected. */
222 int use_time; 216 int use_time;
223 217
218 /* The upper left corner coordinates of this window,
219 relative to upper left corner of frame = 0, 0. */
220 int left_col;
221 int top_line;
222
223 /* The size of the window. */
224 int total_lines;
225 int total_cols;
226
224 /* Number of columns display within the window is scrolled to the left. */ 227 /* Number of columns display within the window is scrolled to the left. */
225 ptrdiff_t hscroll; 228 ptrdiff_t hscroll;
226 229
@@ -354,11 +357,6 @@ wset_frame (struct window *w, Lisp_Object val)
354 w->frame = val; 357 w->frame = val;
355} 358}
356WINDOW_INLINE void 359WINDOW_INLINE void
357wset_left_col (struct window *w, Lisp_Object val)
358{
359 w->left_col = val;
360}
361WINDOW_INLINE void
362wset_next (struct window *w, Lisp_Object val) 360wset_next (struct window *w, Lisp_Object val)
363{ 361{
364 w->next = val; 362 w->next = val;
@@ -374,21 +372,6 @@ wset_redisplay_end_trigger (struct window *w, Lisp_Object val)
374 w->redisplay_end_trigger = val; 372 w->redisplay_end_trigger = val;
375} 373}
376WINDOW_INLINE void 374WINDOW_INLINE void
377wset_top_line (struct window *w, Lisp_Object val)
378{
379 w->top_line = val;
380}
381WINDOW_INLINE void
382wset_total_cols (struct window *w, Lisp_Object val)
383{
384 w->total_cols = val;
385}
386WINDOW_INLINE void
387wset_total_lines (struct window *w, Lisp_Object val)
388{
389 w->total_lines = val;
390}
391WINDOW_INLINE void
392wset_vertical_scroll_bar (struct window *w, Lisp_Object val) 375wset_vertical_scroll_bar (struct window *w, Lisp_Object val)
393{ 376{
394 w->vertical_scroll_bar = val; 377 w->vertical_scroll_bar = val;
@@ -461,14 +444,12 @@ wset_next_buffers (struct window *w, Lisp_Object val)
461/* Return the width of window W in canonical column units. 444/* Return the width of window W in canonical column units.
462 This includes scroll bars and fringes. */ 445 This includes scroll bars and fringes. */
463 446
464#define WINDOW_TOTAL_COLS(W) \ 447#define WINDOW_TOTAL_COLS(W) (W)->total_cols
465 (XFASTINT (W->total_cols))
466 448
467/* Return the height of window W in canonical line units. 449/* Return the height of window W in canonical line units.
468 This includes header and mode lines, if any. */ 450 This includes header and mode lines, if any. */
469 451
470#define WINDOW_TOTAL_LINES(W) \ 452#define WINDOW_TOTAL_LINES(W) (W)->total_lines
471 (XFASTINT (W->total_lines))
472 453
473/* Return the total pixel width of window W. */ 454/* Return the total pixel width of window W. */
474 455
@@ -495,8 +476,7 @@ wset_next_buffers (struct window *w, Lisp_Object val)
495/* Return the canonical frame column at which window W starts. 476/* Return the canonical frame column at which window W starts.
496 This includes a left-hand scroll bar, if any. */ 477 This includes a left-hand scroll bar, if any. */
497 478
498#define WINDOW_LEFT_EDGE_COL(W) \ 479#define WINDOW_LEFT_EDGE_COL(W) (W)->left_col
499 (XFASTINT (W->left_col))
500 480
501/* Return the canonical frame column before which window W ends. 481/* Return the canonical frame column before which window W ends.
502 This includes a right-hand scroll bar, if any. */ 482 This includes a right-hand scroll bar, if any. */
@@ -507,8 +487,7 @@ wset_next_buffers (struct window *w, Lisp_Object val)
507/* Return the canonical frame line at which window W starts. 487/* Return the canonical frame line at which window W starts.
508 This includes a header line, if any. */ 488 This includes a header line, if any. */
509 489
510#define WINDOW_TOP_EDGE_LINE(W) \ 490#define WINDOW_TOP_EDGE_LINE(W) (W)->top_line
511 (XFASTINT (W->top_line))
512 491
513/* Return the canonical frame line before which window W ends. 492/* Return the canonical frame line before which window W ends.
514 This includes a mode line, if any. */ 493 This includes a mode line, if any. */
diff --git a/src/xdisp.c b/src/xdisp.c
index a5bba1a81cd..2a565b5cffd 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -979,7 +979,7 @@ window_text_bottom_y (struct window *w)
979int 979int
980window_box_width (struct window *w, int area) 980window_box_width (struct window *w, int area)
981{ 981{
982 int cols = XFASTINT (w->total_cols); 982 int cols = w->total_cols;
983 int pixels = 0; 983 int pixels = 0;
984 984
985 if (!w->pseudo_window_p) 985 if (!w->pseudo_window_p)
@@ -22082,11 +22082,6 @@ else if the text is replaced by an ellipsis. */)
22082 22082
22083*/ 22083*/
22084 22084
22085#define NUMVAL(X) \
22086 ((INTEGERP (X) || FLOATP (X)) \
22087 ? XFLOATINT (X) \
22088 : - 1)
22089
22090static int 22085static int
22091calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, 22086calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
22092 struct font *font, int width_p, int *align_to) 22087 struct font *font, int width_p, int *align_to)
@@ -22117,24 +22112,11 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
22117 pixels = 0; 22112 pixels = 0;
22118 if (pixels > 0) 22113 if (pixels > 0)
22119 { 22114 {
22120 double ppi; 22115 double ppi = (width_p ? FRAME_RES_X (it->f)
22121#ifdef HAVE_WINDOW_SYSTEM 22116 : FRAME_RES_Y (it->f));
22122 if (FRAME_WINDOW_P (it->f)
22123 && (ppi = (width_p
22124 ? FRAME_X_DISPLAY_INFO (it->f)->resx
22125 : FRAME_X_DISPLAY_INFO (it->f)->resy),
22126 ppi > 0))
22127 return OK_PIXELS (ppi / pixels);
22128#endif
22129 22117
22130 if ((ppi = NUMVAL (Vdisplay_pixels_per_inch), ppi > 0) 22118 if (ppi > 0)
22131 || (CONSP (Vdisplay_pixels_per_inch)
22132 && (ppi = (width_p
22133 ? NUMVAL (XCAR (Vdisplay_pixels_per_inch))
22134 : NUMVAL (XCDR (Vdisplay_pixels_per_inch))),
22135 ppi > 0)))
22136 return OK_PIXELS (ppi / pixels); 22119 return OK_PIXELS (ppi / pixels);
22137
22138 return 0; 22120 return 0;
22139 } 22121 }
22140 } 22122 }
@@ -29236,13 +29218,13 @@ init_xdisp (void)
29236 29218
29237 echo_area_window = minibuf_window; 29219 echo_area_window = minibuf_window;
29238 29220
29239 wset_top_line (r, make_number (FRAME_TOP_MARGIN (f))); 29221 r->top_line = FRAME_TOP_MARGIN (f);
29240 wset_total_lines 29222 r->total_lines = FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f);
29241 (r, make_number (FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f))); 29223 r->total_cols = FRAME_COLS (f);
29242 wset_total_cols (r, make_number (FRAME_COLS (f))); 29224
29243 wset_top_line (m, make_number (FRAME_LINES (f) - 1)); 29225 m->top_line = FRAME_LINES (f) - 1;
29244 wset_total_lines (m, make_number (1)); 29226 m->total_lines = 1;
29245 wset_total_cols (m, make_number (FRAME_COLS (f))); 29227 m->total_cols = FRAME_COLS (f);
29246 29228
29247 scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs; 29229 scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs;
29248 scratch_glyph_row.glyphs[TEXT_AREA + 1] 29230 scratch_glyph_row.glyphs[TEXT_AREA + 1]
diff --git a/src/xfaces.c b/src/xfaces.c
index 28bccd392dc..eb33a38a491 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1592,7 +1592,7 @@ the face font sort order. */)
1592 ASET (v, 0, AREF (font, FONT_FAMILY_INDEX)); 1592 ASET (v, 0, AREF (font, FONT_FAMILY_INDEX));
1593 ASET (v, 1, FONT_WIDTH_SYMBOLIC (font)); 1593 ASET (v, 1, FONT_WIDTH_SYMBOLIC (font));
1594 point = PIXEL_TO_POINT (XINT (AREF (font, FONT_SIZE_INDEX)) * 10, 1594 point = PIXEL_TO_POINT (XINT (AREF (font, FONT_SIZE_INDEX)) * 10,
1595 XFRAME (frame)->resy); 1595 FRAME_RES_Y (XFRAME (frame)));
1596 ASET (v, 2, make_number (point)); 1596 ASET (v, 2, make_number (point));
1597 ASET (v, 3, FONT_WEIGHT_SYMBOLIC (font)); 1597 ASET (v, 3, FONT_WEIGHT_SYMBOLIC (font));
1598 ASET (v, 4, FONT_SLANT_SYMBOLIC (font)); 1598 ASET (v, 4, FONT_SLANT_SYMBOLIC (font));
@@ -2118,7 +2118,7 @@ set_lface_from_font (struct frame *f, Lisp_Object lface,
2118 2118
2119 if (force_p || UNSPECIFIEDP (LFACE_HEIGHT (lface))) 2119 if (force_p || UNSPECIFIEDP (LFACE_HEIGHT (lface)))
2120 { 2120 {
2121 int pt = PIXEL_TO_POINT (font->pixel_size * 10, f->resy); 2121 int pt = PIXEL_TO_POINT (font->pixel_size * 10, FRAME_RES_Y (f));
2122 2122
2123 eassert (pt > 0); 2123 eassert (pt > 0);
2124 ASET (lface, LFACE_HEIGHT_INDEX, make_number (pt)); 2124 ASET (lface, LFACE_HEIGHT_INDEX, make_number (pt));
diff --git a/src/xfns.c b/src/xfns.c
index 100fd81a155..488365561d3 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3182,9 +3182,6 @@ This function is an internal primitive--use `make-frame' instead. */)
3182 specbind (Qx_resource_name, name); 3182 specbind (Qx_resource_name, name);
3183 } 3183 }
3184 3184
3185 f->resx = dpyinfo->resx;
3186 f->resy = dpyinfo->resy;
3187
3188#ifdef HAVE_FREETYPE 3185#ifdef HAVE_FREETYPE
3189#ifdef HAVE_XFT 3186#ifdef HAVE_XFT
3190 register_font_driver (&xftfont_driver, f); 3187 register_font_driver (&xftfont_driver, f);
@@ -4631,9 +4628,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4631 specbind (Qx_resource_name, name); 4628 specbind (Qx_resource_name, name);
4632 } 4629 }
4633 4630
4634 f->resx = dpyinfo->resx;
4635 f->resy = dpyinfo->resy;
4636
4637 register_font_driver (&xfont_driver, f); 4631 register_font_driver (&xfont_driver, f);
4638#ifdef HAVE_FREETYPE 4632#ifdef HAVE_FREETYPE
4639#ifdef HAVE_XFT 4633#ifdef HAVE_XFT
@@ -5027,23 +5021,23 @@ Text larger than the specified size is clipped. */)
5027 5021
5028 /* Set up the frame's root window. */ 5022 /* Set up the frame's root window. */
5029 w = XWINDOW (FRAME_ROOT_WINDOW (f)); 5023 w = XWINDOW (FRAME_ROOT_WINDOW (f));
5030 wset_left_col (w, make_number (0)); 5024 w->left_col = 0;
5031 wset_top_line (w, make_number (0)); 5025 w->top_line = 0;
5032 5026
5033 if (CONSP (Vx_max_tooltip_size) 5027 if (CONSP (Vx_max_tooltip_size)
5034 && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX) 5028 && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
5035 && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX)) 5029 && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
5036 { 5030 {
5037 wset_total_cols (w, XCAR (Vx_max_tooltip_size)); 5031 w->total_cols = XFASTINT (XCAR (Vx_max_tooltip_size));
5038 wset_total_lines (w, XCDR (Vx_max_tooltip_size)); 5032 w->total_lines = XFASTINT (XCDR (Vx_max_tooltip_size));
5039 } 5033 }
5040 else 5034 else
5041 { 5035 {
5042 wset_total_cols (w, make_number (80)); 5036 w->total_cols = 80;
5043 wset_total_lines (w, make_number (40)); 5037 w->total_lines = 40;
5044 } 5038 }
5045 5039
5046 FRAME_TOTAL_COLS (f) = XINT (w->total_cols); 5040 FRAME_TOTAL_COLS (f) = w->total_cols;
5047 adjust_glyphs (f); 5041 adjust_glyphs (f);
5048 w->pseudo_window_p = 1; 5042 w->pseudo_window_p = 1;
5049 5043
@@ -5110,7 +5104,7 @@ Text larger than the specified size is clipped. */)
5110 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, 5104 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
5111 not in pixels. */ 5105 not in pixels. */
5112 width /= WINDOW_FRAME_COLUMN_WIDTH (w); 5106 width /= WINDOW_FRAME_COLUMN_WIDTH (w);
5113 wset_total_cols (w, make_number (width)); 5107 w->total_cols = width;
5114 FRAME_TOTAL_COLS (f) = width; 5108 FRAME_TOTAL_COLS (f) = width;
5115 adjust_glyphs (f); 5109 adjust_glyphs (f);
5116 clear_glyph_matrix (w->desired_matrix); 5110 clear_glyph_matrix (w->desired_matrix);
diff --git a/src/xsettings.c b/src/xsettings.c
index 576a5032eac..f48c49dbafe 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -673,19 +673,14 @@ apply_xft_settings (struct x_display_info *dpyinfo,
673 if ((settings->seen & SEEN_DPI) != 0 && oldsettings.dpi != settings->dpi 673 if ((settings->seen & SEEN_DPI) != 0 && oldsettings.dpi != settings->dpi
674 && settings->dpi > 0) 674 && settings->dpi > 0)
675 { 675 {
676 Lisp_Object frame, tail;
677
678 FcPatternDel (pat, FC_DPI); 676 FcPatternDel (pat, FC_DPI);
679 FcPatternAddDouble (pat, FC_DPI, settings->dpi); 677 FcPatternAddDouble (pat, FC_DPI, settings->dpi);
680 ++changed; 678 ++changed;
681 oldsettings.dpi = settings->dpi; 679 oldsettings.dpi = settings->dpi;
682 680
683 /* Change the DPI on this display and all frames on the display. */ 681 /* Changing the DPI on this display affects all frames on it.
682 Check FRAME_RES_X and FRAME_RES_Y in frame.h to see how. */
684 dpyinfo->resy = dpyinfo->resx = settings->dpi; 683 dpyinfo->resy = dpyinfo->resx = settings->dpi;
685 FOR_EACH_FRAME (tail, frame)
686 if (FRAME_X_P (XFRAME (frame))
687 && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo)
688 XFRAME (frame)->resy = XFRAME (frame)->resx = settings->dpi;
689 } 684 }
690 685
691 if (changed) 686 if (changed)