aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c98
1 files changed, 74 insertions, 24 deletions
diff --git a/src/window.c b/src/window.c
index 623a48d6611..a517b627218 100644
--- a/src/window.c
+++ b/src/window.c
@@ -57,6 +57,9 @@ static int window_min_size_1 P_ ((struct window *, int));
57static int window_min_size P_ ((struct window *, int, int *)); 57static int window_min_size P_ ((struct window *, int, int *));
58static int window_fixed_size_p P_ ((struct window *, int, int)); 58static int window_fixed_size_p P_ ((struct window *, int, int));
59static void size_window P_ ((Lisp_Object, int, int, int)); 59static void size_window P_ ((Lisp_Object, int, int, int));
60static void foreach_window_1 P_ ((struct window *, void (*fn) (), int, int,
61 int, int));
62static void freeze_window_start P_ ((struct window *, int));
60 63
61 64
62/* This is the window in which the terminal's cursor should 65/* This is the window in which the terminal's cursor should
@@ -226,6 +229,7 @@ make_window ()
226 p->vscroll = 0; 229 p->vscroll = 0;
227 XSETWINDOW (val, p); 230 XSETWINDOW (val, p);
228 XSETFASTINT (p->last_point, 0); 231 XSETFASTINT (p->last_point, 0);
232 p->frozen_window_start_p = 0;
229 return val; 233 return val;
230} 234}
231 235
@@ -743,14 +747,6 @@ DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0,
743 Fgoto_char (pos); 747 Fgoto_char (pos);
744 else 748 else
745 set_marker_restricted (w->pointm, pos, w->buffer); 749 set_marker_restricted (w->pointm, pos, w->buffer);
746
747 /* If mini-window is resized, make it not restore its saved window
748 configuration. This function being called indicates that the
749 current window configuration is being changed. These changes
750 would be undone if resize_mini_window would restore its saved
751 configuration. */
752 if (resize_mini_frame == XFRAME (w->frame))
753 Vresize_mini_config = Qnil;
754 750
755 return pos; 751 return pos;
756} 752}
@@ -776,14 +772,6 @@ from overriding motion of point in order to display at this exact start.")
776 if (!EQ (window, selected_window)) 772 if (!EQ (window, selected_window))
777 windows_or_buffers_changed++; 773 windows_or_buffers_changed++;
778 774
779 /* If mini-window is resized, make it not restore its saved window
780 configuration. This function being called indicates that the
781 current window configuration is being changed. These changes
782 would be undone if resize_mini_window would restore its saved
783 configuration. */
784 if (resize_mini_frame == XFRAME (w->frame))
785 Vresize_mini_config = Qnil;
786
787 return pos; 775 return pos;
788} 776}
789 777
@@ -937,6 +925,7 @@ replace_window (old, replacement)
937 XSETFASTINT (p->window_end_vpos, 0); 925 XSETFASTINT (p->window_end_vpos, 0);
938 XSETFASTINT (p->window_end_pos, 0); 926 XSETFASTINT (p->window_end_pos, 0);
939 p->window_end_valid = Qnil; 927 p->window_end_valid = Qnil;
928 p->frozen_window_start_p = 0;
940 929
941 p->next = tem = o->next; 930 p->next = tem = o->next;
942 if (!NILP (tem)) 931 if (!NILP (tem))
@@ -2356,14 +2345,6 @@ set_window_buffer (window, buffer, run_hooks_p)
2356 2345
2357 w->buffer = buffer; 2346 w->buffer = buffer;
2358 2347
2359 /* If mini-window is resized, make it not restore its saved window
2360 configuration. This function being called indicates that the
2361 current window configuration is being changed. These changes
2362 would be undone if resize_mini_window would restore its saved
2363 configuration. */
2364 if (resize_mini_frame == XFRAME (w->frame))
2365 Vresize_mini_config = Qnil;
2366
2367 if (EQ (window, selected_window)) 2348 if (EQ (window, selected_window))
2368 b->last_selected_window = window; 2349 b->last_selected_window = window;
2369 2350
@@ -4712,6 +4693,75 @@ multiple of the canonical character height of WINDOW.")
4712 return Qnil; 4693 return Qnil;
4713} 4694}
4714 4695
4696
4697/* Call FN for all leaf windows on frame F. FN is called with the
4698 first argument being a pointer to the leaf window, and with
4699 additional arguments A1..A4. */
4700
4701void
4702foreach_window (f, fn, a1, a2, a3, a4)
4703 struct frame *f;
4704 void (* fn) ();
4705 int a1, a2, a3, a4;
4706{
4707 foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, a1, a2, a3, a4);
4708}
4709
4710
4711/* Helper function for foreach_window. Call FN for all leaf windows
4712 reachable from W. FN is called with the first argument being a
4713 pointer to the leaf window, and with additional arguments A1..A4. */
4714
4715static void
4716foreach_window_1 (w, fn, a1, a2, a3, a4)
4717 struct window *w;
4718 void (* fn) ();
4719 int a1, a2, a3, a4;
4720{
4721 while (w)
4722 {
4723 if (!NILP (w->hchild))
4724 foreach_window_1 (XWINDOW (w->hchild), fn, a1, a2, a3, a4);
4725 else if (!NILP (w->vchild))
4726 foreach_window_1 (XWINDOW (w->vchild), fn, a1, a2, a3, a4);
4727 else
4728 fn (w, a1, a2, a3, a4);
4729
4730 w = NILP (w->next) ? 0 : XWINDOW (w->next);
4731 }
4732}
4733
4734
4735/* Freeze or unfreeze the window start of W if unless it is a
4736 mini-window or the selected window. FREEZE_P non-zero means freeze
4737 the window start. */
4738
4739static void
4740freeze_window_start (w, freeze_p)
4741 struct window *w;
4742 int freeze_p;
4743{
4744 if (w == XWINDOW (selected_window)
4745 || MINI_WINDOW_P (w)
4746 || (MINI_WINDOW_P (XWINDOW (selected_window))
4747 && w == XWINDOW (Vminibuf_scroll_window)))
4748 freeze_p = 0;
4749
4750 w->frozen_window_start_p = freeze_p;
4751}
4752
4753
4754/* Freeze or unfreeze the window starts of all leaf windows on frame
4755 F, except the selected window and a mini-window. FREEZE_P non-zero
4756 means freeze the window start. */
4757
4758void
4759freeze_window_starts (f, freeze_p)
4760 struct frame *f;
4761 int freeze_p;
4762{
4763 foreach_window (f, freeze_window_start, freeze_p);
4764}
4715 4765
4716 4766
4717/*********************************************************************** 4767/***********************************************************************