aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c114
1 files changed, 57 insertions, 57 deletions
diff --git a/src/window.c b/src/window.c
index ebfe318defd..93f763ec9af 100644
--- a/src/window.c
+++ b/src/window.c
@@ -84,8 +84,8 @@ static int foreach_window_1 (struct window *,
84 int (* fn) (struct window *, void *), 84 int (* fn) (struct window *, void *),
85 void *); 85 void *);
86static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object); 86static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object);
87static int resize_window_check (struct window *, int); 87static int window_resize_check (struct window *, int);
88static void resize_window_apply (struct window *, int); 88static void window_resize_apply (struct window *, int);
89static Lisp_Object select_window (Lisp_Object, Lisp_Object, int); 89static Lisp_Object select_window (Lisp_Object, Lisp_Object, int);
90 90
91/* This is the window in which the terminal's cursor should 91/* This is the window in which the terminal's cursor should
@@ -436,37 +436,37 @@ Return nil if WINDOW has no parent. */)
436 return decode_any_window (window)->parent; 436 return decode_any_window (window)->parent;
437} 437}
438 438
439DEFUN ("window-vchild", Fwindow_vchild, Swindow_vchild, 0, 1, 0, 439DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 0, 1, 0,
440 doc: /* Return WINDOW's first vertical child window. 440 doc: /* Return WINDOW's topmost child window.
441WINDOW can be any window and defaults to the selected one. 441WINDOW can be any window and defaults to the selected one.
442Return nil if WINDOW has no vertical child. */) 442Return nil if WINDOW is not a vertical combination. */)
443 (Lisp_Object window) 443 (Lisp_Object window)
444{ 444{
445 return decode_any_window (window)->vchild; 445 return decode_any_window (window)->vchild;
446} 446}
447 447
448DEFUN ("window-hchild", Fwindow_hchild, Swindow_hchild, 0, 1, 0, 448DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0,
449 doc: /* Return WINDOW's first horizontal child window. 449 doc: /* Return WINDOW's leftmost child window.
450WINDOW can be any window and defaults to the selected one. 450WINDOW can be any window and defaults to the selected one.
451Return nil if WINDOW has no horizontal child. */) 451Return nil if WINDOW is not a horizontal combination. */)
452 (Lisp_Object window) 452 (Lisp_Object window)
453{ 453{
454 return decode_any_window (window)->hchild; 454 return decode_any_window (window)->hchild;
455} 455}
456 456
457DEFUN ("window-next", Fwindow_next, Swindow_next, 0, 1, 0, 457DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0,
458 doc: /* Return WINDOW's right sibling window. 458 doc: /* Return WINDOW's next sibling window.
459WINDOW can be any window and defaults to the selected one. 459WINDOW can be any window and defaults to the selected one.
460Return nil if WINDOW has no right sibling. */) 460Return nil if WINDOW has no next sibling. */)
461 (Lisp_Object window) 461 (Lisp_Object window)
462{ 462{
463 return decode_any_window (window)->next; 463 return decode_any_window (window)->next;
464} 464}
465 465
466DEFUN ("window-prev", Fwindow_prev, Swindow_prev, 0, 1, 0, 466DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0,
467 doc: /* Return WINDOW's left sibling window. 467 doc: /* Return WINDOW's previous sibling window.
468WINDOW can be any window and defaults to the selected one. 468WINDOW can be any window and defaults to the selected one.
469Return nil if WINDOW has no left sibling. */) 469Return nil if WINDOW has no previous sibling. */)
470 (Lisp_Object window) 470 (Lisp_Object window)
471{ 471{
472 return decode_any_window (window)->prev; 472 return decode_any_window (window)->prev;
@@ -2697,13 +2697,13 @@ window-start value is reasonable when this function is called. */)
2697 XSETINT (delta, XINT (r->total_lines) - XINT (w->total_lines)); 2697 XSETINT (delta, XINT (r->total_lines) - XINT (w->total_lines));
2698 w->top_line = r->top_line; 2698 w->top_line = r->top_line;
2699 resize_root_window (window, delta, Qnil, Qnil); 2699 resize_root_window (window, delta, Qnil, Qnil);
2700 if (resize_window_check (w, 0)) 2700 if (window_resize_check (w, 0))
2701 resize_window_apply (w, 0); 2701 window_resize_apply (w, 0);
2702 else 2702 else
2703 { 2703 {
2704 resize_root_window (window, delta, Qnil, Qt); 2704 resize_root_window (window, delta, Qnil, Qt);
2705 if (resize_window_check (w, 0)) 2705 if (window_resize_check (w, 0))
2706 resize_window_apply (w, 0); 2706 window_resize_apply (w, 0);
2707 else 2707 else
2708 resize_failed = 1; 2708 resize_failed = 1;
2709 } 2709 }
@@ -2715,13 +2715,13 @@ window-start value is reasonable when this function is called. */)
2715 XSETINT (delta, XINT (r->total_cols) - XINT (w->total_cols)); 2715 XSETINT (delta, XINT (r->total_cols) - XINT (w->total_cols));
2716 w->left_col = r->left_col; 2716 w->left_col = r->left_col;
2717 resize_root_window (window, delta, Qt, Qnil); 2717 resize_root_window (window, delta, Qt, Qnil);
2718 if (resize_window_check (w, 1)) 2718 if (window_resize_check (w, 1))
2719 resize_window_apply (w, 1); 2719 window_resize_apply (w, 1);
2720 else 2720 else
2721 { 2721 {
2722 resize_root_window (window, delta, Qt, Qt); 2722 resize_root_window (window, delta, Qt, Qt);
2723 if (resize_window_check (w, 1)) 2723 if (window_resize_check (w, 1))
2724 resize_window_apply (w, 1); 2724 window_resize_apply (w, 1);
2725 else 2725 else
2726 resize_failed = 1; 2726 resize_failed = 1;
2727 } 2727 }
@@ -3417,7 +3417,7 @@ Note: This function does not operate on any subwindows of WINDOW. */)
3417 `window-min-height' or `window-min-width'. It does check that window 3417 `window-min-height' or `window-min-width'. It does check that window
3418 sizes do not drop below one line (two columns). */ 3418 sizes do not drop below one line (two columns). */
3419static int 3419static int
3420resize_window_check (struct window *w, int horflag) 3420window_resize_check (struct window *w, int horflag)
3421{ 3421{
3422 struct window *c; 3422 struct window *c;
3423 3423
@@ -3431,7 +3431,7 @@ resize_window_check (struct window *w, int horflag)
3431 while (c) 3431 while (c)
3432 { 3432 {
3433 if ((XINT (c->new_total) != XINT (w->new_total)) 3433 if ((XINT (c->new_total) != XINT (w->new_total))
3434 || !resize_window_check (c, horflag)) 3434 || !window_resize_check (c, horflag))
3435 return 0; 3435 return 0;
3436 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3436 c = NILP (c->next) ? 0 : XWINDOW (c->next);
3437 } 3437 }
@@ -3444,7 +3444,7 @@ resize_window_check (struct window *w, int horflag)
3444 int sum_of_sizes = 0; 3444 int sum_of_sizes = 0;
3445 while (c) 3445 while (c)
3446 { 3446 {
3447 if (!resize_window_check (c, horflag)) 3447 if (!window_resize_check (c, horflag))
3448 return 0; 3448 return 0;
3449 sum_of_sizes = sum_of_sizes + XINT (c->new_total); 3449 sum_of_sizes = sum_of_sizes + XINT (c->new_total);
3450 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3450 c = NILP (c->next) ? 0 : XWINDOW (c->next);
@@ -3463,7 +3463,7 @@ resize_window_check (struct window *w, int horflag)
3463 int sum_of_sizes = 0; 3463 int sum_of_sizes = 0;
3464 while (c) 3464 while (c)
3465 { 3465 {
3466 if (!resize_window_check (c, horflag)) 3466 if (!window_resize_check (c, horflag))
3467 return 0; 3467 return 0;
3468 sum_of_sizes = sum_of_sizes + XINT (c->new_total); 3468 sum_of_sizes = sum_of_sizes + XINT (c->new_total);
3469 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3469 c = NILP (c->next) ? 0 : XWINDOW (c->next);
@@ -3476,7 +3476,7 @@ resize_window_check (struct window *w, int horflag)
3476 while (c) 3476 while (c)
3477 { 3477 {
3478 if ((XINT (c->new_total) != XINT (w->new_total)) 3478 if ((XINT (c->new_total) != XINT (w->new_total))
3479 || !resize_window_check (c, horflag)) 3479 || !window_resize_check (c, horflag))
3480 return 0; 3480 return 0;
3481 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3481 c = NILP (c->next) ? 0 : XWINDOW (c->next);
3482 } 3482 }
@@ -3496,9 +3496,9 @@ resize_window_check (struct window *w, int horflag)
3496 each of these windows. 3496 each of these windows.
3497 3497
3498 This function does not perform any error checks. Make sure you have 3498 This function does not perform any error checks. Make sure you have
3499 run resize_window_check on W before applying this function. */ 3499 run window_resize_check on W before applying this function. */
3500static void 3500static void
3501resize_window_apply (struct window *w, int horflag) 3501window_resize_apply (struct window *w, int horflag)
3502{ 3502{
3503 struct window *c; 3503 struct window *c;
3504 int pos; 3504 int pos;
@@ -3532,7 +3532,7 @@ resize_window_apply (struct window *w, int horflag)
3532 XSETFASTINT (c->left_col, pos); 3532 XSETFASTINT (c->left_col, pos);
3533 else 3533 else
3534 XSETFASTINT (c->top_line, pos); 3534 XSETFASTINT (c->top_line, pos);
3535 resize_window_apply (c, horflag); 3535 window_resize_apply (c, horflag);
3536 if (!horflag) 3536 if (!horflag)
3537 pos = pos + XINT (c->total_lines); 3537 pos = pos + XINT (c->total_lines);
3538 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3538 c = NILP (c->next) ? 0 : XWINDOW (c->next);
@@ -3548,7 +3548,7 @@ resize_window_apply (struct window *w, int horflag)
3548 XSETFASTINT (c->left_col, pos); 3548 XSETFASTINT (c->left_col, pos);
3549 else 3549 else
3550 XSETFASTINT (c->top_line, pos); 3550 XSETFASTINT (c->top_line, pos);
3551 resize_window_apply (c, horflag); 3551 window_resize_apply (c, horflag);
3552 if (horflag) 3552 if (horflag)
3553 pos = pos + XINT (c->total_cols); 3553 pos = pos + XINT (c->total_cols);
3554 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3554 c = NILP (c->next) ? 0 : XWINDOW (c->next);
@@ -3561,7 +3561,7 @@ resize_window_apply (struct window *w, int horflag)
3561} 3561}
3562 3562
3563 3563
3564DEFUN ("resize-window-apply", Fresize_window_apply, Sresize_window_apply, 1, 2, 0, 3564DEFUN ("window-resize-apply", Fwindow_resize_apply, Swindow_resize_apply, 1, 2, 0,
3565 doc: /* Apply requested size values for window-tree of FRAME. 3565 doc: /* Apply requested size values for window-tree of FRAME.
3566Optional argument HORIZONTAL omitted or nil means apply requested height 3566Optional argument HORIZONTAL omitted or nil means apply requested height
3567values. HORIZONTAL non-nil means apply requested width values. 3567values. HORIZONTAL non-nil means apply requested width values.
@@ -3586,12 +3586,12 @@ be applied on the Elisp level. */)
3586 f = XFRAME (frame); 3586 f = XFRAME (frame);
3587 r = XWINDOW (FRAME_ROOT_WINDOW (f)); 3587 r = XWINDOW (FRAME_ROOT_WINDOW (f));
3588 3588
3589 if (!resize_window_check (r, horflag) 3589 if (!window_resize_check (r, horflag)
3590 || ! EQ (r->new_total, (horflag ? r->total_cols : r->total_lines))) 3590 || ! EQ (r->new_total, (horflag ? r->total_cols : r->total_lines)))
3591 return Qnil; 3591 return Qnil;
3592 3592
3593 BLOCK_INPUT; 3593 BLOCK_INPUT;
3594 resize_window_apply (r, horflag); 3594 window_resize_apply (r, horflag);
3595 3595
3596 windows_or_buffers_changed++; 3596 windows_or_buffers_changed++;
3597 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 3597 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
@@ -3643,22 +3643,22 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3643 XSETINT (delta, new_size - old_size); 3643 XSETINT (delta, new_size - old_size);
3644 /* Try a "normal" resize first. */ 3644 /* Try a "normal" resize first. */
3645 resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil); 3645 resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil);
3646 if (resize_window_check (r, horflag) && new_size == XINT (r->new_total)) 3646 if (window_resize_check (r, horflag) && new_size == XINT (r->new_total))
3647 resize_window_apply (r, horflag); 3647 window_resize_apply (r, horflag);
3648 else 3648 else
3649 { 3649 {
3650 /* Try with "reasonable" minimum sizes next. */ 3650 /* Try with "reasonable" minimum sizes next. */
3651 resize_root_window (root, delta, horflag ? Qt : Qnil, Qt); 3651 resize_root_window (root, delta, horflag ? Qt : Qnil, Qt);
3652 if (resize_window_check (r, horflag) 3652 if (window_resize_check (r, horflag)
3653 && new_size == XINT (r->new_total)) 3653 && new_size == XINT (r->new_total))
3654 resize_window_apply (r, horflag); 3654 window_resize_apply (r, horflag);
3655 else 3655 else
3656 { 3656 {
3657 /* Finally, try with "safe" minimum sizes. */ 3657 /* Finally, try with "safe" minimum sizes. */
3658 resize_root_window (root, delta, horflag ? Qt : Qnil, Qsafe); 3658 resize_root_window (root, delta, horflag ? Qt : Qnil, Qsafe);
3659 if (resize_window_check (r, horflag) 3659 if (window_resize_check (r, horflag)
3660 && new_size == XINT (r->new_total)) 3660 && new_size == XINT (r->new_total))
3661 resize_window_apply (r, horflag); 3661 window_resize_apply (r, horflag);
3662 else 3662 else
3663 { 3663 {
3664 /* We lost. Delete all windows but the frame's 3664 /* We lost. Delete all windows but the frame's
@@ -3767,7 +3767,7 @@ set correctly. See the code of `split-window' for how this is done. */)
3767 XSETINT (p->new_total, 3767 XSETINT (p->new_total,
3768 XINT (horflag ? p->total_cols : p->total_lines) 3768 XINT (horflag ? p->total_cols : p->total_lines)
3769 - XINT (total_size)); 3769 - XINT (total_size));
3770 if (!resize_window_check (p, horflag)) 3770 if (!window_resize_check (p, horflag))
3771 error ("Window sizes don't fit"); 3771 error ("Window sizes don't fit");
3772 else 3772 else
3773 /* Undo the temporary pretension. */ 3773 /* Undo the temporary pretension. */
@@ -3775,7 +3775,7 @@ set correctly. See the code of `split-window' for how this is done. */)
3775 } 3775 }
3776 else 3776 else
3777 { 3777 {
3778 if (!resize_window_check (o, horflag)) 3778 if (!window_resize_check (o, horflag))
3779 error ("Resizing old window failed"); 3779 error ("Resizing old window failed");
3780 else if (XINT (total_size) + XINT (o->new_total) 3780 else if (XINT (total_size) + XINT (o->new_total)
3781 != XINT (horflag ? o->total_cols : o->total_lines)) 3781 != XINT (horflag ? o->total_cols : o->total_lines))
@@ -3863,13 +3863,13 @@ set correctly. See the code of `split-window' for how this is done. */)
3863 n->total_cols = o->total_cols; 3863 n->total_cols = o->total_cols;
3864 } 3864 }
3865 3865
3866 /* Iso-coordinates and sizes are assigned by resize_window_apply, 3866 /* Iso-coordinates and sizes are assigned by window_resize_apply,
3867 get them ready here. */ 3867 get them ready here. */
3868 n->new_total = total_size; 3868 n->new_total = total_size;
3869 n->new_normal = normal_size; 3869 n->new_normal = normal_size;
3870 3870
3871 BLOCK_INPUT; 3871 BLOCK_INPUT;
3872 resize_window_apply (p, horflag); 3872 window_resize_apply (p, horflag);
3873 adjust_glyphs (f); 3873 adjust_glyphs (f);
3874 /* Set buffer of NEW to buffer of reference window. Don't run 3874 /* Set buffer of NEW to buffer of reference window. Don't run
3875 any hooks. */ 3875 any hooks. */
@@ -3947,13 +3947,13 @@ when WINDOW is the only window on its frame. */)
3947 XWINDOW (s->next)->prev = sibling; 3947 XWINDOW (s->next)->prev = sibling;
3948 } 3948 }
3949 3949
3950 if (resize_window_check (r, horflag) 3950 if (window_resize_check (r, horflag)
3951 && EQ (r->new_total, (horflag ? r->total_cols : r->total_lines))) 3951 && EQ (r->new_total, (horflag ? r->total_cols : r->total_lines)))
3952 /* We can delete WINDOW now. */ 3952 /* We can delete WINDOW now. */
3953 { 3953 {
3954 /* Block input. */ 3954 /* Block input. */
3955 BLOCK_INPUT; 3955 BLOCK_INPUT;
3956 resize_window_apply (p, horflag); 3956 window_resize_apply (p, horflag);
3957 3957
3958 windows_or_buffers_changed++; 3958 windows_or_buffers_changed++;
3959 Vwindow_list = Qnil; 3959 Vwindow_list = Qnil;
@@ -4076,10 +4076,10 @@ grow_mini_window (struct window *w, int delta)
4076 root = FRAME_ROOT_WINDOW (f); 4076 root = FRAME_ROOT_WINDOW (f);
4077 r = XWINDOW (root); 4077 r = XWINDOW (root);
4078 value = call2 (Qresize_root_window_vertically, root, make_number (- delta)); 4078 value = call2 (Qresize_root_window_vertically, root, make_number (- delta));
4079 if (INTEGERP (value) && resize_window_check (r, 0)) 4079 if (INTEGERP (value) && window_resize_check (r, 0))
4080 { 4080 {
4081 BLOCK_INPUT; 4081 BLOCK_INPUT;
4082 resize_window_apply (r, 0); 4082 window_resize_apply (r, 0);
4083 4083
4084 /* Grow the mini-window. */ 4084 /* Grow the mini-window. */
4085 XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); 4085 XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines));
@@ -4111,10 +4111,10 @@ shrink_mini_window (struct window *w)
4111 r = XWINDOW (root); 4111 r = XWINDOW (root);
4112 value = call2 (Qresize_root_window_vertically, 4112 value = call2 (Qresize_root_window_vertically,
4113 root, make_number (size - 1)); 4113 root, make_number (size - 1));
4114 if (INTEGERP (value) && resize_window_check (r, 0)) 4114 if (INTEGERP (value) && window_resize_check (r, 0))
4115 { 4115 {
4116 BLOCK_INPUT; 4116 BLOCK_INPUT;
4117 resize_window_apply (r, 0); 4117 window_resize_apply (r, 0);
4118 4118
4119 /* Shrink the mini-window. */ 4119 /* Shrink the mini-window. */
4120 XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); 4120 XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines));
@@ -4152,12 +4152,12 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4152 4152
4153 r = XWINDOW (FRAME_ROOT_WINDOW (f)); 4153 r = XWINDOW (FRAME_ROOT_WINDOW (f));
4154 height = XINT (r->total_lines) + XINT (w->total_lines); 4154 height = XINT (r->total_lines) + XINT (w->total_lines);
4155 if (resize_window_check (r, 0) 4155 if (window_resize_check (r, 0)
4156 && XINT (w->new_total) > 0 4156 && XINT (w->new_total) > 0
4157 && height == XINT (r->new_total) + XINT (w->new_total)) 4157 && height == XINT (r->new_total) + XINT (w->new_total))
4158 { 4158 {
4159 BLOCK_INPUT; 4159 BLOCK_INPUT;
4160 resize_window_apply (r, 0); 4160 window_resize_apply (r, 0);
4161 4161
4162 w->total_lines = w->new_total; 4162 w->total_lines = w->new_total;
4163 XSETFASTINT (w->top_line, XINT (r->top_line) + XINT (r->total_lines)); 4163 XSETFASTINT (w->top_line, XINT (r->top_line) + XINT (r->total_lines));
@@ -6600,10 +6600,10 @@ function `window-nest' and altered by the function `set-window-nest'. */);
6600 defsubr (&Swindow_clone_number); 6600 defsubr (&Swindow_clone_number);
6601 defsubr (&Swindow_buffer); 6601 defsubr (&Swindow_buffer);
6602 defsubr (&Swindow_parent); 6602 defsubr (&Swindow_parent);
6603 defsubr (&Swindow_vchild); 6603 defsubr (&Swindow_top_child);
6604 defsubr (&Swindow_hchild); 6604 defsubr (&Swindow_left_child);
6605 defsubr (&Swindow_next); 6605 defsubr (&Swindow_next_sibling);
6606 defsubr (&Swindow_prev); 6606 defsubr (&Swindow_prev_sibling);
6607 defsubr (&Swindow_splits); 6607 defsubr (&Swindow_splits);
6608 defsubr (&Sset_window_splits); 6608 defsubr (&Sset_window_splits);
6609 defsubr (&Swindow_nest); 6609 defsubr (&Swindow_nest);
@@ -6617,7 +6617,7 @@ function `window-nest' and altered by the function `set-window-nest'. */);
6617 defsubr (&Swindow_new_normal); 6617 defsubr (&Swindow_new_normal);
6618 defsubr (&Sset_window_new_total); 6618 defsubr (&Sset_window_new_total);
6619 defsubr (&Sset_window_new_normal); 6619 defsubr (&Sset_window_new_normal);
6620 defsubr (&Sresize_window_apply); 6620 defsubr (&Swindow_resize_apply);
6621 defsubr (&Swindow_body_size); 6621 defsubr (&Swindow_body_size);
6622 defsubr (&Swindow_hscroll); 6622 defsubr (&Swindow_hscroll);
6623 defsubr (&Sset_window_hscroll); 6623 defsubr (&Sset_window_hscroll);