comparison src/window.c @ 32928:859adc7ac97d

(size_window): Compute size difference from sum of old child window sizes instead of from parent's size.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 26 Oct 2000 20:37:37 +0000
parents 361743be1fa8
children dc58e218a878
comparison
equal deleted inserted replaced
32927:c0b62376988c 32928:859adc7ac97d
2275 /* If the window has been "too small" at one point, 2275 /* If the window has been "too small" at one point,
2276 don't delete it for being "too small" in the future. 2276 don't delete it for being "too small" in the future.
2277 Preserve it as long as that is at all possible. */ 2277 Preserve it as long as that is at all possible. */
2278 if (width_p) 2278 if (width_p)
2279 { 2279 {
2280 old_size = XFASTINT (w->width); 2280 old_size = XINT (w->width);
2281 min_size = window_min_width; 2281 min_size = window_min_width;
2282 } 2282 }
2283 else 2283 else
2284 { 2284 {
2285 old_size = XFASTINT (w->height); 2285 old_size = XINT (w->height);
2286 min_size = window_min_height; 2286 min_size = window_min_height;
2287 } 2287 }
2288 2288
2289 if (old_size < window_min_width) 2289 if (old_size < window_min_width)
2290 w->too_small_ok = Qt; 2290 w->too_small_ok = Qt;
2339 } 2339 }
2340 else if (!NILP (*forward)) 2340 else if (!NILP (*forward))
2341 { 2341 {
2342 int fixed_size, each, extra, n; 2342 int fixed_size, each, extra, n;
2343 int resize_fixed_p, nfixed; 2343 int resize_fixed_p, nfixed;
2344 int last_pos, first_pos, nchildren; 2344 int last_pos, first_pos, nchildren, total;
2345 2345
2346 /* Determine the fixed-size portion of the this window, and the 2346 /* Determine the fixed-size portion of the this window, and the
2347 number of child windows. */ 2347 number of child windows. */
2348 fixed_size = nchildren = nfixed = 0; 2348 fixed_size = nchildren = nfixed = total = 0;
2349 for (child = *forward; !NILP (child); child = c->next, ++nchildren) 2349 for (child = *forward; !NILP (child); child = c->next, ++nchildren)
2350 { 2350 {
2351 int child_size;
2352
2351 c = XWINDOW (child); 2353 c = XWINDOW (child);
2354 child_size = width_p ? XINT (c->width) : XINT (c->height);
2355 total += child_size;
2356
2352 if (window_fixed_size_p (c, width_p, 0)) 2357 if (window_fixed_size_p (c, width_p, 0))
2353 { 2358 {
2354 fixed_size += (width_p 2359 fixed_size += child_size;
2355 ? XFASTINT (c->width) : XFASTINT (c->height));
2356 ++nfixed; 2360 ++nfixed;
2357 } 2361 }
2358 } 2362 }
2359 2363
2360 /* If the new size is smaller than fixed_size, or if there 2364 /* If the new size is smaller than fixed_size, or if there
2363 resize_fixed_p = nfixed == nchildren || size < fixed_size; 2367 resize_fixed_p = nfixed == nchildren || size < fixed_size;
2364 2368
2365 /* Compute how many lines/columns to add to each child. The 2369 /* Compute how many lines/columns to add to each child. The
2366 value of extra takes care of rounding errors. */ 2370 value of extra takes care of rounding errors. */
2367 n = resize_fixed_p ? nchildren : nchildren - nfixed; 2371 n = resize_fixed_p ? nchildren : nchildren - nfixed;
2368 each = (size - old_size) / n; 2372 each = (size - total) / n;
2369 extra = (size - old_size) - n * each; 2373 extra = (size - total) - n * each;
2370 2374
2371 /* Compute new children heights and edge positions. */ 2375 /* Compute new children heights and edge positions. */
2372 first_pos = width_p ? XFASTINT (w->left) : XFASTINT (w->top); 2376 first_pos = width_p ? XINT (w->left) : XINT (w->top);
2373 last_pos = first_pos; 2377 last_pos = first_pos;
2374 for (child = *forward; !NILP (child); child = c->next) 2378 for (child = *forward; !NILP (child); child = c->next)
2375 { 2379 {
2376 int new_size, old_size; 2380 int new_size, old_size;
2377 2381
2410 if (!nodelete_p) 2414 if (!nodelete_p)
2411 for (child = *forward; !NILP (child); child = c->next) 2415 for (child = *forward; !NILP (child); child = c->next)
2412 { 2416 {
2413 int child_size; 2417 int child_size;
2414 c = XWINDOW (child); 2418 c = XWINDOW (child);
2415 child_size = width_p ? XFASTINT (c->width) : XFASTINT (c->height); 2419 child_size = width_p ? XINT (c->width) : XINT (c->height);
2416 size_window (child, child_size, width_p, 0); 2420 size_window (child, child_size, width_p, 0);
2417 } 2421 }
2418 } 2422 }
2419 } 2423 }
2420 2424