From: Dmitry Antipov Date: Wed, 20 Mar 2013 11:29:37 +0000 (+0400) Subject: * window.h (struct window): Convert left_col, top_line, total_lines X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~528^2~2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5f24fa51a07664e81d4c710fe310d2c2fbea8bb5;p=emacs.git * window.h (struct window): Convert left_col, top_line, total_lines and total_cols from Lisp_Objects to integers. Adjust comments. (wset_left_col, wset_top_line, wset_total_cols, wset_total_lines): Remove. (WINDOW_TOTAL_COLS, WINDOW_TOTAL_LINES, WINDOW_LEFT_EDGE_COL) (WINDOW_TOP_EDGE_LINE): Drop Lisp_Object to integer conversion. * dispnew.c, frame.c, w32fns.c, window.c, xdisp.c, xfns.c: Adjust users where appropriate. --- diff --git a/src/ChangeLog b/src/ChangeLog index 03127c62539..d71b9335319 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2013-03-20 Dmitry Antipov + + * window.h (struct window): Convert left_col, top_line, total_lines + and total_cols from Lisp_Objects to integers. Adjust comments. + (wset_left_col, wset_top_line, wset_total_cols, wset_total_lines): + Remove. + (WINDOW_TOTAL_COLS, WINDOW_TOTAL_LINES, WINDOW_LEFT_EDGE_COL) + (WINDOW_TOP_EDGE_LINE): Drop Lisp_Object to integer conversion. + * dispnew.c, frame.c, w32fns.c, window.c, xdisp.c, xfns.c: + Adjust users where appropriate. + 2013-03-20 Dmitry Antipov * frame.h (struct frame): Drop resx and resy because the same data is 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 if (NUMBERP (margin)) { - int width = XFASTINT (w->total_cols); + int width = w->total_cols; double d = max (0, XFLOATINT (margin)); d = min (width / 2 - 1, d); n = (int) ((double) total_glyphs / width * d); @@ -1776,7 +1776,7 @@ required_matrix_width (struct window *w) } #endif /* HAVE_WINDOW_SYSTEM */ - return XINT (w->total_cols); + return w->total_cols; } @@ -2114,10 +2114,10 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) /* Set window dimensions to frame dimensions and allocate or adjust glyph matrices of W. */ - wset_top_line (w, make_number (0)); - wset_left_col (w, make_number (0)); - wset_total_lines (w, make_number (FRAME_MENU_BAR_LINES (f))); - wset_total_cols (w, make_number (FRAME_TOTAL_COLS (f))); + w->top_line = 0; + w->left_col = 0; + w->total_lines = FRAME_MENU_BAR_LINES (f); + w->total_cols = FRAME_TOTAL_COLS (f); allocate_matrices_for_window_redisplay (w); } #endif /* not USE_X_TOOLKIT && not USE_GTK */ @@ -2140,10 +2140,10 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) else w = XWINDOW (f->tool_bar_window); - wset_top_line (w, make_number (FRAME_MENU_BAR_LINES (f))); - wset_left_col (w, make_number (0)); - wset_total_lines (w, make_number (FRAME_TOOL_BAR_LINES (f))); - wset_total_cols (w, make_number (FRAME_TOTAL_COLS (f))); + w->top_line = FRAME_MENU_BAR_LINES (f); + w->left_col = 0; + w->total_lines = FRAME_TOOL_BAR_LINES (f); + w->total_cols = FRAME_TOTAL_COLS (f); allocate_matrices_for_window_redisplay (w); } #endif @@ -5583,7 +5583,7 @@ change_frame_size_1 (struct frame *f, int newheight, int newwidth, FrameCols (FRAME_TTY (f)) = newwidth; if (WINDOWP (f->tool_bar_window)) - wset_total_cols (XWINDOW (f->tool_bar_window), make_number (newwidth)); + XWINDOW (f->tool_bar_window)->total_cols = newwidth; } FRAME_LINES (f) = newheight; 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) struct window *w = XWINDOW (window); w->last_modified = 0; - wset_top_line (w, make_number (XFASTINT (w->top_line) + n)); - wset_total_lines (w, make_number (XFASTINT (w->total_lines) - n)); + w->top_line += n; + w->total_lines -= n; /* Handle just the top child in a vertical split. */ if (!NILP (w->vchild)) @@ -332,14 +332,14 @@ make_frame (int mini_p) SET_FRAME_COLS (f, 10); FRAME_LINES (f) = 10; - wset_total_cols (XWINDOW (root_window), make_number (10)); - wset_total_lines (XWINDOW (root_window), make_number (mini_p ? 9 : 10)); + XWINDOW (root_window)->total_cols = 10; + XWINDOW (root_window)->total_lines = mini_p ? 9 : 10; if (mini_p) { - wset_total_cols (XWINDOW (mini_window), make_number (10)); - wset_top_line (XWINDOW (mini_window), make_number (9)); - wset_total_lines (XWINDOW (mini_window), make_number (1)); + XWINDOW (mini_window)->total_cols = 10; + XWINDOW (mini_window)->top_line = 9; + XWINDOW (mini_window)->total_lines = 1; } /* Choose a buffer for the frame's root window. */ diff --git a/src/w32fns.c b/src/w32fns.c index 83b52d73596..4c47465e67b 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -5774,8 +5774,8 @@ Text larger than the specified size is clipped. */) /* Set up the frame's root window. */ w = XWINDOW (FRAME_ROOT_WINDOW (f)); - wset_left_col (w, make_number (0)); - wset_top_line (w, make_number (0)); + w->left_col = 0; + w->top_line = 0; if (CONSP (Vx_max_tooltip_size) && INTEGERP (XCAR (Vx_max_tooltip_size)) @@ -5783,13 +5783,13 @@ Text larger than the specified size is clipped. */) && INTEGERP (XCDR (Vx_max_tooltip_size)) && XINT (XCDR (Vx_max_tooltip_size)) > 0) { - wset_total_cols (w, XCAR (Vx_max_tooltip_size)); - wset_total_lines (w, XCDR (Vx_max_tooltip_size)); + w->total_cols = XFASTINT (XCAR (Vx_max_tooltip_size)); + w->total_lines = XFASTINT (XCDR (Vx_max_tooltip_size)); } else { - wset_total_cols (w, make_number (80)); - wset_total_lines (w, make_number (40)); + w->total_cols = 80; + w->total_lines = 40; } FRAME_TOTAL_COLS (f) = XINT (w->total_cols); @@ -5860,7 +5860,7 @@ Text larger than the specified size is clipped. */) /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, not in pixels. */ width /= WINDOW_FRAME_COLUMN_WIDTH (w); - wset_total_cols (w, make_number (width)); + w->total_cols = width; FRAME_TOTAL_COLS (f) = width; adjust_glyphs (f); w->pseudo_window_p = 1; 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 integer multiple of the default character height. */) (Lisp_Object window) { - return decode_valid_window (window)->total_lines; + return make_number (decode_valid_window (window)->total_lines); } DEFUN ("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 integer multiple of the default character width. */) (Lisp_Object window) { - return decode_valid_window (window)->total_cols; + return make_number (decode_valid_window (window)->total_cols); } DEFUN ("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. WINDOW must be a valid window and defaults to the selected one. */) (Lisp_Object window) { - return decode_valid_window (window)->left_col; + return make_number (decode_valid_window (window)->left_col); } DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, @@ -758,7 +758,7 @@ there is no window above WINDOW. WINDOW must be a valid window and defaults to the selected one. */) (Lisp_Object window) { - return decode_valid_window (window)->top_line; + return make_number (decode_valid_window (window)->top_line); } /* 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. */) static int window_body_lines (struct window *w) { - int height = XFASTINT (w->total_lines); + int height = w->total_lines; if (!MINI_WINDOW_P (w)) { @@ -789,7 +789,7 @@ int window_body_cols (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - int width = XINT (w->total_cols); + int width = w->total_cols; if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) /* Scroll bars occupy a few columns. */ @@ -2007,12 +2007,12 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag) if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) fset_root_window (XFRAME (o->frame), new); - if (setflag) - { - wset_left_col (n, o->left_col); - wset_top_line (n, o->top_line); - wset_total_cols (n, o->total_cols); - wset_total_lines (n, o->total_lines); + if (setflag) + { + n->left_col = o->left_col; + n->top_line = o->top_line; + n->total_cols = o->total_cols; + n->total_lines = o->total_lines; wset_normal_cols (n, o->normal_cols); wset_normal_cols (o, make_float (1.0)); wset_normal_lines (n, o->normal_lines); @@ -2097,12 +2097,12 @@ recombine_windows (Lisp_Object window) if (horflag) wset_normal_cols (c, - make_float (XFLOATINT (c->total_cols) - / XFLOATINT (p->total_cols))); + make_float ((double) c->total_cols + / (double) p->total_cols)); else wset_normal_lines (c, - make_float (XFLOATINT (c->total_lines) - / XFLOATINT (p->total_lines))); + make_float ((double) c->total_lines + / (double) p->total_lines)); if (NILP (c->next)) { @@ -2861,9 +2861,8 @@ window-start value is reasonable when this function is called. */) if (NILP (w->buffer)) { /* Resize child windows vertically. */ - XSETINT (delta, XINT (r->total_lines) - - XINT (w->total_lines)); - wset_top_line (w, r->top_line); + XSETINT (delta, r->total_lines - w->total_lines); + w->top_line = r->top_line; resize_root_window (window, delta, Qnil, Qnil); if (window_resize_check (w, 0)) window_resize_apply (w, 0); @@ -2879,10 +2878,8 @@ window-start value is reasonable when this function is called. */) /* Resize child windows horizontally. */ if (!resize_failed) { - wset_left_col (w, r->left_col); - XSETINT (delta, - XINT (r->total_cols) - XINT (w->total_cols)); - wset_left_col (w, r->left_col); + w->left_col = r->left_col; + XSETINT (delta, r->total_cols - w->total_cols); resize_root_window (window, delta, Qt, Qnil); if (window_resize_check (w, 1)) window_resize_apply (w, 1); @@ -3453,10 +3450,6 @@ make_window (void) w = allocate_window (); /* Initialize Lisp data. Note that allocate_window initializes all Lisp data to nil, so do it only for slots which should not be nil. */ - wset_left_col (w, make_number (0)); - wset_top_line (w, make_number (0)); - wset_total_lines (w, make_number (0)); - wset_total_cols (w, make_number (0)); wset_normal_lines (w, make_float (1.0)); wset_normal_cols (w, make_float (1.0)); wset_new_total (w, make_number (0)); @@ -3617,19 +3610,19 @@ window_resize_apply (struct window *w, bool horflag) parent window has been set *before*. */ if (horflag) { - wset_total_cols (w, w->new_total); + w->total_cols = XFASTINT (w->new_total); if (NUMBERP (w->new_normal)) wset_normal_cols (w, w->new_normal); - pos = XINT (w->left_col); + pos = w->left_col; } else { - wset_total_lines (w, w->new_total); + w->total_lines = XFASTINT (w->new_total); if (NUMBERP (w->new_normal)) wset_normal_lines (w, w->new_normal); - pos = XINT (w->top_line); + pos = w->top_line; } if (!NILP (w->vchild)) @@ -3639,12 +3632,12 @@ window_resize_apply (struct window *w, bool horflag) while (c) { if (horflag) - wset_left_col (c, make_number (pos)); + c->left_col = pos; else - wset_top_line (c, make_number (pos)); + c->top_line = pos; window_resize_apply (c, horflag); if (!horflag) - pos = pos + XINT (c->total_lines); + pos = pos + c->total_lines; c = NILP (c->next) ? 0 : XWINDOW (c->next); } } @@ -3655,12 +3648,12 @@ window_resize_apply (struct window *w, bool horflag) while (c) { if (horflag) - wset_left_col (c, make_number (pos)); + c->left_col = pos; else - wset_top_line (c, make_number (pos)); + c->top_line = pos; window_resize_apply (c, horflag); if (horflag) - pos = pos + XINT (c->total_cols); + pos = pos + c->total_cols; c = NILP (c->next) ? 0 : XWINDOW (c->next); } } @@ -3692,8 +3685,8 @@ be applied on the Elisp level. */) bool horflag = !NILP (horizontal); if (!window_resize_check (r, horflag) - || ! EQ (r->new_total, - (horflag ? r->total_cols : r->total_lines))) + || (XINT (r->new_total) + != (horflag ? r->total_cols : r->total_lines))) return Qnil; block_input (); @@ -3733,18 +3726,17 @@ resize_frame_windows (struct frame *f, int size, bool horflag) - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) ? 1 : 0))); - wset_top_line (r, make_number (FRAME_TOP_MARGIN (f))); + r->top_line = FRAME_TOP_MARGIN (f); if (NILP (r->vchild) && NILP (r->hchild)) /* For a leaf root window just set the size. */ if (horflag) - wset_total_cols (r, make_number (new_size)); + r->total_cols = new_size; else - wset_total_lines (r, make_number (new_size)); + r->total_lines = new_size; else { /* old_size is the old size of the frame's root window. */ - int old_size = XFASTINT (horflag ? r->total_cols - : r->total_lines); + int old_size = horflag ? r->total_cols : r->total_lines; Lisp_Object delta; XSETINT (delta, new_size - old_size); @@ -3774,9 +3766,9 @@ resize_frame_windows (struct frame *f, int size, bool horflag) root = f->selected_window; Fdelete_other_windows_internal (root, Qnil); if (horflag) - wset_total_cols (XWINDOW (root), make_number (new_size)); + XWINDOW (root)->total_cols = new_size; else - wset_total_lines (XWINDOW (root), make_number (new_size)); + XWINDOW (root)->total_lines = new_size; } } } @@ -3786,13 +3778,12 @@ resize_frame_windows (struct frame *f, int size, bool horflag) { m = XWINDOW (mini); if (horflag) - wset_total_cols (m, make_number (size)); + m->total_cols = size; else { /* Are we sure we always want 1 line here? */ - wset_total_lines (m, make_number (1)); - wset_top_line - (m, make_number (XINT (r->top_line) + XINT (r->total_lines))); + m->total_lines = 1; + m->top_line = r->top_line + r->total_lines; } } @@ -3876,20 +3867,21 @@ set correctly. See the code of `split-window' for how this is done. */) p = XWINDOW (o->parent); /* Temporarily pretend we split the parent window. */ wset_new_total - (p, make_number (XINT (horflag ? p->total_cols : p->total_lines) + (p, make_number ((horflag ? p->total_cols : p->total_lines) - XINT (total_size))); if (!window_resize_check (p, horflag)) error ("Window sizes don't fit"); else /* Undo the temporary pretension. */ - wset_new_total (p, horflag ? p->total_cols : p->total_lines); + wset_new_total (p, make_number + (horflag ? p->total_cols : p->total_lines)); } else { if (!window_resize_check (o, horflag)) error ("Resizing old window failed"); else if (XINT (total_size) + XINT (o->new_total) - != XINT (horflag ? o->total_cols : o->total_lines)) + != (horflag ? o->total_cols : o->total_lines)) error ("Sum of sizes of old and new window don't fit"); } @@ -3909,7 +3901,8 @@ set correctly. See the code of `split-window' for how this is done. */) that its children get merged into another window. */ wset_combination_limit (p, Qt); /* These get applied below. */ - wset_new_total (p, horflag ? o->total_cols : o->total_lines); + wset_new_total (p, make_number + (horflag ? o->total_cols : o->total_lines)); wset_new_normal (p, new_normal); } else @@ -3961,13 +3954,13 @@ set correctly. See the code of `split-window' for how this is done. */) /* Directly assign orthogonal coordinates and sizes. */ if (horflag) { - wset_top_line (n, o->top_line); - wset_total_lines (n, o->total_lines); + n->top_line = o->top_line; + n->total_lines = o->total_lines; } else { - wset_left_col (n, o->left_col); - wset_total_cols (n, o->total_cols); + n->left_col = o->left_col; + n->total_cols = o->total_cols; } /* 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. */) } if (window_resize_check (r, horflag) - && EQ (r->new_total, - (horflag ? r->total_cols : r->total_lines))) + && (XINT (r->new_total) + == (horflag ? r->total_cols : r->total_lines))) /* We can delete WINDOW now. */ { @@ -4203,10 +4196,8 @@ grow_mini_window (struct window *w, int delta) window_resize_apply (r, 0); /* Grow the mini-window. */ - wset_top_line - (w, make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines))); - wset_total_lines - (w, make_number (XFASTINT (w->total_lines) - XINT (value))); + w->top_line = r->top_line + r->total_lines; + w->total_lines -= XINT (value); w->last_modified = 0; w->last_overlay_modified = 0; @@ -4228,7 +4219,7 @@ shrink_mini_window (struct window *w) eassert (MINI_WINDOW_P (w)); - size = XINT (w->total_lines); + size = w->total_lines; if (size > 1) { root = FRAME_ROOT_WINDOW (f); @@ -4241,9 +4232,8 @@ shrink_mini_window (struct window *w) window_resize_apply (r, 0); /* Shrink the mini-window. */ - wset_top_line (w, make_number (XFASTINT (r->top_line) - + XFASTINT (r->total_lines))); - wset_total_lines (w, make_number (1)); + w->top_line = r->top_line + r->total_lines; + w->total_lines = 1; w->last_modified = 0; w->last_overlay_modified = 0; @@ -4277,7 +4267,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini error ("Cannot resize a minibuffer-only frame"); r = XWINDOW (FRAME_ROOT_WINDOW (f)); - height = XINT (r->total_lines) + XINT (w->total_lines); + height = r->total_lines + w->total_lines; if (window_resize_check (r, 0) && XINT (w->new_total) > 0 && height == XINT (r->new_total) + XINT (w->new_total)) @@ -4285,9 +4275,8 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini block_input (); window_resize_apply (r, 0); - wset_total_lines (w, w->new_total); - wset_top_line (w, make_number (XINT (r->top_line) - + XINT (r->total_lines))); + w->total_lines = XFASTINT (w->new_total); + w->top_line = r->top_line + r->total_lines; windows_or_buffers_changed++; FRAME_WINDOW_SIZES_CHANGED (f) = 1; @@ -4327,7 +4316,7 @@ mark_window_cursors_off (struct window *w) int window_internal_height (struct window *w) { - int ht = XFASTINT (w->total_lines); + int ht = w->total_lines; if (!MINI_WINDOW_P (w)) { @@ -4637,7 +4626,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) even if there is a header line. */ this_scroll_margin = max (0, scroll_margin); this_scroll_margin - = min (this_scroll_margin, XFASTINT (w->total_lines) / 4); + = min (this_scroll_margin, w->total_lines / 4); this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); if (n > 0) @@ -4814,7 +4803,7 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) { /* Don't use a scroll margin that is negative or too large. */ int this_scroll_margin = - max (0, min (scroll_margin, XINT (w->total_lines) / 4)); + max (0, min (scroll_margin, w->total_lines / 4)); set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); w->start_at_line_beg = !NILP (bolp); @@ -5231,7 +5220,7 @@ and redisplay normally--don't erase and redraw the frame. */) /* Do this after making BUF current in case scroll_margin is buffer-local. */ this_scroll_margin = - max (0, min (scroll_margin, XFASTINT (w->total_lines) / 4)); + max (0, min (scroll_margin, w->total_lines / 4)); /* Handle centering on a graphical frame specially. Such frames can 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. */) wset_prev (w, Qnil); if (!NILP (w->parent)) { - if (EQ (p->total_cols, XWINDOW (w->parent)->total_cols)) + if (XINT (p->total_cols) == XWINDOW (w->parent)->total_cols) { wset_vchild (XWINDOW (w->parent), p->window); wset_hchild (XWINDOW (w->parent), Qnil); @@ -5721,10 +5710,10 @@ the return value is nil. Otherwise the value is t. */) /* If we squirreled away the buffer, restore it now. */ if (BUFFERP (w->combination_limit)) wset_buffer (w, w->combination_limit); - wset_left_col (w, p->left_col); - wset_top_line (w, p->top_line); - wset_total_cols (w, p->total_cols); - wset_total_lines (w, p->total_lines); + w->left_col = XFASTINT (p->left_col); + w->top_line = XFASTINT (p->top_line); + w->total_cols = XFASTINT (p->total_cols); + w->total_lines = XFASTINT (p->total_lines); wset_normal_cols (w, p->normal_cols); wset_normal_lines (w, p->normal_lines); w->hscroll = XFASTINT (p->hscroll); @@ -6038,10 +6027,10 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) wset_temslot (w, make_number (i)); i++; p->window = window; p->buffer = w->buffer; - p->left_col = w->left_col; - p->top_line = w->top_line; - p->total_cols = w->total_cols; - p->total_lines = w->total_lines; + p->left_col = make_number (w->left_col); + p->top_line = make_number (w->top_line); + p->total_cols = make_number (w->total_cols); + p->total_lines = make_number (w->total_lines); p->normal_cols = w->normal_cols; p->normal_lines = w->normal_lines; 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 /* The window this one is a child of. */ Lisp_Object parent; - /* The upper left corner coordinates of this window, as integers - relative to upper left corner of frame = 0, 0. */ - Lisp_Object left_col; - Lisp_Object top_line; - - /* The size of the window. */ - Lisp_Object total_lines; - Lisp_Object total_cols; - - /* The normal size of the window. */ + /* The normal size of the window. These are fractions, but we do + not use C doubles to avoid creating new Lisp_Float objects while + interfacing Lisp in Fwindow_normal_size. */ Lisp_Object normal_lines; Lisp_Object normal_cols; - /* New sizes of the window. */ + /* New sizes of the window. Note that Lisp code may set new_normal + to something beyond an integer, so C int can't be used here. */ Lisp_Object new_total; Lisp_Object new_normal; @@ -221,6 +215,15 @@ struct window /* Number saying how recently window was selected. */ int use_time; + /* The upper left corner coordinates of this window, + relative to upper left corner of frame = 0, 0. */ + int left_col; + int top_line; + + /* The size of the window. */ + int total_lines; + int total_cols; + /* Number of columns display within the window is scrolled to the left. */ ptrdiff_t hscroll; @@ -354,11 +357,6 @@ wset_frame (struct window *w, Lisp_Object val) w->frame = val; } WINDOW_INLINE void -wset_left_col (struct window *w, Lisp_Object val) -{ - w->left_col = val; -} -WINDOW_INLINE void wset_next (struct window *w, Lisp_Object val) { w->next = val; @@ -374,21 +372,6 @@ wset_redisplay_end_trigger (struct window *w, Lisp_Object val) w->redisplay_end_trigger = val; } WINDOW_INLINE void -wset_top_line (struct window *w, Lisp_Object val) -{ - w->top_line = val; -} -WINDOW_INLINE void -wset_total_cols (struct window *w, Lisp_Object val) -{ - w->total_cols = val; -} -WINDOW_INLINE void -wset_total_lines (struct window *w, Lisp_Object val) -{ - w->total_lines = val; -} -WINDOW_INLINE void wset_vertical_scroll_bar (struct window *w, Lisp_Object val) { w->vertical_scroll_bar = val; @@ -461,14 +444,12 @@ wset_next_buffers (struct window *w, Lisp_Object val) /* Return the width of window W in canonical column units. This includes scroll bars and fringes. */ -#define WINDOW_TOTAL_COLS(W) \ - (XFASTINT (W->total_cols)) +#define WINDOW_TOTAL_COLS(W) (W)->total_cols /* Return the height of window W in canonical line units. This includes header and mode lines, if any. */ -#define WINDOW_TOTAL_LINES(W) \ - (XFASTINT (W->total_lines)) +#define WINDOW_TOTAL_LINES(W) (W)->total_lines /* Return the total pixel width of window W. */ @@ -495,8 +476,7 @@ wset_next_buffers (struct window *w, Lisp_Object val) /* Return the canonical frame column at which window W starts. This includes a left-hand scroll bar, if any. */ -#define WINDOW_LEFT_EDGE_COL(W) \ - (XFASTINT (W->left_col)) +#define WINDOW_LEFT_EDGE_COL(W) (W)->left_col /* Return the canonical frame column before which window W ends. This includes a right-hand scroll bar, if any. */ @@ -507,8 +487,7 @@ wset_next_buffers (struct window *w, Lisp_Object val) /* Return the canonical frame line at which window W starts. This includes a header line, if any. */ -#define WINDOW_TOP_EDGE_LINE(W) \ - (XFASTINT (W->top_line)) +#define WINDOW_TOP_EDGE_LINE(W) (W)->top_line /* Return the canonical frame line before which window W ends. This includes a mode line, if any. */ diff --git a/src/xdisp.c b/src/xdisp.c index 667597b93c3..2a565b5cffd 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -979,7 +979,7 @@ window_text_bottom_y (struct window *w) int window_box_width (struct window *w, int area) { - int cols = XFASTINT (w->total_cols); + int cols = w->total_cols; int pixels = 0; if (!w->pseudo_window_p) @@ -29218,13 +29218,13 @@ init_xdisp (void) echo_area_window = minibuf_window; - wset_top_line (r, make_number (FRAME_TOP_MARGIN (f))); - wset_total_lines - (r, make_number (FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f))); - wset_total_cols (r, make_number (FRAME_COLS (f))); - wset_top_line (m, make_number (FRAME_LINES (f) - 1)); - wset_total_lines (m, make_number (1)); - wset_total_cols (m, make_number (FRAME_COLS (f))); + r->top_line = FRAME_TOP_MARGIN (f); + r->total_lines = FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f); + r->total_cols = FRAME_COLS (f); + + m->top_line = FRAME_LINES (f) - 1; + m->total_lines = 1; + m->total_cols = FRAME_COLS (f); scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs; scratch_glyph_row.glyphs[TEXT_AREA + 1] diff --git a/src/xfns.c b/src/xfns.c index 385c5914d91..488365561d3 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5021,23 +5021,23 @@ Text larger than the specified size is clipped. */) /* Set up the frame's root window. */ w = XWINDOW (FRAME_ROOT_WINDOW (f)); - wset_left_col (w, make_number (0)); - wset_top_line (w, make_number (0)); + w->left_col = 0; + w->top_line = 0; if (CONSP (Vx_max_tooltip_size) && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX) && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX)) { - wset_total_cols (w, XCAR (Vx_max_tooltip_size)); - wset_total_lines (w, XCDR (Vx_max_tooltip_size)); + w->total_cols = XFASTINT (XCAR (Vx_max_tooltip_size)); + w->total_lines = XFASTINT (XCDR (Vx_max_tooltip_size)); } else { - wset_total_cols (w, make_number (80)); - wset_total_lines (w, make_number (40)); + w->total_cols = 80; + w->total_lines = 40; } - FRAME_TOTAL_COLS (f) = XINT (w->total_cols); + FRAME_TOTAL_COLS (f) = w->total_cols; adjust_glyphs (f); w->pseudo_window_p = 1; @@ -5104,7 +5104,7 @@ Text larger than the specified size is clipped. */) /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, not in pixels. */ width /= WINDOW_FRAME_COLUMN_WIDTH (w); - wset_total_cols (w, make_number (width)); + w->total_cols = width; FRAME_TOTAL_COLS (f) = width; adjust_glyphs (f); clear_glyph_matrix (w->desired_matrix);