comparison src/window.c @ 9324:ac6a5691607f

(make_window, Fset_window_hscroll, Fset_window_start, set_window_height, set_window_width, Fset_window_buffer, Fselect_window, temp_output_buffer_show, make_dummy_parent, Fsplit_window, change_window_height, window_scroll, Fscroll_left, Fscroll_right, Frecenter, Fmove_to_window_line, Fset_window_configuration, save_window_save, Fcurrent_window_configuration, init_window_once): Don't use XFASTINT as an lvalue.
author Karl Heuer <kwzh@gnu.org>
date Tue, 04 Oct 1994 16:34:57 +0000
parents f4fa46f6a032
children cf4f4c8a3ef6
comparison
equal deleted inserted replaced
9323:d428ab51a1bc 9324:ac6a5691607f
129 + sizeof (Lisp_Object)) 129 + sizeof (Lisp_Object))
130 / sizeof (Lisp_Object)), 130 / sizeof (Lisp_Object)),
131 Qnil); 131 Qnil);
132 XSETTYPE (val, Lisp_Window); 132 XSETTYPE (val, Lisp_Window);
133 p = XWINDOW (val); 133 p = XWINDOW (val);
134 XFASTINT (p->sequence_number) = ++sequence_number; 134 XSETFASTINT (p->sequence_number, ++sequence_number);
135 XFASTINT (p->left) = XFASTINT (p->top) 135 XSETFASTINT (p->left, 0);
136 = XFASTINT (p->height) = XFASTINT (p->width) 136 XSETFASTINT (p->top, 0);
137 = XFASTINT (p->hscroll) = 0; 137 XSETFASTINT (p->height, 0);
138 XFASTINT (p->last_point_x) = XFASTINT (p->last_point_y) = 0; 138 XSETFASTINT (p->width, 0);
139 XSETFASTINT (p->hscroll, 0);
140 XSETFASTINT (p->last_point_x, 0);
141 XSETFASTINT (p->last_point_y, 0);
139 p->start = Fmake_marker (); 142 p->start = Fmake_marker ();
140 p->pointm = Fmake_marker (); 143 p->pointm = Fmake_marker ();
141 XFASTINT (p->use_time) = 0; 144 XSETFASTINT (p->use_time, 0);
142 p->frame = Qnil; 145 p->frame = Qnil;
143 p->display_table = Qnil; 146 p->display_table = Qnil;
144 p->dedicated = Qnil; 147 p->dedicated = Qnil;
145 return val; 148 return val;
146 } 149 }
293 register Lisp_Object window, ncol; 296 register Lisp_Object window, ncol;
294 { 297 {
295 register struct window *w; 298 register struct window *w;
296 299
297 CHECK_NUMBER (ncol, 1); 300 CHECK_NUMBER (ncol, 1);
298 if (XINT (ncol) < 0) XFASTINT (ncol) = 0; 301 if (XINT (ncol) < 0) XSETFASTINT (ncol, 0);
299 if (XFASTINT (ncol) >= (1 << (SHORTBITS - 1))) 302 if (XFASTINT (ncol) >= (1 << (SHORTBITS - 1)))
300 args_out_of_range (ncol, Qnil); 303 args_out_of_range (ncol, Qnil);
301 w = decode_window (window); 304 w = decode_window (window);
302 if (XINT (w->hscroll) != XINT (ncol)) 305 if (XINT (w->hscroll) != XINT (ncol))
303 clip_changed = 1; /* Prevent redisplay shortcuts */ 306 clip_changed = 1; /* Prevent redisplay shortcuts */
558 /* this is not right, but much easier than doing what is right. */ 561 /* this is not right, but much easier than doing what is right. */
559 w->start_at_line_beg = Qnil; 562 w->start_at_line_beg = Qnil;
560 if (NILP (noforce)) 563 if (NILP (noforce))
561 w->force_start = Qt; 564 w->force_start = Qt;
562 w->update_mode_line = Qt; 565 w->update_mode_line = Qt;
563 XFASTINT (w->last_modified) = 0; 566 XSETFASTINT (w->last_modified, 0);
564 if (!EQ (window, selected_window)) 567 if (!EQ (window, selected_window))
565 windows_or_buffers_changed++; 568 windows_or_buffers_changed++;
566 return pos; 569 return pos;
567 } 570 }
568 571
1597 { 1600 {
1598 Fdelete_window (window); 1601 Fdelete_window (window);
1599 return; 1602 return;
1600 } 1603 }
1601 1604
1602 XFASTINT (w->last_modified) = 0; 1605 XSETFASTINT (w->last_modified, 0);
1603 windows_or_buffers_changed++; 1606 windows_or_buffers_changed++;
1604 XFASTINT (w->height) = height; 1607 XSETFASTINT (w->height, height);
1605 if (!NILP (w->hchild)) 1608 if (!NILP (w->hchild))
1606 { 1609 {
1607 for (child = w->hchild; !NILP (child); child = XWINDOW (child)->next) 1610 for (child = w->hchild; !NILP (child); child = XWINDOW (child)->next)
1608 { 1611 {
1609 XWINDOW (child)->top = w->top; 1612 XWINDOW (child)->top = w->top;
1618 { 1621 {
1619 c = XWINDOW (child); 1622 c = XWINDOW (child);
1620 1623
1621 opos = lastobot + XFASTINT (c->height); 1624 opos = lastobot + XFASTINT (c->height);
1622 1625
1623 XFASTINT (c->top) = lastbot; 1626 XSETFASTINT (c->top, lastbot);
1624 1627
1625 pos = (((opos * height) << 1) + oheight) / (oheight << 1); 1628 pos = (((opos * height) << 1) + oheight) / (oheight << 1);
1626 1629
1627 /* Avoid confusion: inhibit deletion of child if becomes too small */ 1630 /* Avoid confusion: inhibit deletion of child if becomes too small */
1628 set_window_height (child, pos + top - lastbot, 1); 1631 set_window_height (child, pos + top - lastbot, 1);
1658 { 1661 {
1659 Fdelete_window (window); 1662 Fdelete_window (window);
1660 return; 1663 return;
1661 } 1664 }
1662 1665
1663 XFASTINT (w->last_modified) = 0; 1666 XSETFASTINT (w->last_modified, 0);
1664 windows_or_buffers_changed++; 1667 windows_or_buffers_changed++;
1665 XFASTINT (w->width) = width; 1668 XSETFASTINT (w->width, width);
1666 if (!NILP (w->vchild)) 1669 if (!NILP (w->vchild))
1667 { 1670 {
1668 for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next) 1671 for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next)
1669 { 1672 {
1670 XWINDOW (child)->left = w->left; 1673 XWINDOW (child)->left = w->left;
1679 { 1682 {
1680 c = XWINDOW (child); 1683 c = XWINDOW (child);
1681 1684
1682 opos = lastoright + XFASTINT (c->width); 1685 opos = lastoright + XFASTINT (c->width);
1683 1686
1684 XFASTINT (c->left) = lastright; 1687 XSETFASTINT (c->left, lastright);
1685 1688
1686 pos = (((opos * width) << 1) + owidth) / (owidth << 1); 1689 pos = (((opos * width) << 1) + owidth) / (owidth << 1);
1687 1690
1688 /* Inhibit deletion for becoming too small */ 1691 /* Inhibit deletion for becoming too small */
1689 set_window_width (child, pos + left - lastright, 1); 1692 set_window_width (child, pos + left - lastright, 1);
1730 1733
1731 unshow_buffer (w); 1734 unshow_buffer (w);
1732 } 1735 }
1733 1736
1734 w->buffer = buffer; 1737 w->buffer = buffer;
1735 XFASTINT (w->window_end_pos) = 0; 1738 XSETFASTINT (w->window_end_pos, 0);
1736 w->window_end_valid = Qnil; 1739 w->window_end_valid = Qnil;
1737 XFASTINT(w->hscroll) = 0; 1740 XSETFASTINT(w->hscroll, 0);
1738 Fset_marker (w->pointm, 1741 Fset_marker (w->pointm,
1739 make_number (BUF_PT (XBUFFER (buffer))), 1742 make_number (BUF_PT (XBUFFER (buffer))),
1740 buffer); 1743 buffer);
1741 set_marker_restricted (w->start, 1744 set_marker_restricted (w->start,
1742 make_number (XBUFFER (buffer)->last_window_start), 1745 make_number (XBUFFER (buffer)->last_window_start),
1743 buffer); 1746 buffer);
1744 w->start_at_line_beg = Qnil; 1747 w->start_at_line_beg = Qnil;
1745 w->force_start = Qnil; 1748 w->force_start = Qnil;
1746 XFASTINT (w->last_modified) = 0; 1749 XSETFASTINT (w->last_modified, 0);
1747 windows_or_buffers_changed++; 1750 windows_or_buffers_changed++;
1748 if (EQ (window, selected_window)) 1751 if (EQ (window, selected_window))
1749 Fset_buffer (buffer); 1752 Fset_buffer (buffer);
1750 1753
1751 return Qnil; 1754 return Qnil;
1766 w = XWINDOW (window); 1769 w = XWINDOW (window);
1767 1770
1768 if (NILP (w->buffer)) 1771 if (NILP (w->buffer))
1769 error ("Trying to select deleted window or non-leaf window"); 1772 error ("Trying to select deleted window or non-leaf window");
1770 1773
1771 XFASTINT (w->use_time) = ++window_select_count; 1774 XSETFASTINT (w->use_time, ++window_select_count);
1772 if (EQ (window, selected_window)) 1775 if (EQ (window, selected_window))
1773 return window; 1776 return window;
1774 1777
1775 Fset_marker (ow->pointm, make_number (BUF_PT (XBUFFER (ow->buffer))), 1778 Fset_marker (ow->pointm, make_number (BUF_PT (XBUFFER (ow->buffer))),
1776 ow->buffer); 1779 ow->buffer);
2002 if (XFRAME (XWINDOW (window)->frame) != selected_frame) 2005 if (XFRAME (XWINDOW (window)->frame) != selected_frame)
2003 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); 2006 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
2004 #endif /* MULTI_FRAME */ 2007 #endif /* MULTI_FRAME */
2005 Vminibuf_scroll_window = window; 2008 Vminibuf_scroll_window = window;
2006 w = XWINDOW (window); 2009 w = XWINDOW (window);
2007 XFASTINT (w->hscroll) = 0; 2010 XSETFASTINT (w->hscroll, 0);
2008 set_marker_restricted (w->start, make_number (1), buf); 2011 set_marker_restricted (w->start, make_number (1), buf);
2009 set_marker_restricted (w->pointm, make_number (1), buf); 2012 set_marker_restricted (w->pointm, make_number (1), buf);
2010 } 2013 }
2011 } 2014 }
2012 2015
2022 new = Fcopy_sequence (old); 2025 new = Fcopy_sequence (old);
2023 XSETTYPE (new, Lisp_Window); 2026 XSETTYPE (new, Lisp_Window);
2024 2027
2025 o = XWINDOW (old); 2028 o = XWINDOW (old);
2026 p = XWINDOW (new); 2029 p = XWINDOW (new);
2027 XFASTINT (p->sequence_number) = ++sequence_number; 2030 XSETFASTINT (p->sequence_number, ++sequence_number);
2028 2031
2029 /* Put new into window structure in place of window */ 2032 /* Put new into window structure in place of window */
2030 replace_window (window, new); 2033 replace_window (window, new);
2031 2034
2032 o->next = Qnil; 2035 o->next = Qnil;
2131 2134
2132 if (!NILP (horflag)) 2135 if (!NILP (horflag))
2133 { 2136 {
2134 p->height = o->height; 2137 p->height = o->height;
2135 p->top = o->top; 2138 p->top = o->top;
2136 XFASTINT (p->width) = XFASTINT (o->width) - size; 2139 XSETFASTINT (p->width, XFASTINT (o->width) - size);
2137 XFASTINT (o->width) = size; 2140 XSETFASTINT (o->width, size);
2138 XFASTINT (p->left) = XFASTINT (o->left) + size; 2141 XSETFASTINT (p->left, XFASTINT (o->left) + size);
2139 } 2142 }
2140 else 2143 else
2141 { 2144 {
2142 p->left = o->left; 2145 p->left = o->left;
2143 p->width = o->width; 2146 p->width = o->width;
2144 XFASTINT (p->height) = XFASTINT (o->height) - size; 2147 XSETFASTINT (p->height, XFASTINT (o->height) - size);
2145 XFASTINT (o->height) = size; 2148 XSETFASTINT (o->height, size);
2146 XFASTINT (p->top) = XFASTINT (o->top) + size; 2149 XSETFASTINT (p->top, XFASTINT (o->top) + size);
2147 } 2150 }
2148 2151
2149 return new; 2152 return new;
2150 } 2153 }
2151 2154
2307 Delta1 was calculated so this makes this window the desired size, 2310 Delta1 was calculated so this makes this window the desired size,
2308 taking it all out of the siblings. */ 2311 taking it all out of the siblings. */
2309 (*setsizefun) (parent, opht, 0); 2312 (*setsizefun) (parent, opht, 0);
2310 } 2313 }
2311 2314
2312 XFASTINT (p->last_modified) = 0; 2315 XSETFASTINT (p->last_modified, 0);
2313 } 2316 }
2314 #undef MINSIZE 2317 #undef MINSIZE
2315 #undef CURBEG 2318 #undef CURBEG
2316 #undef CURSIZE 2319 #undef CURSIZE
2317 2320
2379 register int ht = window_internal_height (w); 2382 register int ht = window_internal_height (w);
2380 register Lisp_Object tem; 2383 register Lisp_Object tem;
2381 int lose; 2384 int lose;
2382 Lisp_Object bolp, nmoved; 2385 Lisp_Object bolp, nmoved;
2383 2386
2384 XFASTINT (tem) = PT; 2387 XSETFASTINT (tem, PT);
2385 tem = Fpos_visible_in_window_p (tem, window); 2388 tem = Fpos_visible_in_window_p (tem, window);
2386 2389
2387 if (NILP (tem)) 2390 if (NILP (tem))
2388 { 2391 {
2389 Fvertical_motion (make_number (- (ht / 2)), window); 2392 Fvertical_motion (make_number (- (ht / 2)), window);
2390 XFASTINT (tem) = PT; 2393 XSETFASTINT (tem, PT);
2391 Fset_marker (w->start, tem, w->buffer); 2394 Fset_marker (w->start, tem, w->buffer);
2392 w->force_start = Qt; 2395 w->force_start = Qt;
2393 } 2396 }
2394 2397
2395 SET_PT (marker_position (w->start)); 2398 SET_PT (marker_position (w->start));
2410 if (pos < ZV) 2413 if (pos < ZV)
2411 { 2414 {
2412 set_marker_restricted (w->start, make_number (pos), w->buffer); 2415 set_marker_restricted (w->start, make_number (pos), w->buffer);
2413 w->start_at_line_beg = bolp; 2416 w->start_at_line_beg = bolp;
2414 w->update_mode_line = Qt; 2417 w->update_mode_line = Qt;
2415 XFASTINT (w->last_modified) = 0; 2418 XSETFASTINT (w->last_modified, 0);
2416 if (pos > opoint) 2419 if (pos > opoint)
2417 SET_PT (pos); 2420 SET_PT (pos);
2418 if (n < 0) 2421 if (n < 0)
2419 { 2422 {
2420 SET_PT (pos); 2423 SET_PT (pos);
2589 (arg) 2592 (arg)
2590 register Lisp_Object arg; 2593 register Lisp_Object arg;
2591 { 2594 {
2592 2595
2593 if (NILP (arg)) 2596 if (NILP (arg))
2594 XFASTINT (arg) = window_internal_width (XWINDOW (selected_window)) - 2; 2597 XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2);
2595 else 2598 else
2596 arg = Fprefix_numeric_value (arg); 2599 arg = Fprefix_numeric_value (arg);
2597 2600
2598 return 2601 return
2599 Fset_window_hscroll (selected_window, 2602 Fset_window_hscroll (selected_window,
2606 Default for ARG is window width minus 2.") 2609 Default for ARG is window width minus 2.")
2607 (arg) 2610 (arg)
2608 register Lisp_Object arg; 2611 register Lisp_Object arg;
2609 { 2612 {
2610 if (NILP (arg)) 2613 if (NILP (arg))
2611 XFASTINT (arg) = window_internal_width (XWINDOW (selected_window)) - 2; 2614 XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2);
2612 else 2615 else
2613 arg = Fprefix_numeric_value (arg); 2616 arg = Fprefix_numeric_value (arg);
2614 2617
2615 return 2618 return
2616 Fset_window_hscroll (selected_window, 2619 Fset_window_hscroll (selected_window,
2635 if (NILP (n)) 2638 if (NILP (n))
2636 { 2639 {
2637 extern int frame_garbaged; 2640 extern int frame_garbaged;
2638 2641
2639 SET_FRAME_GARBAGED (XFRAME (WINDOW_FRAME (w))); 2642 SET_FRAME_GARBAGED (XFRAME (WINDOW_FRAME (w)));
2640 XFASTINT (n) = ht / 2; 2643 XSETFASTINT (n, ht / 2);
2641 } 2644 }
2642 else if (CONSP (n)) /* Just C-u. */ 2645 else if (CONSP (n)) /* Just C-u. */
2643 { 2646 {
2644 XFASTINT (n) = ht / 2; 2647 XSETFASTINT (n, ht / 2);
2645 } 2648 }
2646 else 2649 else
2647 { 2650 {
2648 n = Fprefix_numeric_value (n); 2651 n = Fprefix_numeric_value (n);
2649 CHECK_NUMBER (n, 0); 2652 CHECK_NUMBER (n, 0);
2678 register int height = window_internal_height (w); 2681 register int height = window_internal_height (w);
2679 register int start; 2682 register int start;
2680 Lisp_Object window; 2683 Lisp_Object window;
2681 2684
2682 if (NILP (arg)) 2685 if (NILP (arg))
2683 XFASTINT (arg) = height / 2; 2686 XSETFASTINT (arg, height / 2);
2684 else 2687 else
2685 { 2688 {
2686 arg = Fprefix_numeric_value (arg); 2689 arg = Fprefix_numeric_value (arg);
2687 if (XINT (arg) < 0) 2690 if (XINT (arg) < 0)
2688 XSETINT (arg, XINT (arg) + height); 2691 XSETINT (arg, XINT (arg) + height);
2874 w->top = p->top; 2877 w->top = p->top;
2875 w->width = p->width; 2878 w->width = p->width;
2876 w->height = p->height; 2879 w->height = p->height;
2877 w->hscroll = p->hscroll; 2880 w->hscroll = p->hscroll;
2878 w->display_table = p->display_table; 2881 w->display_table = p->display_table;
2879 XFASTINT (w->last_modified) = 0; 2882 XSETFASTINT (w->last_modified, 0);
2880 2883
2881 /* Reinstall the saved buffer and pointers into it. */ 2884 /* Reinstall the saved buffer and pointers into it. */
2882 if (NILP (p->buffer)) 2885 if (NILP (p->buffer))
2883 w->buffer = p->buffer; 2886 w->buffer = p->buffer;
2884 else 2887 else
3034 for (;!NILP (window); window = w->next) 3037 for (;!NILP (window); window = w->next)
3035 { 3038 {
3036 p = SAVED_WINDOW_N (vector, i); 3039 p = SAVED_WINDOW_N (vector, i);
3037 w = XWINDOW (window); 3040 w = XWINDOW (window);
3038 3041
3039 XFASTINT (w->temslot) = i++; 3042 XSETFASTINT (w->temslot, i++);
3040 p->window = window; 3043 p->window = window;
3041 p->buffer = w->buffer; 3044 p->buffer = w->buffer;
3042 p->left = w->left; 3045 p->left = w->left;
3043 p->top = w->top; 3046 p->top = w->top;
3044 p->width = w->width; 3047 p->width = w->width;
3121 3124
3122 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); 3125 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
3123 data = (struct save_window_data *) 3126 data = (struct save_window_data *)
3124 XVECTOR (Fmake_vector (make_number (SAVE_WINDOW_DATA_SIZE), 3127 XVECTOR (Fmake_vector (make_number (SAVE_WINDOW_DATA_SIZE),
3125 Qnil)); 3128 Qnil));
3126 XFASTINT (data->frame_width) = FRAME_WIDTH (f); 3129 XSETFASTINT (data->frame_width, FRAME_WIDTH (f));
3127 XFASTINT (data->frame_height) = FRAME_HEIGHT (f); 3130 XSETFASTINT (data->frame_height, FRAME_HEIGHT (f));
3128 XFASTINT (data->frame_menu_bar_lines) = FRAME_MENU_BAR_LINES (f); 3131 XSETFASTINT (data->frame_menu_bar_lines, FRAME_MENU_BAR_LINES (f));
3129 #ifdef MULTI_FRAME 3132 #ifdef MULTI_FRAME
3130 XSETFRAME (data->selected_frame, selected_frame); 3133 XSETFRAME (data->selected_frame, selected_frame);
3131 #endif 3134 #endif
3132 data->current_window = FRAME_SELECTED_WINDOW (f); 3135 data->current_window = FRAME_SELECTED_WINDOW (f);
3133 XSETBUFFER (data->current_buffer, current_buffer); 3136 XSETBUFFER (data->current_buffer, current_buffer);
3186 3189
3187 /* These values 9 and 10 are arbitrary, 3190 /* These values 9 and 10 are arbitrary,
3188 just so that there is "something there." 3191 just so that there is "something there."
3189 Correct values are put in in init_xdisp */ 3192 Correct values are put in in init_xdisp */
3190 3193
3191 XFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->width) = 10; 3194 XSETFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->width, 10);
3192 XFASTINT (XWINDOW (minibuf_window)->width) = 10; 3195 XSETFASTINT (XWINDOW (minibuf_window)->width, 10);
3193 3196
3194 XFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->height) = 9; 3197 XSETFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->height, 9);
3195 XFASTINT (XWINDOW (minibuf_window)->top) = 9; 3198 XSETFASTINT (XWINDOW (minibuf_window)->top, 9);
3196 XFASTINT (XWINDOW (minibuf_window)->height) = 1; 3199 XSETFASTINT (XWINDOW (minibuf_window)->height, 1);
3197 3200
3198 /* Prevent error in Fset_window_buffer. */ 3201 /* Prevent error in Fset_window_buffer. */
3199 XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->buffer = Qt; 3202 XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->buffer = Qt;
3200 XWINDOW (minibuf_window)->buffer = Qt; 3203 XWINDOW (minibuf_window)->buffer = Qt;
3201 3204
3207 selected_window = FRAME_ROOT_WINDOW (selected_frame); 3210 selected_window = FRAME_ROOT_WINDOW (selected_frame);
3208 /* Make sure this window seems more recently used than 3211 /* Make sure this window seems more recently used than
3209 a newly-created, never-selected window. Increment 3212 a newly-created, never-selected window. Increment
3210 window_select_count so the first selection ever will get 3213 window_select_count so the first selection ever will get
3211 something newer than this. */ 3214 something newer than this. */
3212 XFASTINT (XWINDOW (selected_window)->use_time) = ++window_select_count; 3215 XSETFASTINT (XWINDOW (selected_window)->use_time, ++window_select_count);
3213 #endif /* not MULTI_FRAME */ 3216 #endif /* not MULTI_FRAME */
3214 } 3217 }
3215 3218
3216 syms_of_window () 3219 syms_of_window ()
3217 { 3220 {