diff options
| author | Jan Djärv | 2004-11-14 11:59:21 +0000 |
|---|---|---|
| committer | Jan Djärv | 2004-11-14 11:59:21 +0000 |
| commit | ef614e04c32f6b7f4e17bc3203bb0f809097a6f8 (patch) | |
| tree | 6a20fa96f013385fe3f25c0bd40dd0e3c64f21d6 | |
| parent | 234abfce9586bb95a4033926522286f3400a04dd (diff) | |
| download | emacs-ef614e04c32f6b7f4e17bc3203bb0f809097a6f8.tar.gz emacs-ef614e04c32f6b7f4e17bc3203bb0f809097a6f8.zip | |
* window.c (shrink_windows): Handle special case of one window left
when trying to shrink the final reminder. Grow windows if
total_removed is less than total_shrink.
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/window.c | 32 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7977fd9c9a1..f9ffecff3bc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2004-11-14 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 1 | 2004-11-14 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 2 | ||
| 3 | * window.c (shrink_windows): Handle special case of one window left | ||
| 4 | when trying to shrink the final reminder. Grow windows if | ||
| 5 | total_removed is less than total_shrink. | ||
| 6 | |||
| 3 | * xmenu.c (pop_down_menu): Remove global variable current_menu, | 7 | * xmenu.c (pop_down_menu): Remove global variable current_menu, |
| 4 | extract pointer from arg with XSAVE_VALUE. | 8 | extract pointer from arg with XSAVE_VALUE. |
| 5 | (create_and_show_popup_menu, create_and_show_dialog, | 9 | (create_and_show_popup_menu, create_and_show_dialog, |
diff --git a/src/window.c b/src/window.c index 24be93a3943..7c2fbc60612 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -2657,6 +2657,9 @@ shrink_windows (total, size, nchildren, shrinkable, | |||
| 2657 | --shrinkable; | 2657 | --shrinkable; |
| 2658 | total_removed += smallest; | 2658 | total_removed += smallest; |
| 2659 | 2659 | ||
| 2660 | /* We don't know what the smallest is now. */ | ||
| 2661 | smallest = total; | ||
| 2662 | |||
| 2660 | /* Out of for, just remove one window at the time and | 2663 | /* Out of for, just remove one window at the time and |
| 2661 | check again if we have enough space. */ | 2664 | check again if we have enough space. */ |
| 2662 | break; | 2665 | break; |
| @@ -2681,6 +2684,16 @@ shrink_windows (total, size, nchildren, shrinkable, | |||
| 2681 | that are left and still can be shrunk. */ | 2684 | that are left and still can be shrunk. */ |
| 2682 | while (total_shrink > total_removed) | 2685 | while (total_shrink > total_removed) |
| 2683 | { | 2686 | { |
| 2687 | int nonzero_sizes = 0; | ||
| 2688 | int nonzero_idx = -1; | ||
| 2689 | |||
| 2690 | for (i = 0; i < nchildren; ++i) | ||
| 2691 | if (new_sizes[i] > 0) | ||
| 2692 | { | ||
| 2693 | ++nonzero_sizes; | ||
| 2694 | nonzero_idx = i; | ||
| 2695 | } | ||
| 2696 | |||
| 2684 | for (i = 0; i < nchildren; ++i) | 2697 | for (i = 0; i < nchildren; ++i) |
| 2685 | if (new_sizes[i] > min_size) | 2698 | if (new_sizes[i] > min_size) |
| 2686 | { | 2699 | { |
| @@ -2691,6 +2704,25 @@ shrink_windows (total, size, nchildren, shrinkable, | |||
| 2691 | check again if we have enough space. */ | 2704 | check again if we have enough space. */ |
| 2692 | break; | 2705 | break; |
| 2693 | } | 2706 | } |
| 2707 | |||
| 2708 | |||
| 2709 | /* Special case, only one window left. */ | ||
| 2710 | if (nonzero_sizes == 1) | ||
| 2711 | break; | ||
| 2712 | } | ||
| 2713 | |||
| 2714 | /* Any surplus due to rounding, we add to windows that are left. */ | ||
| 2715 | while (total_shrink < total_removed) | ||
| 2716 | { | ||
| 2717 | for (i = 0; i < nchildren; ++i) | ||
| 2718 | { | ||
| 2719 | if (new_sizes[i] != 0 && total_shrink < total_removed) | ||
| 2720 | { | ||
| 2721 | ++new_sizes[i]; | ||
| 2722 | --total_removed; | ||
| 2723 | break; | ||
| 2724 | } | ||
| 2725 | } | ||
| 2694 | } | 2726 | } |
| 2695 | 2727 | ||
| 2696 | return new_sizes; | 2728 | return new_sizes; |