241 |
register struct window *p; |
register struct window *p; |
242 |
|
|
243 |
p = allocate_window (); |
p = allocate_window (); |
244 |
XSETFASTINT (p->sequence_number, ++sequence_number); |
++sequence_number; |
245 |
|
XSETFASTINT (p->sequence_number, sequence_number); |
246 |
XSETFASTINT (p->left_col, 0); |
XSETFASTINT (p->left_col, 0); |
247 |
XSETFASTINT (p->top_line, 0); |
XSETFASTINT (p->top_line, 0); |
248 |
XSETFASTINT (p->total_lines, 0); |
XSETFASTINT (p->total_lines, 0); |
2658 |
--shrinkable; |
--shrinkable; |
2659 |
total_removed += smallest; |
total_removed += smallest; |
2660 |
|
|
2661 |
|
/* We don't know what the smallest is now. */ |
2662 |
|
smallest = total; |
2663 |
|
|
2664 |
/* Out of for, just remove one window at the time and |
/* Out of for, just remove one window at the time and |
2665 |
check again if we have enough space. */ |
check again if we have enough space. */ |
2666 |
break; |
break; |
2685 |
that are left and still can be shrunk. */ |
that are left and still can be shrunk. */ |
2686 |
while (total_shrink > total_removed) |
while (total_shrink > total_removed) |
2687 |
{ |
{ |
2688 |
|
int nonzero_sizes = 0; |
2689 |
|
int nonzero_idx = -1; |
2690 |
|
|
2691 |
|
for (i = 0; i < nchildren; ++i) |
2692 |
|
if (new_sizes[i] > 0) |
2693 |
|
{ |
2694 |
|
++nonzero_sizes; |
2695 |
|
nonzero_idx = i; |
2696 |
|
} |
2697 |
|
|
2698 |
for (i = 0; i < nchildren; ++i) |
for (i = 0; i < nchildren; ++i) |
2699 |
if (new_sizes[i] > min_size) |
if (new_sizes[i] > min_size) |
2700 |
{ |
{ |
2705 |
check again if we have enough space. */ |
check again if we have enough space. */ |
2706 |
break; |
break; |
2707 |
} |
} |
2708 |
|
|
2709 |
|
|
2710 |
|
/* Special case, only one window left. */ |
2711 |
|
if (nonzero_sizes == 1) |
2712 |
|
break; |
2713 |
|
} |
2714 |
|
|
2715 |
|
/* Any surplus due to rounding, we add to windows that are left. */ |
2716 |
|
while (total_shrink < total_removed) |
2717 |
|
{ |
2718 |
|
for (i = 0; i < nchildren; ++i) |
2719 |
|
{ |
2720 |
|
if (new_sizes[i] != 0 && total_shrink < total_removed) |
2721 |
|
{ |
2722 |
|
++new_sizes[i]; |
2723 |
|
--total_removed; |
2724 |
|
break; |
2725 |
|
} |
2726 |
|
} |
2727 |
} |
} |
2728 |
|
|
2729 |
return new_sizes; |
return new_sizes; |
3150 |
w = XWINDOW (window); |
w = XWINDOW (window); |
3151 |
w->frozen_window_start_p = 0; |
w->frozen_window_start_p = 0; |
3152 |
|
|
3153 |
XSETFASTINT (w->use_time, ++window_select_count); |
++window_select_count; |
3154 |
|
XSETFASTINT (w->use_time, window_select_count); |
3155 |
if (EQ (window, selected_window)) |
if (EQ (window, selected_window)) |
3156 |
return window; |
return window; |
3157 |
|
|
3642 |
= ((struct Lisp_Vector *)o)->contents[i]; |
= ((struct Lisp_Vector *)o)->contents[i]; |
3643 |
XSETWINDOW (new, p); |
XSETWINDOW (new, p); |
3644 |
|
|
3645 |
XSETFASTINT (p->sequence_number, ++sequence_number); |
++sequence_number; |
3646 |
|
XSETFASTINT (p->sequence_number, sequence_number); |
3647 |
|
|
3648 |
/* Put new into window structure in place of window */ |
/* Put new into window structure in place of window */ |
3649 |
replace_window (window, new); |
replace_window (window, new); |
4541 |
results for variable height lines. */ |
results for variable height lines. */ |
4542 |
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); |
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); |
4543 |
it.current_y = it.last_visible_y; |
it.current_y = it.last_visible_y; |
4544 |
move_it_vertically (&it, - window_box_height (w) / 2); |
move_it_vertically_backward (&it, window_box_height (w) / 2); |
4545 |
|
|
4546 |
/* The function move_iterator_vertically may move over more than |
/* The function move_iterator_vertically may move over more than |
4547 |
the specified y-distance. If it->w is small, e.g. a |
the specified y-distance. If it->w is small, e.g. a |
4551 |
if (it.current_y <= 0) |
if (it.current_y <= 0) |
4552 |
{ |
{ |
4553 |
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); |
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); |
4554 |
move_it_vertically (&it, 0); |
move_it_vertically_backward (&it, 0); |
4555 |
it.current_y = 0; |
it.current_y = 0; |
4556 |
} |
} |
4557 |
|
|
5220 |
|
|
5221 |
SET_TEXT_POS (pt, PT, PT_BYTE); |
SET_TEXT_POS (pt, PT, PT_BYTE); |
5222 |
start_display (&it, w, pt); |
start_display (&it, w, pt); |
5223 |
move_it_vertically (&it, - window_box_height (w) / 2); |
move_it_vertically_backward (&it, window_box_height (w) / 2); |
5224 |
charpos = IT_CHARPOS (it); |
charpos = IT_CHARPOS (it); |
5225 |
bytepos = IT_BYTEPOS (it); |
bytepos = IT_BYTEPOS (it); |
5226 |
} |
} |
5228 |
{ |
{ |
5229 |
struct it it; |
struct it it; |
5230 |
struct text_pos pt; |
struct text_pos pt; |
5231 |
int y0, y1, h, nlines; |
int nlines = - XINT (arg); |
5232 |
|
int extra_line_spacing; |
5233 |
|
int h = window_box_height (w); |
5234 |
|
|
5235 |
SET_TEXT_POS (pt, PT, PT_BYTE); |
SET_TEXT_POS (pt, PT, PT_BYTE); |
5236 |
start_display (&it, w, pt); |
start_display (&it, w, pt); |
5237 |
y0 = it.current_y; |
|
5238 |
|
/* Be sure we have the exact height of the full line containing PT. */ |
5239 |
|
move_it_by_lines (&it, 0, 1); |
5240 |
|
|
5241 |
/* The amount of pixels we have to move back is the window |
/* The amount of pixels we have to move back is the window |
5242 |
height minus what's displayed in the line containing PT, |
height minus what's displayed in the line containing PT, |
5243 |
and the lines below. */ |
and the lines below. */ |
5244 |
nlines = - XINT (arg) - 1; |
it.current_y = 0; |
5245 |
|
it.vpos = 0; |
5246 |
move_it_by_lines (&it, nlines, 1); |
move_it_by_lines (&it, nlines, 1); |
5247 |
|
|
5248 |
y1 = line_bottom_y (&it); |
if (it.vpos == nlines) |
5249 |
|
h -= it.current_y; |
5250 |
|
else |
5251 |
|
{ |
5252 |
|
/* Last line has no newline */ |
5253 |
|
h -= line_bottom_y (&it); |
5254 |
|
it.vpos++; |
5255 |
|
} |
5256 |
|
|
5257 |
|
/* Don't reserve space for extra line spacing of last line. */ |
5258 |
|
extra_line_spacing = it.max_extra_line_spacing; |
5259 |
|
|
5260 |
/* If we can't move down NLINES lines because we hit |
/* If we can't move down NLINES lines because we hit |
5261 |
the end of the buffer, count in some empty lines. */ |
the end of the buffer, count in some empty lines. */ |
5262 |
if (it.vpos < nlines) |
if (it.vpos < nlines) |
5263 |
y1 += (nlines - it.vpos) * FRAME_LINE_HEIGHT (it.f); |
{ |
5264 |
|
nlines -= it.vpos; |
5265 |
h = window_box_height (w) - (y1 - y0); |
extra_line_spacing = it.extra_line_spacing; |
5266 |
|
h -= nlines * (FRAME_LINE_HEIGHT (it.f) + extra_line_spacing); |
5267 |
|
} |
5268 |
|
if (h <= 0) |
5269 |
|
return Qnil; |
5270 |
|
|
5271 |
|
/* Now find the new top line (starting position) of the window. */ |
5272 |
start_display (&it, w, pt); |
start_display (&it, w, pt); |
5273 |
move_it_vertically (&it, - h); |
it.current_y = 0; |
5274 |
|
move_it_vertically_backward (&it, h); |
5275 |
|
|
5276 |
|
/* If extra line spacing is present, we may move too far |
5277 |
|
back. This causes the last line to be only partially |
5278 |
|
visible (which triggers redisplay to recenter that line |
5279 |
|
in the middle), so move forward. |
5280 |
|
But ignore extra line spacing on last line, as it is not |
5281 |
|
considered to be part of the visible height of the line. |
5282 |
|
*/ |
5283 |
|
h += extra_line_spacing; |
5284 |
|
while (-it.current_y > h) |
5285 |
|
move_it_by_lines (&it, 1, 1); |
5286 |
|
|
5287 |
charpos = IT_CHARPOS (it); |
charpos = IT_CHARPOS (it); |
5288 |
bytepos = IT_BYTEPOS (it); |
bytepos = IT_BYTEPOS (it); |
5289 |
} |
} |
5885 |
p = SAVED_WINDOW_N (vector, i); |
p = SAVED_WINDOW_N (vector, i); |
5886 |
w = XWINDOW (window); |
w = XWINDOW (window); |
5887 |
|
|
5888 |
XSETFASTINT (w->temslot, i++); |
XSETFASTINT (w->temslot, i); i++; |
5889 |
p->window = window; |
p->window = window; |
5890 |
p->buffer = w->buffer; |
p->buffer = w->buffer; |
5891 |
p->left_col = w->left_col; |
p->left_col = w->left_col; |