From 748fa866ad6f94d3c499f2f2ea41efbaf0dfc75f Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 18 Mar 2013 17:21:12 +0400 Subject: * window.c (window_resize_check, window_resize_apply) (window_from_coordinates, recombine_windows, set_window_buffer) (make_parent_window, Fwindow_resize_apply, resize_frame_windows) (Fsplit_window_internal, Fdelete_window_internal) (freeze_window_starts): Use bool for booleans. * window.h (window_frame_coordinates, resize_frame_windows) (freeze_window_starts, set_window_buffer): Adjust prototypes. --- src/window.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/window.c') diff --git a/src/window.c b/src/window.c index 940e0f7565a..df7878f42e5 100644 --- a/src/window.c +++ b/src/window.c @@ -84,8 +84,8 @@ static int foreach_window_1 (struct window *, int (* fn) (struct window *, void *), void *); static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object); -static int window_resize_check (struct window *, int); -static void window_resize_apply (struct window *, int); +static int window_resize_check (struct window *, bool); +static void window_resize_apply (struct window *, bool); static Lisp_Object select_window (Lisp_Object, Lisp_Object, int); static void select_window_1 (Lisp_Object, bool); @@ -1368,7 +1368,7 @@ check_window_containing (struct window *w, void *user_data) Lisp_Object window_from_coordinates (struct frame *f, int x, int y, - enum window_part *part, int tool_bar_p) + enum window_part *part, bool tool_bar_p) { Lisp_Object window; struct check_window_data cw; @@ -2055,7 +2055,7 @@ recombine_windows (Lisp_Object window) { struct window *w, *p, *c; Lisp_Object parent, child; - int horflag; + bool horflag; w = XWINDOW (window); parent = w->parent; @@ -3148,7 +3148,8 @@ If FRAME is omitted or nil, it defaults to the selected frame. */) reset from the buffer's local settings. */ void -set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int keep_margins_p) +set_window_buffer (Lisp_Object window, Lisp_Object buffer, + bool run_hooks_p, bool keep_margins_p) { struct window *w = XWINDOW (window); struct buffer *b = XBUFFER (buffer); @@ -3406,7 +3407,7 @@ temp_output_buffer_show (register Lisp_Object buf) WINDOW its only vertical child (HORFLAG 1 means make WINDOW its only horizontal child). */ static void -make_parent_window (Lisp_Object window, int horflag) +make_parent_window (Lisp_Object window, bool horflag) { Lisp_Object parent; register struct window *o, *p; @@ -3519,7 +3520,7 @@ Note: This function does not operate on any child windows of WINDOW. */) `window-min-height' or `window-min-width'. It does check that window sizes do not drop below one line (two columns). */ static int -window_resize_check (struct window *w, int horflag) +window_resize_check (struct window *w, bool horflag) { struct window *c; @@ -3600,7 +3601,7 @@ window_resize_check (struct window *w, int horflag) This function does not perform any error checks. Make sure you have run window_resize_check on W before applying this function. */ static void -window_resize_apply (struct window *w, int horflag) +window_resize_apply (struct window *w, bool horflag) { struct window *c; int pos; @@ -3681,7 +3682,7 @@ be applied on the Elisp level. */) { struct frame *f = decode_live_frame (frame); struct window *r = XWINDOW (FRAME_ROOT_WINDOW (f)); - int horflag = !NILP (horizontal); + bool horflag = !NILP (horizontal); if (!window_resize_check (r, horflag) || ! EQ (r->new_total, @@ -3711,7 +3712,7 @@ be applied on the Elisp level. */) satisfy the request. The result will be meaningful if and only if F's windows have meaningful sizes when you call this. */ void -resize_frame_windows (struct frame *f, int size, int horflag) +resize_frame_windows (struct frame *f, int size, bool horflag) { Lisp_Object root = f->root_window; struct window *r = XWINDOW (root); @@ -3825,7 +3826,7 @@ set correctly. See the code of `split-window' for how this is done. */) register Lisp_Object new, frame, reference; register struct window *o, *p, *n, *r; struct frame *f; - int horflag + bool horflag /* HORFLAG is 1 when we split side-by-side, 0 otherwise. */ = EQ (side, Qt) || EQ (side, Qleft) || EQ (side, Qright); int combination_limit = 0; @@ -3994,7 +3995,7 @@ Signal an error when WINDOW is the only window on its frame. */) register Lisp_Object parent, sibling, frame, root; struct window *w, *p, *s, *r; struct frame *f; - int horflag; + bool horflag; int before_sibling = 0; w = decode_any_window (window); @@ -6527,7 +6528,7 @@ freeze_window_start (struct window *w, void *freeze_p) means freeze the window start. */ void -freeze_window_starts (struct frame *f, int freeze_p) +freeze_window_starts (struct frame *f, bool freeze_p) { foreach_window (f, freeze_window_start, (void *) (freeze_p ? f : 0)); } -- cgit v1.2.1 From 095d384da66c2b227803a0540d9bde9df52a97e1 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 19 Mar 2013 13:21:31 +0400 Subject: * window.c (Fwindow_combination_limit, Fset_window_combination_limit): Signal error if window is not internal. Adjust docstring. (delete_all_child_windows): Use combination_limit to save the buffer. (Fset_window_configuration): Adjust accordingly. --- src/window.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'src/window.c') diff --git a/src/window.c b/src/window.c index df7878f42e5..5dc908f0a4d 100644 --- a/src/window.c +++ b/src/window.c @@ -635,30 +635,37 @@ Return nil if WINDOW has no previous sibling. */) DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, doc: /* Return combination limit of window WINDOW. +WINDOW must be a valid window used in horizontal or vertical combination. If the return value is nil, child windows of WINDOW can be recombined with WINDOW's siblings. A return value of t means that child windows of -WINDOW are never \(re-)combined with WINDOW's siblings. - -WINDOW must be a valid window. The return value is meaningful for -internal windows only. */) +WINDOW are never \(re-)combined with WINDOW's siblings. */) (Lisp_Object window) { + struct window *w; + CHECK_VALID_WINDOW (window); + w = XWINDOW (window); + if (!NILP (w->buffer)) + error ("Combination limit is meaningful for internal windows only"); return XWINDOW (window)->combination_limit; } DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. +WINDOW must be a valid window used in horizontal or vertical combination. If LIMIT is nil, child windows of WINDOW can be recombined with WINDOW's siblings. LIMIT t means that child windows of WINDOW are never \(re-)combined with WINDOW's siblings. Other values are reserved for -future use. - -WINDOW must be a valid window. Setting the combination limit is -meaningful for internal windows only. */) +future use. */) (Lisp_Object window, Lisp_Object limit) { - wset_combination_limit (decode_valid_window (window), limit); + struct window *w; + + CHECK_VALID_WINDOW (window); + w = XWINDOW (window); + if (!NILP (w->buffer)) + error ("Combination limit is meaningful for internal windows only"); + wset_combination_limit (w, limit); return limit; } @@ -5711,10 +5718,9 @@ the return value is nil. Otherwise the value is t. */) } } - /* If we squirreled away the buffer in the window's height, - restore it now. */ - if (BUFFERP (w->total_lines)) - wset_buffer (w, w->total_lines); + /* 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); @@ -5918,9 +5924,6 @@ delete_all_child_windows (Lisp_Object window) /* Delete WINDOW's siblings (we traverse postorderly). */ delete_all_child_windows (w->next); - /* See Fset_window_configuration for excuse. */ - wset_total_lines (w, w->buffer); - if (!NILP (w->vchild)) { delete_all_child_windows (w->vchild); @@ -5936,6 +5939,10 @@ delete_all_child_windows (Lisp_Object window) unshow_buffer (w); unchain_marker (XMARKER (w->pointm)); unchain_marker (XMARKER (w->start)); + /* Since combination limit makes sense for an internal windows + only, we use this slot to save the buffer for the sake of + possible resurrection in Fset_window_configuration. */ + wset_combination_limit (w, w->buffer); wset_buffer (w, Qnil); } -- cgit v1.2.1 From 5f24fa51a07664e81d4c710fe310d2c2fbea8bb5 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Wed, 20 Mar 2013 15:29:37 +0400 Subject: * 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. --- src/window.c | 159 +++++++++++++++++++++++++++-------------------------------- 1 file changed, 74 insertions(+), 85 deletions(-) (limited to 'src/window.c') 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); -- cgit v1.2.1 From 908589fd28437a9b0995b103e22ce5e4d421eb8a Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 24 Mar 2013 13:59:45 +0100 Subject: Reorder conditions that are written backwards * alloc.c (xpalloc, Fgarbage_collect): Reorder conditions that are written backwards. * blockinput.h (input_blocked_p): Likewise. * bytecode.c (exec_byte_code): Likewise. * callproc.c (call_process_kill, call_process_cleanup) (Fcall_process): Likewise. * ccl.c (ccl_driver, resolve_symbol_ccl_program) (Fccl_execute_on_string): Likewise. * character.c (string_escape_byte8): Likewise. * charset.c (read_hex): Likewise. * cm.c (calccost): Likewise. * data.c (cons_to_unsigned): Likewise. * dired.c (directory_files_internal, file_name_completion): Likewise. * dispnew.c (scrolling_window, update_frame_1, Fsleep_for) (sit_for): Likewise. * doc.c (Fsubstitute_command_keys): Likewise. * doprnt.c (doprnt): Likewise. * editfns.c (hi_time, decode_time_components, Fformat): Likewise. * emacsgtkfixed.c: Likewise. * fileio.c (file_offset, Fwrite_region): Likewise. * floatfns.c (Fexpt, fmod_float): Likewise. * fns.c (larger_vector, make_hash_table, Fmake_hash_table): Likewise. * font.c (font_intern_prop): Likewise. * frame.c (x_set_alpha): Likewise. * gtkutil.c (get_utf8_string): Likewise. * indent.c (check_display_width): Likewise. * intervals.c (create_root_interval, rotate_right, rotate_left) (split_interval_right, split_interval_left) (adjust_intervals_for_insertion, delete_node) (interval_deletion_adjustment, adjust_intervals_for_deletion) (merge_interval_right, merge_interval_left, copy_intervals) (set_intervals_multibyte_1): Likewise. * keyboard.c (gobble_input, append_tool_bar_item): Likewise. * keymap.c (Fkey_description): Likewise. * lisp.h (FIXNUM_OVERFLOW_P, vcopy): Likewise. * lread.c (openp, read_integer, read1, string_to_number): Likewise. * menu.c (ensure_menu_items): Likewise. * minibuf.c (read_minibuf_noninteractive): Likewise. * print.c (printchar, strout): Likewise. * process.c (create_process, Faccept_process_output) (wait_reading_process_output, read_process_output, send_process) (wait_reading_process_output): Likewise. * profiler.c (make_log, handle_profiler_signal): Likewise. * regex.c (re_exec): Likewise. * regex.h: Likewise. * search.c (looking_at_1, Freplace_match): Likewise. * sysdep.c (get_child_status, procfs_ttyname) (procfs_get_total_memory): Likewise. * systime.h (EMACS_TIME_VALID_P): Likewise. * term.c (dissociate_if_controlling_tty): Likewise. * window.c (get_phys_cursor_glyph): Likewise. * xdisp.c (init_iterator, redisplay_internal, redisplay_window) (try_window_reusing_current_matrix, try_window_id, pint2hrstr): Likewise. * xfns.c (Fx_window_property): Likewise. * xmenu.c (set_frame_menubar): Likewise. * xselect.c (x_get_window_property, x_handle_dnd_message): Likewise. * xsmfns.c (smc_save_yourself_CB): Likewise. * xterm.c (x_scroll_bar_set_handle): Likewise. --- src/window.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/window.c') diff --git a/src/window.c b/src/window.c index 875d7770277..1784b38ba6d 100644 --- a/src/window.c +++ b/src/window.c @@ -6002,8 +6002,7 @@ get_phys_cursor_glyph (struct window *w) hpos = row->used[TEXT_AREA] - 1; } - if (row->used[TEXT_AREA] > hpos - && 0 <= hpos) + if (hpos >= 0 && hpos < row->used[TEXT_AREA]) glyph = row->glyphs[TEXT_AREA] + hpos; else glyph = NULL; -- cgit v1.2.1