aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorDaniel Colascione2012-10-07 14:31:58 -0800
committerDaniel Colascione2012-10-07 14:31:58 -0800
commit36a305a723c63fd345be65c536c52fe9765c14be (patch)
treefb89d9e103552863214c60297a65320917109357 /src/window.c
parent2ab329f3b5d52a39f0a45c3d9c129f1c19560142 (diff)
parent795b1482a9e314cda32d62ac2988f573d359366e (diff)
downloademacs-36a305a723c63fd345be65c536c52fe9765c14be.tar.gz
emacs-36a305a723c63fd345be65c536c52fe9765c14be.zip
Merge from trunk
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c145
1 files changed, 81 insertions, 64 deletions
diff --git a/src/window.c b/src/window.c
index 114bd28c310..61d2a8b073f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -60,8 +60,7 @@ static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer;
60static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; 60static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window;
61static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically; 61static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically;
62static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; 62static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
63static Lisp_Object Qsafe, Qabove, Qbelow; 63static Lisp_Object Qsafe, Qabove, Qbelow, Qwindow_size, Qclone_of;
64static Lisp_Object Qclone_of;
65 64
66static int displayed_window_lines (struct window *); 65static int displayed_window_lines (struct window *);
67static int count_windows (struct window *); 66static int count_windows (struct window *);
@@ -134,102 +133,102 @@ static EMACS_INT window_scroll_preserve_hpos;
134static EMACS_INT window_scroll_preserve_vpos; 133static EMACS_INT window_scroll_preserve_vpos;
135 134
136/* These setters are used only in this file, so they can be private. */ 135/* These setters are used only in this file, so they can be private. */
137static inline void 136static void
138wset_combination_limit (struct window *w, Lisp_Object val) 137wset_combination_limit (struct window *w, Lisp_Object val)
139{ 138{
140 w->combination_limit = val; 139 w->combination_limit = val;
141} 140}
142static inline void 141static void
143wset_dedicated (struct window *w, Lisp_Object val) 142wset_dedicated (struct window *w, Lisp_Object val)
144{ 143{
145 w->dedicated = val; 144 w->dedicated = val;
146} 145}
147static inline void 146static void
148wset_display_table (struct window *w, Lisp_Object val) 147wset_display_table (struct window *w, Lisp_Object val)
149{ 148{
150 w->display_table = val; 149 w->display_table = val;
151} 150}
152static inline void 151static void
153wset_hchild (struct window *w, Lisp_Object val) 152wset_hchild (struct window *w, Lisp_Object val)
154{ 153{
155 w->hchild = val; 154 w->hchild = val;
156} 155}
157static inline void 156static void
158wset_left_fringe_width (struct window *w, Lisp_Object val) 157wset_left_fringe_width (struct window *w, Lisp_Object val)
159{ 158{
160 w->left_fringe_width = val; 159 w->left_fringe_width = val;
161} 160}
162static inline void 161static void
163wset_left_margin_cols (struct window *w, Lisp_Object val) 162wset_left_margin_cols (struct window *w, Lisp_Object val)
164{ 163{
165 w->left_margin_cols = val; 164 w->left_margin_cols = val;
166} 165}
167static inline void 166static void
168wset_new_normal (struct window *w, Lisp_Object val) 167wset_new_normal (struct window *w, Lisp_Object val)
169{ 168{
170 w->new_normal = val; 169 w->new_normal = val;
171} 170}
172static inline void 171static void
173wset_new_total (struct window *w, Lisp_Object val) 172wset_new_total (struct window *w, Lisp_Object val)
174{ 173{
175 w->new_total = val; 174 w->new_total = val;
176} 175}
177static inline void 176static void
178wset_normal_cols (struct window *w, Lisp_Object val) 177wset_normal_cols (struct window *w, Lisp_Object val)
179{ 178{
180 w->normal_cols = val; 179 w->normal_cols = val;
181} 180}
182static inline void 181static void
183wset_normal_lines (struct window *w, Lisp_Object val) 182wset_normal_lines (struct window *w, Lisp_Object val)
184{ 183{
185 w->normal_lines = val; 184 w->normal_lines = val;
186} 185}
187static inline void 186static void
188wset_parent (struct window *w, Lisp_Object val) 187wset_parent (struct window *w, Lisp_Object val)
189{ 188{
190 w->parent = val; 189 w->parent = val;
191} 190}
192static inline void 191static void
193wset_pointm (struct window *w, Lisp_Object val) 192wset_pointm (struct window *w, Lisp_Object val)
194{ 193{
195 w->pointm = val; 194 w->pointm = val;
196} 195}
197static inline void 196static void
198wset_right_fringe_width (struct window *w, Lisp_Object val) 197wset_right_fringe_width (struct window *w, Lisp_Object val)
199{ 198{
200 w->right_fringe_width = val; 199 w->right_fringe_width = val;
201} 200}
202static inline void 201static void
203wset_right_margin_cols (struct window *w, Lisp_Object val) 202wset_right_margin_cols (struct window *w, Lisp_Object val)
204{ 203{
205 w->right_margin_cols = val; 204 w->right_margin_cols = val;
206} 205}
207static inline void 206static void
208wset_scroll_bar_width (struct window *w, Lisp_Object val) 207wset_scroll_bar_width (struct window *w, Lisp_Object val)
209{ 208{
210 w->scroll_bar_width = val; 209 w->scroll_bar_width = val;
211} 210}
212static inline void 211static void
213wset_start (struct window *w, Lisp_Object val) 212wset_start (struct window *w, Lisp_Object val)
214{ 213{
215 w->start = val; 214 w->start = val;
216} 215}
217static inline void 216static void
218wset_temslot (struct window *w, Lisp_Object val) 217wset_temslot (struct window *w, Lisp_Object val)
219{ 218{
220 w->temslot = val; 219 w->temslot = val;
221} 220}
222static inline void 221static void
223wset_vchild (struct window *w, Lisp_Object val) 222wset_vchild (struct window *w, Lisp_Object val)
224{ 223{
225 w->vchild = val; 224 w->vchild = val;
226} 225}
227static inline void 226static void
228wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val) 227wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val)
229{ 228{
230 w->vertical_scroll_bar_type = val; 229 w->vertical_scroll_bar_type = val;
231} 230}
232static inline void 231static void
233wset_window_parameters (struct window *w, Lisp_Object val) 232wset_window_parameters (struct window *w, Lisp_Object val)
234{ 233{
235 w->window_parameters = val; 234 w->window_parameters = val;
@@ -613,10 +612,10 @@ WINDOW are never \(re-)combined with WINDOW's siblings. */)
613DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, 612DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0,
614 doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. 613 doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT.
615WINDOW must be a valid window and defaults to the selected one. 614WINDOW must be a valid window and defaults to the selected one.
616If LIMIT is nil, child windows of WINDOW can be recombined with 615If LIMIT is nil, child windows of WINDOW can be recombined with WINDOW's
617WINDOW's siblings. LIMIT t means that child windows of WINDOW are 616siblings. LIMIT t means that child windows of WINDOW are never
618never \(re-)combined with WINDOW's siblings. Other values are reserved 617\(re-)combined with WINDOW's siblings. Other values are reserved for
619for future use. */) 618future use. */)
620 (Lisp_Object window, Lisp_Object limit) 619 (Lisp_Object window, Lisp_Object limit)
621{ 620{
622 wset_combination_limit (decode_valid_window (window), limit); 621 wset_combination_limit (decode_valid_window (window), limit);
@@ -2820,7 +2819,7 @@ window-start value is reasonable when this function is called. */)
2820 } 2819 }
2821 } 2820 }
2822 2821
2823 BLOCK_INPUT; 2822 block_input ();
2824 if (!FRAME_INITIAL_P (f)) 2823 if (!FRAME_INITIAL_P (f))
2825 { 2824 {
2826 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 2825 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
@@ -2962,7 +2961,7 @@ window-start value is reasonable when this function is called. */)
2962 } 2961 }
2963 2962
2964 adjust_glyphs (f); 2963 adjust_glyphs (f);
2965 UNBLOCK_INPUT; 2964 unblock_input ();
2966 2965
2967 run_window_configuration_change_hook (f); 2966 run_window_configuration_change_hook (f);
2968 2967
@@ -3462,6 +3461,10 @@ make_window (void)
3462 wset_vertical_scroll_bar_type (w, Qt); 3461 wset_vertical_scroll_bar_type (w, Qt);
3463 wset_window_end_pos (w, make_number (0)); 3462 wset_window_end_pos (w, make_number (0));
3464 wset_window_end_vpos (w, make_number (0)); 3463 wset_window_end_vpos (w, make_number (0));
3464 /* These Lisp fields are marked specially so they're not set to nil by
3465 allocate_window. */
3466 wset_prev_buffers (w, Qnil);
3467 wset_next_buffers (w, Qnil);
3465 3468
3466 /* Initialize non-Lisp data. Note that allocate_window zeroes out all 3469 /* Initialize non-Lisp data. Note that allocate_window zeroes out all
3467 non-Lisp data, so do it only for slots which should not be zero. */ 3470 non-Lisp data, so do it only for slots which should not be zero. */
@@ -3693,14 +3696,14 @@ be applied on the Elisp level. */)
3693 (horflag ? r->total_cols : r->total_lines))) 3696 (horflag ? r->total_cols : r->total_lines)))
3694 return Qnil; 3697 return Qnil;
3695 3698
3696 BLOCK_INPUT; 3699 block_input ();
3697 window_resize_apply (r, horflag); 3700 window_resize_apply (r, horflag);
3698 3701
3699 windows_or_buffers_changed++; 3702 windows_or_buffers_changed++;
3700 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 3703 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3701 3704
3702 adjust_glyphs (f); 3705 adjust_glyphs (f);
3703 UNBLOCK_INPUT; 3706 unblock_input ();
3704 3707
3705 run_window_configuration_change_hook (f); 3708 run_window_configuration_change_hook (f);
3706 3709
@@ -3844,7 +3847,7 @@ set correctly. See the code of `split-window' for how this is done. */)
3844 We do that if either `window-combination-limit' is t, or OLD has no 3847 We do that if either `window-combination-limit' is t, or OLD has no
3845 parent, or OLD is ortho-combined. */ 3848 parent, or OLD is ortho-combined. */
3846 combination_limit = 3849 combination_limit =
3847 !NILP (Vwindow_combination_limit) 3850 EQ (Vwindow_combination_limit, Qt)
3848 || NILP (o->parent) 3851 || NILP (o->parent)
3849 || NILP (horflag 3852 || NILP (horflag
3850 ? (XWINDOW (o->parent)->hchild) 3853 ? (XWINDOW (o->parent)->hchild)
@@ -3899,9 +3902,9 @@ set correctly. See the code of `split-window' for how this is done. */)
3899 3902
3900 make_parent_window (old, horflag); 3903 make_parent_window (old, horflag);
3901 p = XWINDOW (o->parent); 3904 p = XWINDOW (o->parent);
3902 /* Store value of `window-combination-limit' in new parent's 3905 /* Store t in the new parent's combination_limit slot to avoid
3903 combination_limit slot. */ 3906 that its children get merged into another window. */
3904 wset_combination_limit (p, Vwindow_combination_limit); 3907 wset_combination_limit (p, Qt);
3905 /* These get applied below. */ 3908 /* These get applied below. */
3906 wset_new_total (p, horflag ? o->total_cols : o->total_lines); 3909 wset_new_total (p, horflag ? o->total_cols : o->total_lines);
3907 wset_new_normal (p, new_normal); 3910 wset_new_normal (p, new_normal);
@@ -3970,13 +3973,13 @@ set correctly. See the code of `split-window' for how this is done. */)
3970 wset_new_total (n, total_size); 3973 wset_new_total (n, total_size);
3971 wset_new_normal (n, normal_size); 3974 wset_new_normal (n, normal_size);
3972 3975
3973 BLOCK_INPUT; 3976 block_input ();
3974 window_resize_apply (p, horflag); 3977 window_resize_apply (p, horflag);
3975 adjust_glyphs (f); 3978 adjust_glyphs (f);
3976 /* Set buffer of NEW to buffer of reference window. Don't run 3979 /* Set buffer of NEW to buffer of reference window. Don't run
3977 any hooks. */ 3980 any hooks. */
3978 set_window_buffer (new, r->buffer, 0, 1); 3981 set_window_buffer (new, r->buffer, 0, 1);
3979 UNBLOCK_INPUT; 3982 unblock_input ();
3980 3983
3981 /* Maybe we should run the scroll functions in Elisp (which already 3984 /* Maybe we should run the scroll functions in Elisp (which already
3982 runs the configuration change hook). */ 3985 runs the configuration change hook). */
@@ -4057,7 +4060,7 @@ Signal an error when WINDOW is the only window on its frame. */)
4057 { 4060 {
4058 4061
4059 /* Block input. */ 4062 /* Block input. */
4060 BLOCK_INPUT; 4063 block_input ();
4061 window_resize_apply (p, horflag); 4064 window_resize_apply (p, horflag);
4062 4065
4063 /* If this window is referred to by the dpyinfo's mouse 4066 /* If this window is referred to by the dpyinfo's mouse
@@ -4129,7 +4132,7 @@ Signal an error when WINDOW is the only window on its frame. */)
4129 else 4132 else
4130 fset_selected_window (f, new_selected_window); 4133 fset_selected_window (f, new_selected_window);
4131 4134
4132 UNBLOCK_INPUT; 4135 unblock_input ();
4133 4136
4134 /* Now look whether `get-mru-window' gets us something. */ 4137 /* Now look whether `get-mru-window' gets us something. */
4135 mru_window = call1 (Qget_mru_window, frame); 4138 mru_window = call1 (Qget_mru_window, frame);
@@ -4144,7 +4147,7 @@ Signal an error when WINDOW is the only window on its frame. */)
4144 fset_selected_window (f, new_selected_window); 4147 fset_selected_window (f, new_selected_window);
4145 } 4148 }
4146 else 4149 else
4147 UNBLOCK_INPUT; 4150 unblock_input ();
4148 4151
4149 /* Must be run by the caller: 4152 /* Must be run by the caller:
4150 run_window_configuration_change_hook (f); */ 4153 run_window_configuration_change_hook (f); */
@@ -4194,7 +4197,7 @@ grow_mini_window (struct window *w, int delta)
4194 root, make_number (- delta)); 4197 root, make_number (- delta));
4195 if (INTEGERP (value) && window_resize_check (r, 0)) 4198 if (INTEGERP (value) && window_resize_check (r, 0))
4196 { 4199 {
4197 BLOCK_INPUT; 4200 block_input ();
4198 window_resize_apply (r, 0); 4201 window_resize_apply (r, 0);
4199 4202
4200 /* Grow the mini-window. */ 4203 /* Grow the mini-window. */
@@ -4206,7 +4209,7 @@ grow_mini_window (struct window *w, int delta)
4206 w->last_overlay_modified = 0; 4209 w->last_overlay_modified = 0;
4207 4210
4208 adjust_glyphs (f); 4211 adjust_glyphs (f);
4209 UNBLOCK_INPUT; 4212 unblock_input ();
4210 } 4213 }
4211} 4214}
4212 4215
@@ -4231,7 +4234,7 @@ shrink_mini_window (struct window *w)
4231 root, make_number (size - 1)); 4234 root, make_number (size - 1));
4232 if (INTEGERP (value) && window_resize_check (r, 0)) 4235 if (INTEGERP (value) && window_resize_check (r, 0))
4233 { 4236 {
4234 BLOCK_INPUT; 4237 block_input ();
4235 window_resize_apply (r, 0); 4238 window_resize_apply (r, 0);
4236 4239
4237 /* Shrink the mini-window. */ 4240 /* Shrink the mini-window. */
@@ -4243,7 +4246,7 @@ shrink_mini_window (struct window *w)
4243 w->last_overlay_modified = 0; 4246 w->last_overlay_modified = 0;
4244 4247
4245 adjust_glyphs (f); 4248 adjust_glyphs (f);
4246 UNBLOCK_INPUT; 4249 unblock_input ();
4247 } 4250 }
4248 /* If the above failed for whatever strange reason we must make a 4251 /* If the above failed for whatever strange reason we must make a
4249 one window frame here. The same routine will be needed when 4252 one window frame here. The same routine will be needed when
@@ -4275,7 +4278,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4275 && XINT (w->new_total) > 0 4278 && XINT (w->new_total) > 0
4276 && height == XINT (r->new_total) + XINT (w->new_total)) 4279 && height == XINT (r->new_total) + XINT (w->new_total))
4277 { 4280 {
4278 BLOCK_INPUT; 4281 block_input ();
4279 window_resize_apply (r, 0); 4282 window_resize_apply (r, 0);
4280 4283
4281 wset_total_lines (w, w->new_total); 4284 wset_total_lines (w, w->new_total);
@@ -4285,7 +4288,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4285 windows_or_buffers_changed++; 4288 windows_or_buffers_changed++;
4286 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4289 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
4287 adjust_glyphs (f); 4290 adjust_glyphs (f);
4288 UNBLOCK_INPUT; 4291 unblock_input ();
4289 4292
4290 run_window_configuration_change_hook (f); 4293 run_window_configuration_change_hook (f);
4291 return Qt; 4294 return Qt;
@@ -5621,7 +5624,7 @@ the return value is nil. Otherwise the value is t. */)
5621 5624
5622 /* The mouse highlighting code could get screwed up 5625 /* The mouse highlighting code could get screwed up
5623 if it runs during this. */ 5626 if it runs during this. */
5624 BLOCK_INPUT; 5627 block_input ();
5625 5628
5626 if (data->frame_lines != previous_frame_lines 5629 if (data->frame_lines != previous_frame_lines
5627 || data->frame_cols != previous_frame_cols) 5630 || data->frame_cols != previous_frame_cols)
@@ -5872,7 +5875,7 @@ the return value is nil. Otherwise the value is t. */)
5872 } 5875 }
5873 5876
5874 adjust_glyphs (f); 5877 adjust_glyphs (f);
5875 UNBLOCK_INPUT; 5878 unblock_input ();
5876 5879
5877 /* Scan dead buffer windows. */ 5880 /* Scan dead buffer windows. */
5878 for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows)) 5881 for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows))
@@ -6701,6 +6704,7 @@ syms_of_window (void)
6701 DEFSYM (Qreplace_buffer_in_windows, "replace-buffer-in-windows"); 6704 DEFSYM (Qreplace_buffer_in_windows, "replace-buffer-in-windows");
6702 DEFSYM (Qrecord_window_buffer, "record-window-buffer"); 6705 DEFSYM (Qrecord_window_buffer, "record-window-buffer");
6703 DEFSYM (Qget_mru_window, "get-mru-window"); 6706 DEFSYM (Qget_mru_window, "get-mru-window");
6707 DEFSYM (Qwindow_size, "window-size");
6704 DEFSYM (Qtemp_buffer_show_hook, "temp-buffer-show-hook"); 6708 DEFSYM (Qtemp_buffer_show_hook, "temp-buffer-show-hook");
6705 DEFSYM (Qabove, "above"); 6709 DEFSYM (Qabove, "above");
6706 DEFSYM (Qbelow, "below"); 6710 DEFSYM (Qbelow, "below");
@@ -6796,23 +6800,36 @@ This variable takes no effect if `window-combination-limit' is non-nil. */);
6796 Vwindow_combination_resize = Qnil; 6800 Vwindow_combination_resize = Qnil;
6797 6801
6798 DEFVAR_LISP ("window-combination-limit", Vwindow_combination_limit, 6802 DEFVAR_LISP ("window-combination-limit", Vwindow_combination_limit,
6799 doc: /* If t, splitting a window makes a new parent window. 6803 doc: /* If non-nil, splitting a window makes a new parent window.
6800If this variable is nil, splitting a window will create a new parent 6804The following values are recognized:
6801window only if the window has no parent window or the window shall 6805
6802become a combination orthogonal to the one it is part of. 6806nil means splitting a window will create a new parent window only if the
6803 6807 window has no parent window or the window shall become part of a
6804If this variable is t, splitting a window always creates a new parent 6808 combination orthogonal to the one it is part of.
6805window. If all splits behave this way, each frame's window tree is a 6809
6806binary tree and every window but the frame's root window has exactly one 6810`window-size' means that splitting a window for displaying a buffer
6807sibling. 6811 makes a new parent window provided `display-buffer' is supposed to
6808 6812 explicitly set the window's size due to the presence of a
6809Other values are reserved for future use. 6813 `window-height' or `window-width' entry in the alist used by
6810 6814 `display-buffer'. Otherwise, this value is handled like nil.
6811The value of this variable is also assigned to the combination limit of 6815
6812the new parent window. The combination limit of a window can be 6816`temp-buffer' means that splitting a window for displaying a temporary
6813retrieved via the function `window-combination-limit' and altered by the 6817 buffer always makes a new parent window. Otherwise, this value is
6814function `set-window-combination-limit'. */); 6818 handled like nil.
6815 Vwindow_combination_limit = Qnil; 6819
6820`display-buffer' means that splitting a window for displaying a buffer
6821 always makes a new parent window. Since temporary buffers are
6822 displayed by the function `display-buffer', this value is stronger
6823 than `temp-buffer'. Splitting a window for other purpose makes a
6824 new parent window only if needed.
6825
6826t means that splitting a window always creates a new parent window. If
6827 all splits behave this way, each frame's window tree is a binary
6828 tree and every window but the frame's root window has exactly one
6829 sibling.
6830
6831Other values are reserved for future use. */);
6832 Vwindow_combination_limit = Qwindow_size;
6816 6833
6817 DEFVAR_LISP ("window-persistent-parameters", Vwindow_persistent_parameters, 6834 DEFVAR_LISP ("window-persistent-parameters", Vwindow_persistent_parameters,
6818 doc: /* Alist of persistent window parameters. 6835 doc: /* Alist of persistent window parameters.