comparison src/window.c @ 282:c42ec1d1cded r21-0b39

Import from CVS: tag r21-0b39
author cvs
date Mon, 13 Aug 2007 10:33:18 +0200
parents 7df0dd720c89
children 558f606b08ae
comparison
equal deleted inserted replaced
281:090b52736db2 282:c42ec1d1cded
155 ((markobj) (window->has_modeline_p)); 155 ((markobj) (window->has_modeline_p));
156 ((markobj) (window->modeline_shadow_thickness)); 156 ((markobj) (window->modeline_shadow_thickness));
157 #ifdef HAVE_SCROLLBARS 157 #ifdef HAVE_SCROLLBARS
158 ((markobj) (window->scrollbar_width)); 158 ((markobj) (window->scrollbar_width));
159 ((markobj) (window->scrollbar_height)); 159 ((markobj) (window->scrollbar_height));
160 ((markobj) (window->horizontal_scrollbar_visible_p));
161 ((markobj) (window->vertical_scrollbar_visible_p));
162 ((markobj) (window->scrollbar_on_left_p));
163 ((markobj) (window->scrollbar_on_top_p));
160 ((markobj) (window->scrollbar_pointer)); 164 ((markobj) (window->scrollbar_pointer));
161 #endif /* HAVE_SCROLLBARS */ 165 #endif /* HAVE_SCROLLBARS */
162 ((markobj) (window->left_margin_width)); 166 ((markobj) (window->left_margin_width));
163 ((markobj) (window->right_margin_width)); 167 ((markobj) (window->right_margin_width));
164 #ifdef HAVE_TOOLBARS 168 #ifdef HAVE_TOOLBARS
308 p->has_modeline_p = Qnil; 312 p->has_modeline_p = Qnil;
309 p->modeline_shadow_thickness = Qnil; 313 p->modeline_shadow_thickness = Qnil;
310 #ifdef HAVE_SCROLLBARS 314 #ifdef HAVE_SCROLLBARS
311 p->scrollbar_width = Qnil; 315 p->scrollbar_width = Qnil;
312 p->scrollbar_height = Qnil; 316 p->scrollbar_height = Qnil;
317 p->horizontal_scrollbar_visible_p = Qnil;
318 p->vertical_scrollbar_visible_p = Qnil;
319 p->scrollbar_on_left_p = Qnil;
320 p->scrollbar_on_top_p = Qnil;
313 #endif 321 #endif
314 p->left_margin_width = Qnil; 322 p->left_margin_width = Qnil;
315 p->right_margin_width = Qnil; 323 p->right_margin_width = Qnil;
316 #ifdef HAVE_TOOLBARS 324 #ifdef HAVE_TOOLBARS
317 p->toolbar_size[0] = Qnil; 325 p->toolbar_size[0] = Qnil;
770 int 778 int
771 window_needs_vertical_divider (struct window *w) 779 window_needs_vertical_divider (struct window *w)
772 { 780 {
773 #ifdef HAVE_SCROLLBARS 781 #ifdef HAVE_SCROLLBARS
774 return (!window_scrollbar_width (w) && 782 return (!window_scrollbar_width (w) &&
775 ((XFRAME (w->frame)->scrollbar_on_left) ? 783 (!NILP (w->scrollbar_on_left_p) ?
776 !window_is_leftmost (w) : 784 !window_is_leftmost (w) :
777 !window_is_rightmost (w))); 785 !window_is_rightmost (w)));
778 #else 786 #else
779 return !window_is_leftmost (w); 787 return !window_is_leftmost (w);
780 #endif /* HAVE_SCROLLBARS */ 788 #endif /* HAVE_SCROLLBARS */
784 window_scrollbar_width (struct window *w) 792 window_scrollbar_width (struct window *w)
785 { 793 {
786 #ifdef HAVE_SCROLLBARS 794 #ifdef HAVE_SCROLLBARS
787 if (!WINDOW_WIN_P (w) 795 if (!WINDOW_WIN_P (w)
788 || MINI_WINDOW_P (w) 796 || MINI_WINDOW_P (w)
789 || NILP (w->buffer)) 797 || NILP (w->buffer)
798 || NILP (w->vertical_scrollbar_visible_p))
790 /* #### when does NILP (w->buffer) happen? */ 799 /* #### when does NILP (w->buffer) happen? */
791 return 0; 800 return 0;
792 801
793 return XINT (w->scrollbar_width); 802 return XINT (w->scrollbar_width);
794 #else 803 #else
803 { 812 {
804 #ifdef HAVE_SCROLLBARS 813 #ifdef HAVE_SCROLLBARS
805 if (!WINDOW_WIN_P (w) 814 if (!WINDOW_WIN_P (w)
806 || MINI_WINDOW_P (w) 815 || MINI_WINDOW_P (w)
807 || NILP (w->buffer) 816 || NILP (w->buffer)
817 || NILP (w->horizontal_scrollbar_visible_p)
808 || !window_truncation_on (w)) 818 || !window_truncation_on (w))
809 return 0; 819 return 0;
810 820
811 return XINT (w->scrollbar_height); 821 return XINT (w->scrollbar_height);
812 #else 822 #else
995 1005
996 if (!NILP (w->hchild) || !NILP (w->vchild)) 1006 if (!NILP (w->hchild) || !NILP (w->vchild))
997 return 0; 1007 return 0;
998 1008
999 #ifdef HAVE_SCROLLBARS 1009 #ifdef HAVE_SCROLLBARS
1000 if (XFRAME (w->frame)->scrollbar_on_top) 1010 if (!NILP (w->scrollbar_on_top_p))
1001 return window_scrollbar_height (w) + toolbar_height; 1011 return window_scrollbar_height (w) + toolbar_height;
1002 else 1012 else
1003 #endif 1013 #endif
1004 return toolbar_height; 1014 return toolbar_height;
1005 } 1015 }
1014 else 1024 else
1015 other_height = 1025 other_height =
1016 window_modeline_height (w) + window_bottom_toolbar_height (w); 1026 window_modeline_height (w) + window_bottom_toolbar_height (w);
1017 1027
1018 #ifdef HAVE_SCROLLBARS 1028 #ifdef HAVE_SCROLLBARS
1019 if (!XFRAME (w->frame)->scrollbar_on_top) 1029 if (NILP (w->scrollbar_on_top_p))
1020 return window_scrollbar_height (w) + other_height; 1030 return window_scrollbar_height (w) + other_height;
1021 else 1031 else
1022 #endif 1032 #endif
1023 return other_height; 1033 return other_height;
1024 } 1034 }
1060 { 1070 {
1061 if (!NILP (w->hchild) || !NILP (w->vchild)) 1071 if (!NILP (w->hchild) || !NILP (w->vchild))
1062 return 0; 1072 return 0;
1063 1073
1064 #ifdef HAVE_SCROLLBARS 1074 #ifdef HAVE_SCROLLBARS
1065 if (XFRAME (w->frame)->scrollbar_on_left) 1075 if (!NILP (w->scrollbar_on_left_p))
1066 { 1076 {
1067 #endif 1077 #endif
1068 return (window_left_right_gutter_width_internal (w, modeline) + 1078 return (window_left_right_gutter_width_internal (w, modeline) +
1069 window_left_toolbar_width (w)); 1079 window_left_toolbar_width (w));
1070 #ifdef HAVE_SCROLLBARS 1080 #ifdef HAVE_SCROLLBARS
1079 { 1089 {
1080 if (!NILP (w->hchild) || !NILP (w->vchild)) 1090 if (!NILP (w->hchild) || !NILP (w->vchild))
1081 return 0; 1091 return 0;
1082 1092
1083 #ifdef HAVE_SCROLLBARS 1093 #ifdef HAVE_SCROLLBARS
1084 if (!XFRAME (w->frame)->scrollbar_on_left) 1094 if (NILP (w->scrollbar_on_left_p))
1085 { 1095 {
1086 return (window_left_right_gutter_width_internal (w, modeline) + 1096 return (window_left_right_gutter_width_internal (w, modeline) +
1087 window_right_toolbar_width (w)); 1097 window_right_toolbar_width (w));
1088 } 1098 }
1089 else 1099 else
1817 selected frame, then we should use Fselect_window to select 1827 selected frame, then we should use Fselect_window to select
1818 the new window. On the other hand, if we're about to 1828 the new window. On the other hand, if we're about to
1819 delete the selected window on any other frame, we shouldn't do 1829 delete the selected window on any other frame, we shouldn't do
1820 anything but set the frame's selected_window slot. */ 1830 anything but set the frame's selected_window slot. */
1821 if (EQ (frame, Fselected_frame (Qnil))) 1831 if (EQ (frame, Fselected_frame (Qnil)))
1822 Fselect_window (alternative); 1832 Fselect_window (alternative, Qnil);
1823 else 1833 else
1824 set_frame_selected_window (f, alternative); 1834 set_frame_selected_window (f, alternative);
1825 } 1835 }
1826 } 1836 }
1827 1837
2292 while (i < 0) 2302 while (i < 0)
2293 { 2303 {
2294 w = Fprevious_window (w, Qnil, frame, console); 2304 w = Fprevious_window (w, Qnil, frame, console);
2295 i++; 2305 i++;
2296 } 2306 }
2297 Fselect_window (w); 2307 Fselect_window (w, Qnil);
2298 return Qnil; 2308 return Qnil;
2299 } 2309 }
2300 2310
2301 2311
2302 /* Look at all windows, performing an operation specified by TYPE 2312 /* Look at all windows, performing an operation specified by TYPE
3116 Fset_buffer (buffer); 3126 Fset_buffer (buffer);
3117 } 3127 }
3118 return Qnil; 3128 return Qnil;
3119 } 3129 }
3120 3130
3121 DEFUN ("select-window", Fselect_window, 1, 1, 0, /* 3131 DEFUN ("select-window", Fselect_window, 1, 2, 0, /*
3122 Select WINDOW. Most editing will apply to WINDOW's buffer. 3132 Select WINDOW. Most editing will apply to WINDOW's buffer.
3123 The main editor command loop selects the buffer of the selected window 3133 The main editor command loop selects the buffer of the selected window
3124 before each command. 3134 before each command.
3125 */ 3135
3126 (window)) 3136 With non-nil optional argument `norecord', do not modify the
3137 global or per-frame buffer ordering.
3138 */
3139 (window, norecord))
3127 { 3140 {
3128 struct window *w; 3141 struct window *w;
3129 Lisp_Object old_selected_window = Fselected_window (Qnil); 3142 Lisp_Object old_selected_window = Fselected_window (Qnil);
3130 3143
3131 CHECK_LIVE_WINDOW (window); 3144 CHECK_LIVE_WINDOW (window);
3156 set_frame_selected_window (XFRAME (WINDOW_FRAME (w)), window); 3169 set_frame_selected_window (XFRAME (WINDOW_FRAME (w)), window);
3157 3170
3158 select_frame_1 (WINDOW_FRAME (w)); 3171 select_frame_1 (WINDOW_FRAME (w));
3159 3172
3160 /* also select the window's buffer */ 3173 /* also select the window's buffer */
3161 Frecord_buffer (w->buffer); 3174 if (NILP (norecord))
3175 Frecord_buffer (w->buffer);
3162 Fset_buffer (w->buffer); 3176 Fset_buffer (w->buffer);
3163 3177
3164 /* Go to the point recorded in the window. 3178 /* Go to the point recorded in the window.
3165 This is important when the buffer is in more 3179 This is important when the buffer is in more
3166 than one window. It also matters when 3180 than one window. It also matters when
3232 /* Select the window that was chosen, for running 3246 /* Select the window that was chosen, for running
3233 the hook. */ 3247 the hook. */
3234 record_unwind_protect (save_window_excursion_unwind, 3248 record_unwind_protect (save_window_excursion_unwind,
3235 Fcurrent_window_configuration (Qnil)); 3249 Fcurrent_window_configuration (Qnil));
3236 3250
3237 Fselect_window (window); 3251 Fselect_window (window, Qnil);
3238 run_hook (Qtemp_buffer_show_hook); 3252 run_hook (Qtemp_buffer_show_hook);
3239 unbind_to (count, Qnil); 3253 unbind_to (count, Qnil);
3240 } 3254 }
3241 } 3255 }
3242 } 3256 }
4535 Lisp_Object modeline_shadow_thickness; 4549 Lisp_Object modeline_shadow_thickness;
4536 Lisp_Object has_modeline_p; 4550 Lisp_Object has_modeline_p;
4537 #ifdef HAVE_SCROLLBARS 4551 #ifdef HAVE_SCROLLBARS
4538 Lisp_Object scrollbar_width; 4552 Lisp_Object scrollbar_width;
4539 Lisp_Object scrollbar_height; 4553 Lisp_Object scrollbar_height;
4554 Lisp_Object horizontal_scrollbar_visible_p;
4555 Lisp_Object vertical_scrollbar_visible_p;
4556 Lisp_Object scrollbar_on_left_p;
4557 Lisp_Object scrollbar_on_top_p;
4540 Lisp_Object scrollbar_pointer; 4558 Lisp_Object scrollbar_pointer;
4541 #endif /* HAVE_SCROLLBARS */ 4559 #endif /* HAVE_SCROLLBARS */
4542 #ifdef HAVE_TOOLBARS 4560 #ifdef HAVE_TOOLBARS
4543 Lisp_Object toolbar[4]; 4561 Lisp_Object toolbar[4];
4544 Lisp_Object toolbar_size[4]; 4562 Lisp_Object toolbar_size[4];
4674 EQ(win1->modeline_shadow_thickness, win2->modeline_shadow_thickness) && 4692 EQ(win1->modeline_shadow_thickness, win2->modeline_shadow_thickness) &&
4675 EQ(win1->has_modeline_p, win2->has_modeline_p) && 4693 EQ(win1->has_modeline_p, win2->has_modeline_p) &&
4676 #ifdef HAVE_SCROLLBARS 4694 #ifdef HAVE_SCROLLBARS
4677 EQ(win1->scrollbar_width, win2->scrollbar_width) && 4695 EQ(win1->scrollbar_width, win2->scrollbar_width) &&
4678 EQ(win1->scrollbar_height, win2->scrollbar_height) && 4696 EQ(win1->scrollbar_height, win2->scrollbar_height) &&
4697 EQ(win1->horizontal_scrollbar_visible_p, win2->horizontal_scrollbar_visible_p) &&
4698 EQ(win1->vertical_scrollbar_visible_p, win2->vertical_scrollbar_visible_p) &&
4699 EQ(win1->scrollbar_on_left_p, win2->scrollbar_on_left_p) &&
4700 EQ(win1->scrollbar_on_top_p, win2->scrollbar_on_top_p) &&
4679 EQ(win1->scrollbar_pointer, win2->scrollbar_pointer) && 4701 EQ(win1->scrollbar_pointer, win2->scrollbar_pointer) &&
4680 #endif /* HAVE_SCROLLBARS */ 4702 #endif /* HAVE_SCROLLBARS */
4681 #ifdef HAVE_TOOLBARS 4703 #ifdef HAVE_TOOLBARS
4682 internal_equal(win1->toolbar[0], win2->toolbar[0], 0) && 4704 internal_equal(win1->toolbar[0], win2->toolbar[0], 0) &&
4683 internal_equal(win1->toolbar[1], win2->toolbar[1], 0) && 4705 internal_equal(win1->toolbar[1], win2->toolbar[1], 0) &&
4993 w->modeline_shadow_thickness = p->modeline_shadow_thickness; 5015 w->modeline_shadow_thickness = p->modeline_shadow_thickness;
4994 w->has_modeline_p = p->has_modeline_p; 5016 w->has_modeline_p = p->has_modeline_p;
4995 #ifdef HAVE_SCROLLBARS 5017 #ifdef HAVE_SCROLLBARS
4996 w->scrollbar_width = p->scrollbar_width; 5018 w->scrollbar_width = p->scrollbar_width;
4997 w->scrollbar_height = p->scrollbar_height; 5019 w->scrollbar_height = p->scrollbar_height;
5020 w->horizontal_scrollbar_visible_p = p->horizontal_scrollbar_visible_p;
5021 w->vertical_scrollbar_visible_p = p->vertical_scrollbar_visible_p;
5022 w->scrollbar_on_left_p = p->scrollbar_on_left_p;
5023 w->scrollbar_on_top_p = p->scrollbar_on_top_p;
4998 w->scrollbar_pointer = p->scrollbar_pointer; 5024 w->scrollbar_pointer = p->scrollbar_pointer;
4999 #endif /* HAVE_SCROLLBARS */ 5025 #endif /* HAVE_SCROLLBARS */
5000 #ifdef HAVE_TOOLBARS 5026 #ifdef HAVE_TOOLBARS
5001 { 5027 {
5002 int ix; 5028 int ix;
5123 5149
5124 #### Find out why this is really going wrong. */ 5150 #### Find out why this is really going wrong. */
5125 if (!minibuf_level && 5151 if (!minibuf_level &&
5126 MINI_WINDOW_P (XWINDOW (config->current_window))) 5152 MINI_WINDOW_P (XWINDOW (config->current_window)))
5127 Fselect_window (Fnext_window (config->current_window, 5153 Fselect_window (Fnext_window (config->current_window,
5128 Qnil, Qnil, Qnil)); 5154 Qnil, Qnil, Qnil),
5155 Qnil);
5129 else 5156 else
5130 Fselect_window (config->current_window); 5157 Fselect_window (config->current_window, Qnil);
5131 if (!NILP (new_current_buffer)) 5158 if (!NILP (new_current_buffer))
5132 Fset_buffer (new_current_buffer); 5159 Fset_buffer (new_current_buffer);
5133 else 5160 else
5134 Fset_buffer (XWINDOW (Fselected_window (Qnil))->buffer); 5161 Fset_buffer (XWINDOW (Fselected_window (Qnil))->buffer);
5135 } 5162 }
5254 p->modeline_shadow_thickness = w->modeline_shadow_thickness; 5281 p->modeline_shadow_thickness = w->modeline_shadow_thickness;
5255 p->has_modeline_p = w->has_modeline_p; 5282 p->has_modeline_p = w->has_modeline_p;
5256 #ifdef HAVE_SCROLLBARS 5283 #ifdef HAVE_SCROLLBARS
5257 p->scrollbar_width = w->scrollbar_width; 5284 p->scrollbar_width = w->scrollbar_width;
5258 p->scrollbar_height = w->scrollbar_height; 5285 p->scrollbar_height = w->scrollbar_height;
5286 p->horizontal_scrollbar_visible_p = w->horizontal_scrollbar_visible_p;
5287 p->vertical_scrollbar_visible_p = w->vertical_scrollbar_visible_p;
5288 p->scrollbar_on_left_p = w->scrollbar_on_left_p;
5289 p->scrollbar_on_top_p = w->scrollbar_on_top_p;
5259 p->scrollbar_pointer = w->scrollbar_pointer; 5290 p->scrollbar_pointer = w->scrollbar_pointer;
5260 #endif /* HAVE_SCROLLBARS */ 5291 #endif /* HAVE_SCROLLBARS */
5261 #ifdef HAVE_TOOLBARS 5292 #ifdef HAVE_TOOLBARS
5262 { 5293 {
5263 int ix; 5294 int ix;