comparison src/window.c @ 13723:4e170419e83c

(Fsplit_window): Account for scroll bar width.
author Karl Heuer <kwzh@gnu.org>
date Wed, 13 Dec 1995 03:29:28 +0000
parents 3fa8cd29e1da
children 732a8bd9c552
comparison
equal deleted inserted replaced
13722:e2669b8a46e2 13723:4e170419e83c
2251 (window, chsize, horflag) 2251 (window, chsize, horflag)
2252 Lisp_Object window, chsize, horflag; 2252 Lisp_Object window, chsize, horflag;
2253 { 2253 {
2254 register Lisp_Object new; 2254 register Lisp_Object new;
2255 register struct window *o, *p; 2255 register struct window *o, *p;
2256 FRAME_PTR fo;
2256 register int size; 2257 register int size;
2258 int internal_width;
2259 int separator_width = 1;
2257 2260
2258 if (NILP (window)) 2261 if (NILP (window))
2259 window = selected_window; 2262 window = selected_window;
2260 else 2263 else
2261 CHECK_LIVE_WINDOW (window, 0); 2264 CHECK_LIVE_WINDOW (window, 0);
2262 2265
2263 o = XWINDOW (window); 2266 o = XWINDOW (window);
2267 fo = XFRAME (WINDOW_FRAME (o));
2268 if (FRAME_HAS_VERTICAL_SCROLL_BARS (fo))
2269 separator_width = FRAME_SCROLL_BAR_COLS (fo);
2270 internal_width = window_internal_width (o);
2264 2271
2265 if (NILP (chsize)) 2272 if (NILP (chsize))
2266 { 2273 {
2267 if (!NILP (horflag)) 2274 if (!NILP (horflag))
2268 /* Round odd size up, since this is for the left-hand window, 2275 /* Calculate the size of the left-hand window, by dividing
2269 and it will lose a column for the separators. */ 2276 the usable space in columns by two. */
2270 size = ((XFASTINT (o->width) + 1) & -2) >> 1; 2277 size = (internal_width - separator_width) >> 1;
2271 else 2278 else
2272 size = XFASTINT (o->height) >> 1; 2279 size = XFASTINT (o->height) >> 1;
2273 } 2280 }
2274 else 2281 else
2275 { 2282 {
2277 size = XINT (chsize); 2284 size = XINT (chsize);
2278 } 2285 }
2279 2286
2280 if (MINI_WINDOW_P (o)) 2287 if (MINI_WINDOW_P (o))
2281 error ("Attempt to split minibuffer window"); 2288 error ("Attempt to split minibuffer window");
2282 else if (FRAME_NO_SPLIT_P (XFRAME (WINDOW_FRAME (o)))) 2289 else if (FRAME_NO_SPLIT_P (fo))
2283 error ("Attempt to split unsplittable frame"); 2290 error ("Attempt to split unsplittable frame");
2284 2291
2285 check_min_window_sizes (); 2292 check_min_window_sizes ();
2286 2293
2287 if (NILP (horflag)) 2294 if (NILP (horflag))
2301 } 2308 }
2302 else 2309 else
2303 { 2310 {
2304 if (size < window_min_width) 2311 if (size < window_min_width)
2305 error ("Window width %d too small (after splitting)", size); 2312 error ("Window width %d too small (after splitting)", size);
2306 if (size + window_min_width > XFASTINT (o->width)) 2313 if (internal_width - size - separator_width < window_min_width)
2307 error ("Window width %d too small (after splitting)", 2314 error ("Window width %d too small (after splitting)",
2308 XFASTINT (o->width) - size); 2315 internal_width - size - separator_width);
2309 if (NILP (o->parent) 2316 if (NILP (o->parent)
2310 || NILP (XWINDOW (o->parent)->hchild)) 2317 || NILP (XWINDOW (o->parent)->hchild))
2311 { 2318 {
2312 make_dummy_parent (window); 2319 make_dummy_parent (window);
2313 new = o->parent; 2320 new = o->parent;
2318 /* Now we know that window's parent is a vertical combination 2325 /* Now we know that window's parent is a vertical combination
2319 if we are dividing vertically, or a horizontal combination 2326 if we are dividing vertically, or a horizontal combination
2320 if we are making side-by-side windows */ 2327 if we are making side-by-side windows */
2321 2328
2322 windows_or_buffers_changed++; 2329 windows_or_buffers_changed++;
2323 FRAME_WINDOW_SIZES_CHANGED (XFRAME (WINDOW_FRAME (o))) = 1; 2330 FRAME_WINDOW_SIZES_CHANGED (fo) = 1;
2324 new = make_window (); 2331 new = make_window ();
2325 p = XWINDOW (new); 2332 p = XWINDOW (new);
2326 2333
2327 p->frame = o->frame; 2334 p->frame = o->frame;
2328 p->next = o->next; 2335 p->next = o->next;
2339 2346
2340 if (!NILP (horflag)) 2347 if (!NILP (horflag))
2341 { 2348 {
2342 p->height = o->height; 2349 p->height = o->height;
2343 p->top = o->top; 2350 p->top = o->top;
2344 XSETFASTINT (p->width, XFASTINT (o->width) - size); 2351 size += separator_width;
2352 XSETFASTINT (p->width, internal_width - size);
2345 XSETFASTINT (o->width, size); 2353 XSETFASTINT (o->width, size);
2346 XSETFASTINT (p->left, XFASTINT (o->left) + size); 2354 XSETFASTINT (p->left, XFASTINT (o->left) + size);
2347 } 2355 }
2348 else 2356 else
2349 { 2357 {