1 |
/* Window creation, deletion and examination for GNU Emacs. |
/* Window creation, deletion and examination for GNU Emacs. |
2 |
Does not include redisplay. |
Does not include redisplay. |
3 |
Copyright (C) 1985,86,87,93,94,95,96,97,1998,2000, 2001, 2002 |
Copyright (C) 1985,86,87,93,94,95,96,97,1998,2000, 2001, 2002, 2003 |
4 |
Free Software Foundation, Inc. |
Free Software Foundation, Inc. |
5 |
|
|
6 |
This file is part of GNU Emacs. |
This file is part of GNU Emacs. |
48 |
#include "macterm.h" |
#include "macterm.h" |
49 |
#endif |
#endif |
50 |
|
|
|
/* Values returned from coordinates_in_window. */ |
|
|
|
|
|
enum window_part |
|
|
{ |
|
|
ON_NOTHING, |
|
|
ON_TEXT, |
|
|
ON_MODE_LINE, |
|
|
ON_VERTICAL_BORDER, |
|
|
ON_HEADER_LINE, |
|
|
ON_LEFT_FRINGE, |
|
|
ON_RIGHT_FRINGE, |
|
|
ON_LEFT_MARGIN, |
|
|
ON_RIGHT_MARGIN |
|
|
}; |
|
|
|
|
51 |
|
|
52 |
Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; |
Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; |
53 |
Lisp_Object Qwindow_size_fixed; |
Lisp_Object Qwindow_size_fixed; |
54 |
extern Lisp_Object Qleft_margin, Qright_margin; |
extern Lisp_Object Qleft_margin, Qright_margin; |
|
extern Lisp_Object Qheight, Qwidth; |
|
55 |
|
|
56 |
static int displayed_window_lines P_ ((struct window *)); |
static int displayed_window_lines P_ ((struct window *)); |
57 |
static struct window *decode_window P_ ((Lisp_Object)); |
static struct window *decode_window P_ ((Lisp_Object)); |
435 |
|
|
436 |
CHECK_NUMBER (ncol); |
CHECK_NUMBER (ncol); |
437 |
hscroll = max (0, XINT (ncol)); |
hscroll = max (0, XINT (ncol)); |
438 |
|
|
439 |
/* Prevent redisplay shortcuts when changing the hscroll. */ |
/* Prevent redisplay shortcuts when changing the hscroll. */ |
440 |
if (XINT (w->hscroll) != hscroll) |
if (XINT (w->hscroll) != hscroll) |
441 |
XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; |
XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; |
442 |
|
|
443 |
w->hscroll = make_number (hscroll); |
w->hscroll = make_number (hscroll); |
444 |
return ncol; |
return ncol; |
445 |
} |
} |
491 |
} |
} |
492 |
|
|
493 |
/* Test if the character at column *X, row *Y is within window W. |
/* Test if the character at column *X, row *Y is within window W. |
494 |
If it is not, return 0; |
If it is not, return ON_NOTHING; |
495 |
if it is in the window's text area, |
if it is in the window's text area, |
496 |
set *x and *y to its location relative to the upper left corner |
set *x and *y to its location relative to the upper left corner |
497 |
of the window, and |
of the window, and |
498 |
return 1; |
return ON_TEXT; |
499 |
if it is on the window's modeline, return 2; |
if it is on the window's modeline, return ON_MODE_LINE; |
500 |
if it is on the border between the window and its right sibling, |
if it is on the border between the window and its right sibling, |
501 |
return 3. |
return ON_VERTICAL_BORDER. |
502 |
if it is on the window's top line, return 4; |
if it is on the window's top line, return ON_HEADER_LINE; |
503 |
if it is in left or right fringe of the window, |
if it is in left or right fringe of the window, |
504 |
return 5 or 6, and convert *X and *Y to window-relative coordinates; |
return ON_LEFT_FRINGE or ON_RIGHT_FRINGE, and convert *X and *Y |
505 |
|
to window-relative coordinates; |
506 |
if it is in the marginal area to the left/right of the window, |
if it is in the marginal area to the left/right of the window, |
507 |
return 7 or 8, and convert *X and *Y to window-relative coordinates. |
return ON_LEFT_MARGIN or ON_RIGHT_MARGIN, and convert *X and *Y |
508 |
|
to window-relative coordinates. |
509 |
|
|
510 |
X and Y are frame relative pixel coordinates. */ |
X and Y are frame relative pixel coordinates. */ |
511 |
|
|
529 |
|
|
530 |
if (*x < x0 || *x >= x1) |
if (*x < x0 || *x >= x1) |
531 |
return ON_NOTHING; |
return ON_NOTHING; |
532 |
|
|
533 |
/* In what's below, we subtract 1 when computing right_x because we |
/* In what's below, we subtract 1 when computing right_x because we |
534 |
want the rightmost pixel, which is given by left_pixel+width-1. */ |
want the rightmost pixel, which is given by left_pixel+width-1. */ |
535 |
if (w->pseudo_window_p) |
if (w->pseudo_window_p) |
564 |
as the vertical border. If scroll bars on the left, |
as the vertical border. If scroll bars on the left, |
565 |
return the right window. */ |
return the right window. */ |
566 |
part = ON_MODE_LINE; |
part = ON_MODE_LINE; |
567 |
|
|
568 |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) |
569 |
{ |
{ |
570 |
if (abs (*x - x0) < grabbable_width) |
if (abs (*x - x0) < grabbable_width) |
578 |
&& *y >= top_y) |
&& *y >= top_y) |
579 |
{ |
{ |
580 |
part = ON_HEADER_LINE; |
part = ON_HEADER_LINE; |
581 |
|
|
582 |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) |
583 |
{ |
{ |
584 |
if (abs (*x - x0) < grabbable_width) |
if (abs (*x - x0) < grabbable_width) |
612 |
{ |
{ |
613 |
/* Other lines than the mode line don't include fringes and |
/* Other lines than the mode line don't include fringes and |
614 |
scroll bars on the left. */ |
scroll bars on the left. */ |
615 |
|
|
616 |
/* Convert X and Y to window-relative pixel coordinates. */ |
/* Convert X and Y to window-relative pixel coordinates. */ |
617 |
*x -= left_x; |
*x -= left_x; |
618 |
*y -= top_y; |
*y -= top_y; |
645 |
{ |
{ |
646 |
/* Other lines than the mode line don't include fringes and |
/* Other lines than the mode line don't include fringes and |
647 |
scroll bars on the left. */ |
scroll bars on the left. */ |
648 |
|
|
649 |
/* Convert X and Y to window-relative pixel coordinates. */ |
/* Convert X and Y to window-relative pixel coordinates. */ |
650 |
*x -= left_x; |
*x -= left_x; |
651 |
*y -= top_y; |
*y -= top_y; |
730 |
case ON_TEXT: |
case ON_TEXT: |
731 |
/* X and Y are now window relative pixel coordinates. Convert |
/* X and Y are now window relative pixel coordinates. Convert |
732 |
them to canonical char units before returning them. */ |
them to canonical char units before returning them. */ |
733 |
return Fcons (CANON_X_FROM_PIXEL_X (f, x), |
return Fcons (CANON_X_FROM_PIXEL_X (f, x), |
734 |
CANON_Y_FROM_PIXEL_Y (f, y)); |
CANON_Y_FROM_PIXEL_Y (f, y)); |
735 |
|
|
736 |
case ON_MODE_LINE: |
case ON_MODE_LINE: |
744 |
|
|
745 |
case ON_LEFT_FRINGE: |
case ON_LEFT_FRINGE: |
746 |
return Qleft_fringe; |
return Qleft_fringe; |
747 |
|
|
748 |
case ON_RIGHT_FRINGE: |
case ON_RIGHT_FRINGE: |
749 |
return Qright_fringe; |
return Qright_fringe; |
750 |
|
|
751 |
case ON_LEFT_MARGIN: |
case ON_LEFT_MARGIN: |
752 |
return Qleft_margin; |
return Qleft_margin; |
753 |
|
|
754 |
case ON_RIGHT_MARGIN: |
case ON_RIGHT_MARGIN: |
755 |
return Qright_margin; |
return Qright_margin; |
756 |
|
|
772 |
struct check_window_data |
struct check_window_data |
773 |
{ |
{ |
774 |
Lisp_Object *window; |
Lisp_Object *window; |
775 |
int *x, *y, *part; |
int *x, *y; |
776 |
|
enum window_part *part; |
777 |
}; |
}; |
778 |
|
|
779 |
static int |
static int |
788 |
found = coordinates_in_window (w, cw->x, cw->y); |
found = coordinates_in_window (w, cw->x, cw->y); |
789 |
if (found != ON_NOTHING) |
if (found != ON_NOTHING) |
790 |
{ |
{ |
791 |
*cw->part = found - 1; |
*cw->part = found; |
792 |
XSETWINDOW (*cw->window, w); |
XSETWINDOW (*cw->window, w); |
793 |
continue_p = 0; |
continue_p = 0; |
794 |
} |
} |
795 |
|
|
796 |
return continue_p; |
return continue_p; |
797 |
} |
} |
798 |
|
|
799 |
|
|
800 |
/* Find the window containing frame-relative pixel position X/Y and |
/* Find the window containing frame-relative pixel position X/Y and |
801 |
return it as a Lisp_Object. If X, Y is on the window's modeline, |
return it as a Lisp_Object. If X, Y is on one of the window's |
802 |
set *PART to 1; if it is on the separating line between the window |
special `window_part' elements, set *PART to the id of that element. |
803 |
and its right sibling, set it to 2; otherwise set it to 0. If |
If there is no window under X, Y return nil and leave *PART |
|
there is no window under X, Y return nil and leave *PART |
|
804 |
unmodified. TOOL_BAR_P non-zero means detect tool-bar windows. |
unmodified. TOOL_BAR_P non-zero means detect tool-bar windows. |
805 |
|
|
806 |
This function was previously implemented with a loop cycling over |
This function was previously implemented with a loop cycling over |
816 |
window_from_coordinates (f, x, y, part, tool_bar_p) |
window_from_coordinates (f, x, y, part, tool_bar_p) |
817 |
struct frame *f; |
struct frame *f; |
818 |
int x, y; |
int x, y; |
819 |
int *part; |
enum window_part *part; |
820 |
int tool_bar_p; |
int tool_bar_p; |
821 |
{ |
{ |
822 |
Lisp_Object window; |
Lisp_Object window; |
823 |
struct check_window_data cw; |
struct check_window_data cw; |
824 |
|
enum window_part dummy; |
825 |
|
|
826 |
|
if (part == 0) |
827 |
|
part = &dummy; |
828 |
|
|
829 |
window = Qnil; |
window = Qnil; |
830 |
cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part; |
cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part; |
831 |
foreach_window (f, check_window_containing, &cw); |
foreach_window (f, check_window_containing, &cw); |
832 |
|
|
833 |
/* If not found above, see if it's in the tool bar window, if a tool |
/* If not found above, see if it's in the tool bar window, if a tool |
834 |
bar exists. */ |
bar exists. */ |
835 |
if (NILP (window) |
if (NILP (window) |
839 |
&& (coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y) |
&& (coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y) |
840 |
!= ON_NOTHING)) |
!= ON_NOTHING)) |
841 |
{ |
{ |
842 |
*part = 0; |
*part = ON_TEXT; |
843 |
window = f->tool_bar_window; |
window = f->tool_bar_window; |
844 |
} |
} |
845 |
|
|
854 |
(x, y, frame) |
(x, y, frame) |
855 |
Lisp_Object x, y, frame; |
Lisp_Object x, y, frame; |
856 |
{ |
{ |
|
int part; |
|
857 |
struct frame *f; |
struct frame *f; |
858 |
|
|
859 |
if (NILP (frame)) |
if (NILP (frame)) |
865 |
CHECK_NUMBER_OR_FLOAT (x); |
CHECK_NUMBER_OR_FLOAT (x); |
866 |
CHECK_NUMBER_OR_FLOAT (y); |
CHECK_NUMBER_OR_FLOAT (y); |
867 |
|
|
868 |
return window_from_coordinates (f, |
return window_from_coordinates (f, |
869 |
PIXEL_X_FROM_CANON_X (f, x), |
PIXEL_X_FROM_CANON_X (f, x), |
870 |
PIXEL_Y_FROM_CANON_Y (f, y), |
PIXEL_Y_FROM_CANON_Y (f, y), |
871 |
&part, 0); |
0, 0); |
872 |
} |
} |
873 |
|
|
874 |
DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, |
DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, |
947 |
struct buffer *old_buffer = NULL, *b = XBUFFER (buf); |
struct buffer *old_buffer = NULL, *b = XBUFFER (buf); |
948 |
|
|
949 |
/* In case W->start is out of the range, use something |
/* In case W->start is out of the range, use something |
950 |
reasonable. This situation occured when loading a file with |
reasonable. This situation occurred when loading a file with |
951 |
`-l' containing a call to `rmail' with subsequent other |
`-l' containing a call to `rmail' with subsequent other |
952 |
commands. At the end, W->start happened to be BEG, while |
commands. At the end, W->start happened to be BEG, while |
953 |
rmail had already narrowed the buffer. */ |
rmail had already narrowed the buffer. */ |
965 |
old_buffer = current_buffer; |
old_buffer = current_buffer; |
966 |
set_buffer_internal (b); |
set_buffer_internal (b); |
967 |
} |
} |
968 |
|
|
969 |
start_display (&it, w, startp); |
start_display (&it, w, startp); |
970 |
move_it_vertically (&it, window_box_height (w)); |
move_it_vertically (&it, window_box_height (w)); |
971 |
if (it.current_y < it.last_visible_y) |
if (it.current_y < it.last_visible_y) |
972 |
move_it_past_eol (&it); |
move_it_past_eol (&it); |
973 |
value = make_number (IT_CHARPOS (it)); |
value = make_number (IT_CHARPOS (it)); |
974 |
|
|
975 |
if (old_buffer) |
if (old_buffer) |
976 |
set_buffer_internal (old_buffer); |
set_buffer_internal (old_buffer); |
977 |
} |
} |
999 |
the new value of point. */ |
the new value of point. */ |
1000 |
if (!EQ (window, selected_window)) |
if (!EQ (window, selected_window)) |
1001 |
++windows_or_buffers_changed; |
++windows_or_buffers_changed; |
1002 |
|
|
1003 |
return pos; |
return pos; |
1004 |
} |
} |
1005 |
|
|
1082 |
else if (BUFFERP (w->buffer)) |
else if (BUFFERP (w->buffer)) |
1083 |
{ |
{ |
1084 |
struct buffer *b = XBUFFER (w->buffer); |
struct buffer *b = XBUFFER (w->buffer); |
1085 |
|
|
1086 |
if (DISP_TABLE_P (b->display_table)) |
if (DISP_TABLE_P (b->display_table)) |
1087 |
dp = XCHAR_TABLE (b->display_table); |
dp = XCHAR_TABLE (b->display_table); |
1088 |
else if (DISP_TABLE_P (Vstandard_display_table)) |
else if (DISP_TABLE_P (Vstandard_display_table)) |
1148 |
clip_to_bounds (BUF_BEGV_BYTE (b), |
clip_to_bounds (BUF_BEGV_BYTE (b), |
1149 |
marker_byte_position (w->pointm), |
marker_byte_position (w->pointm), |
1150 |
BUF_ZV_BYTE (b))); |
BUF_ZV_BYTE (b))); |
1151 |
|
|
1152 |
if (WINDOWP (b->last_selected_window) |
if (WINDOWP (b->last_selected_window) |
1153 |
&& w == XWINDOW (b->last_selected_window)) |
&& w == XWINDOW (b->last_selected_window)) |
1154 |
b->last_selected_window = Qnil; |
b->last_selected_window = Qnil; |
1430 |
Vwindow_list = Fnconc (2, args); |
Vwindow_list = Fnconc (2, args); |
1431 |
} |
} |
1432 |
} |
} |
1433 |
|
|
1434 |
return Vwindow_list; |
return Vwindow_list; |
1435 |
} |
} |
1436 |
|
|
1507 |
*window = selected_window; |
*window = selected_window; |
1508 |
else |
else |
1509 |
CHECK_LIVE_WINDOW (*window); |
CHECK_LIVE_WINDOW (*window); |
1510 |
|
|
1511 |
/* MINIBUF nil may or may not include minibuffers. Decide if it |
/* MINIBUF nil may or may not include minibuffers. Decide if it |
1512 |
does. */ |
does. */ |
1513 |
if (NILP (*minibuf)) |
if (NILP (*minibuf)) |
1514 |
*minibuf = minibuf_level ? minibuf_window : Qlambda; |
*minibuf = minibuf_level ? minibuf_window : Qlambda; |
1515 |
else if (!EQ (*minibuf, Qt)) |
else if (!EQ (*minibuf, Qt)) |
1516 |
*minibuf = Qlambda; |
*minibuf = Qlambda; |
1517 |
|
|
1518 |
/* Now *MINIBUF can be t => count all minibuffer windows, `lambda' |
/* Now *MINIBUF can be t => count all minibuffer windows, `lambda' |
1519 |
=> count none of them, or a specific minibuffer window (the |
=> count none of them, or a specific minibuffer window (the |
1520 |
active one) to count. */ |
active one) to count. */ |
1532 |
; |
; |
1533 |
else if (!EQ (*all_frames, Qt)) |
else if (!EQ (*all_frames, Qt)) |
1534 |
*all_frames = Qnil; |
*all_frames = Qnil; |
1535 |
|
|
1536 |
/* Now *ALL_FRAMES is t meaning search all frames, nil meaning |
/* Now *ALL_FRAMES is t meaning search all frames, nil meaning |
1537 |
search just current frame, `visible' meaning search just visible |
search just current frame, `visible' meaning search just visible |
1538 |
frames, 0 meaning search visible and iconified frames, or a |
frames, 0 meaning search visible and iconified frames, or a |
1552 |
int next_p; |
int next_p; |
1553 |
{ |
{ |
1554 |
decode_next_window_args (&window, &minibuf, &all_frames); |
decode_next_window_args (&window, &minibuf, &all_frames); |
1555 |
|
|
1556 |
/* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just |
/* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just |
1557 |
return the first window on the frame. */ |
return the first window on the frame. */ |
1558 |
if (FRAMEP (all_frames) |
if (FRAMEP (all_frames) |
1559 |
&& !EQ (all_frames, XWINDOW (window)->frame)) |
&& !EQ (all_frames, XWINDOW (window)->frame)) |
1560 |
return Fframe_first_window (all_frames); |
return Fframe_first_window (all_frames); |
1561 |
|
|
1562 |
if (next_p) |
if (next_p) |
1563 |
{ |
{ |
1564 |
Lisp_Object list; |
Lisp_Object list; |
1565 |
|
|
1566 |
/* Find WINDOW in the list of all windows. */ |
/* Find WINDOW in the list of all windows. */ |
1567 |
list = Fmemq (window, window_list ()); |
list = Fmemq (window, window_list ()); |
1568 |
|
|
1586 |
else |
else |
1587 |
{ |
{ |
1588 |
Lisp_Object candidate, list; |
Lisp_Object candidate, list; |
1589 |
|
|
1590 |
/* Scan through the list of windows for candidates. If there are |
/* Scan through the list of windows for candidates. If there are |
1591 |
candidate windows in front of WINDOW, the last one of these |
candidate windows in front of WINDOW, the last one of these |
1592 |
is the one we want. If there are candidates following WINDOW |
is the one we want. If there are candidates following WINDOW |
1692 |
|
|
1693 |
CHECK_NUMBER (arg); |
CHECK_NUMBER (arg); |
1694 |
window = selected_window; |
window = selected_window; |
1695 |
|
|
1696 |
for (i = XINT (arg); i > 0; --i) |
for (i = XINT (arg); i > 0; --i) |
1697 |
window = Fnext_window (window, Qnil, all_frames); |
window = Fnext_window (window, Qnil, all_frames); |
1698 |
for (; i < 0; ++i) |
for (; i < 0; ++i) |
1737 |
|
|
1738 |
decode_next_window_args (&window, &minibuf, &all_frames); |
decode_next_window_args (&window, &minibuf, &all_frames); |
1739 |
list = Qnil; |
list = Qnil; |
1740 |
|
|
1741 |
for (tail = window_list (); CONSP (tail); tail = XCDR (tail)) |
for (tail = window_list (); CONSP (tail); tail = XCDR (tail)) |
1742 |
if (candidate_window_p (XCAR (tail), window, minibuf, all_frames)) |
if (candidate_window_p (XCAR (tail), window, minibuf, all_frames)) |
1743 |
list = Fcons (XCAR (tail), list); |
list = Fcons (XCAR (tail), list); |
1744 |
|
|
1745 |
return Fnreverse (list); |
return Fnreverse (list); |
1746 |
} |
} |
1747 |
|
|
1776 |
Lisp_Object window, windows, best_window, frame_arg; |
Lisp_Object window, windows, best_window, frame_arg; |
1777 |
struct frame *f; |
struct frame *f; |
1778 |
struct gcpro gcpro1; |
struct gcpro gcpro1; |
1779 |
|
|
1780 |
/* If we're only looping through windows on a particular frame, |
/* If we're only looping through windows on a particular frame, |
1781 |
frame points to that frame. If we're looping through windows |
frame points to that frame. If we're looping through windows |
1782 |
on all frames, frame is 0. */ |
on all frames, frame is 0. */ |
1786 |
f = SELECTED_FRAME (); |
f = SELECTED_FRAME (); |
1787 |
else |
else |
1788 |
f = NULL; |
f = NULL; |
1789 |
|
|
1790 |
if (f) |
if (f) |
1791 |
frame_arg = Qlambda; |
frame_arg = Qlambda; |
1792 |
else if (XFASTINT (frames) == 0) |
else if (XFASTINT (frames) == 0) |
1815 |
for (; CONSP (windows); windows = CDR (windows)) |
for (; CONSP (windows); windows = CDR (windows)) |
1816 |
{ |
{ |
1817 |
struct window *w; |
struct window *w; |
1818 |
|
|
1819 |
window = XCAR (windows); |
window = XCAR (windows); |
1820 |
w = XWINDOW (window); |
w = XWINDOW (window); |
1821 |
|
|
1822 |
/* Note that we do not pay attention here to whether the frame |
/* Note that we do not pay attention here to whether the frame |
1823 |
is visible, since Fwindow_list skips non-visible frames if |
is visible, since Fwindow_list skips non-visible frames if |
1824 |
that is desired, under the control of frame_arg. */ |
that is desired, under the control of frame_arg. */ |
1850 |
if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (w)) |
if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (w)) |
1851 |
break; |
break; |
1852 |
/* Ignore dedicated windows and minibuffers. */ |
/* Ignore dedicated windows and minibuffers. */ |
1853 |
if (MINI_WINDOW_P (w) || !NILP (w->dedicated)) |
if (MINI_WINDOW_P (w) || EQ (w->dedicated, Qt)) |
1854 |
break; |
break; |
1855 |
if (NILP (best_window) |
if (NILP (best_window) |
1856 |
|| (XFASTINT (XWINDOW (best_window)->use_time) |
|| (XFASTINT (XWINDOW (best_window)->use_time) |
1880 |
&& EQ (XWINDOW (XCAR (windows))->frame, |
&& EQ (XWINDOW (XCAR (windows))->frame, |
1881 |
XWINDOW (XCAR (XCDR (windows)))->frame)) |
XWINDOW (XCAR (XCDR (windows)))->frame)) |
1882 |
windows = XCDR (windows); |
windows = XCDR (windows); |
1883 |
|
|
1884 |
/* Now we can safely delete the frame. */ |
/* Now we can safely delete the frame. */ |
1885 |
Fdelete_frame (w->frame, Qnil); |
Fdelete_frame (w->frame, Qnil); |
1886 |
} |
} |
1903 |
case GET_LARGEST_WINDOW: |
case GET_LARGEST_WINDOW: |
1904 |
{ |
{ |
1905 |
/* Ignore dedicated windows and minibuffers. */ |
/* Ignore dedicated windows and minibuffers. */ |
1906 |
if (MINI_WINDOW_P (w) || !NILP (w->dedicated)) |
if (MINI_WINDOW_P (w) || EQ (w->dedicated, Qt)) |
1907 |
break; |
break; |
1908 |
|
|
1909 |
if (NILP (best_window)) |
if (NILP (best_window)) |
1910 |
best_window = window; |
best_window = window; |
1911 |
else |
else |
1923 |
{ |
{ |
1924 |
Lisp_Object buffer; |
Lisp_Object buffer; |
1925 |
struct frame *f = XFRAME (w->frame); |
struct frame *f = XFRAME (w->frame); |
1926 |
|
|
1927 |
/* Find another buffer to show in this window. */ |
/* Find another buffer to show in this window. */ |
1928 |
buffer = Fother_buffer (obj, Qnil, w->frame); |
buffer = Fother_buffer (obj, Qnil, w->frame); |
1929 |
|
|
1930 |
/* If this window is dedicated, and in a frame of its own, |
/* If this window is dedicated, and in a frame of its own, |
1931 |
kill the frame. */ |
kill the frame. */ |
1932 |
if (EQ (window, FRAME_ROOT_WINDOW (f)) |
if (EQ (window, FRAME_ROOT_WINDOW (f)) |
1939 |
&& EQ (XWINDOW (XCAR (windows))->frame, |
&& EQ (XWINDOW (XCAR (windows))->frame, |
1940 |
XWINDOW (XCAR (XCDR (windows)))->frame)) |
XWINDOW (XCAR (XCDR (windows)))->frame)) |
1941 |
windows = XCDR (windows); |
windows = XCDR (windows); |
1942 |
|
|
1943 |
/* Now we can safely delete the frame. */ |
/* Now we can safely delete the frame. */ |
1944 |
Fdelete_frame (w->frame, Qnil); |
Fdelete_frame (w->frame, Qnil); |
1945 |
} |
} |
1946 |
|
else if (!NILP (w->dedicated) && !NILP (w->parent)) |
1947 |
|
{ |
1948 |
|
Lisp_Object window; |
1949 |
|
XSETWINDOW (window, w); |
1950 |
|
/* If this window is dedicated and not the only window |
1951 |
|
in its frame, then kill it. */ |
1952 |
|
Fdelete_window (window); |
1953 |
|
} |
1954 |
else |
else |
1955 |
{ |
{ |
1956 |
/* Otherwise show a different buffer in the window. */ |
/* Otherwise show a different buffer in the window. */ |
2125 |
CHECK_BUFFER (buffer); |
CHECK_BUFFER (buffer); |
2126 |
window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, frame); |
window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, frame); |
2127 |
} |
} |
2128 |
|
|
2129 |
return Qnil; |
return Qnil; |
2130 |
} |
} |
2131 |
|
|
2201 |
= ((FRAME_MINIBUF_ONLY_P (frame) || ! FRAME_HAS_MINIBUF_P (frame)) |
= ((FRAME_MINIBUF_ONLY_P (frame) || ! FRAME_HAS_MINIBUF_P (frame)) |
2202 |
? MIN_SAFE_WINDOW_HEIGHT |
? MIN_SAFE_WINDOW_HEIGHT |
2203 |
: 2 * MIN_SAFE_WINDOW_HEIGHT); |
: 2 * MIN_SAFE_WINDOW_HEIGHT); |
2204 |
|
|
2205 |
if (FRAME_TOP_MARGIN (frame) > 0) |
if (FRAME_TOP_MARGIN (frame) > 0) |
2206 |
min_height += FRAME_TOP_MARGIN (frame); |
min_height += FRAME_TOP_MARGIN (frame); |
2207 |
|
|
2225 |
{ |
{ |
2226 |
int fixed_p; |
int fixed_p; |
2227 |
struct window *c; |
struct window *c; |
2228 |
|
|
2229 |
if (!NILP (w->hchild)) |
if (!NILP (w->hchild)) |
2230 |
{ |
{ |
2231 |
c = XWINDOW (w->hchild); |
c = XWINDOW (w->hchild); |
2232 |
|
|
2233 |
if (width_p) |
if (width_p) |
2234 |
{ |
{ |
2235 |
/* A horiz. combination is fixed-width if all of if its |
/* A horiz. combination is fixed-width if all of if its |
2250 |
else if (!NILP (w->vchild)) |
else if (!NILP (w->vchild)) |
2251 |
{ |
{ |
2252 |
c = XWINDOW (w->vchild); |
c = XWINDOW (w->vchild); |
2253 |
|
|
2254 |
if (width_p) |
if (width_p) |
2255 |
{ |
{ |
2256 |
/* A vert. combination is fixed-width if one of if its |
/* A vert. combination is fixed-width if one of if its |
2276 |
{ |
{ |
2277 |
struct buffer *old = current_buffer; |
struct buffer *old = current_buffer; |
2278 |
Lisp_Object val; |
Lisp_Object val; |
2279 |
|
|
2280 |
current_buffer = XBUFFER (w->buffer); |
current_buffer = XBUFFER (w->buffer); |
2281 |
val = find_symbol_value (Qwindow_size_fixed); |
val = find_symbol_value (Qwindow_size_fixed); |
2282 |
current_buffer = old; |
current_buffer = old; |
2285 |
if (!EQ (val, Qunbound)) |
if (!EQ (val, Qunbound)) |
2286 |
{ |
{ |
2287 |
fixed_p = !NILP (val); |
fixed_p = !NILP (val); |
2288 |
|
|
2289 |
if (fixed_p |
if (fixed_p |
2290 |
&& ((EQ (val, Qheight) && width_p) |
&& ((EQ (val, Qheight) && width_p) |
2291 |
|| (EQ (val, Qwidth) && !width_p))) |
|| (EQ (val, Qwidth) && !width_p))) |
2298 |
if (!fixed_p && check_siblings_p && WINDOWP (w->parent)) |
if (!fixed_p && check_siblings_p && WINDOWP (w->parent)) |
2299 |
{ |
{ |
2300 |
Lisp_Object child; |
Lisp_Object child; |
2301 |
|
|
2302 |
for (child = w->prev; !NILP (child); child = XWINDOW (child)->prev) |
for (child = w->prev; !NILP (child); child = XWINDOW (child)->prev) |
2303 |
if (!window_fixed_size_p (XWINDOW (child), width_p, 0)) |
if (!window_fixed_size_p (XWINDOW (child), width_p, 0)) |
2304 |
break; |
break; |
2317 |
|
|
2318 |
return fixed_p; |
return fixed_p; |
2319 |
} |
} |
2320 |
|
|
2321 |
|
|
2322 |
/* Return the minimum size of window W, not taking fixed-width windows |
/* Return the minimum size of window W, not taking fixed-width windows |
2323 |
into account. WIDTH_P non-zero means return the minimum width, |
into account. WIDTH_P non-zero means return the minimum width, |
2331 |
{ |
{ |
2332 |
struct window *c; |
struct window *c; |
2333 |
int size; |
int size; |
2334 |
|
|
2335 |
if (!NILP (w->hchild)) |
if (!NILP (w->hchild)) |
2336 |
{ |
{ |
2337 |
c = XWINDOW (w->hchild); |
c = XWINDOW (w->hchild); |
2338 |
size = 0; |
size = 0; |
2339 |
|
|
2340 |
if (width_p) |
if (width_p) |
2341 |
{ |
{ |
2342 |
/* The min width of a horizontal combination is |
/* The min width of a horizontal combination is |
2363 |
{ |
{ |
2364 |
c = XWINDOW (w->vchild); |
c = XWINDOW (w->vchild); |
2365 |
size = 0; |
size = 0; |
2366 |
|
|
2367 |
if (width_p) |
if (width_p) |
2368 |
{ |
{ |
2369 |
/* The min width of a vertical combination is |
/* The min width of a vertical combination is |
2422 |
fixed_p = 0; |
fixed_p = 0; |
2423 |
else |
else |
2424 |
fixed_p = window_fixed_size_p (w, width_p, 1); |
fixed_p = window_fixed_size_p (w, width_p, 1); |
2425 |
|
|
2426 |
if (fixed) |
if (fixed) |
2427 |
*fixed = fixed_p; |
*fixed = fixed_p; |
2428 |
|
|
2429 |
if (fixed_p) |
if (fixed_p) |
2430 |
size = width_p ? XFASTINT (w->width) : XFASTINT (w->height); |
size = width_p ? XFASTINT (w->width) : XFASTINT (w->height); |
2431 |
else |
else |
2432 |
size = window_min_size_1 (w, width_p); |
size = window_min_size_1 (w, width_p); |
2433 |
|
|
2434 |
return size; |
return size; |
2435 |
} |
} |
2436 |
|
|
2459 |
|
|
2460 |
check_min_window_sizes (); |
check_min_window_sizes (); |
2461 |
size = max (0, size); |
size = max (0, size); |
2462 |
|
|
2463 |
/* If the window has been "too small" at one point, |
/* If the window has been "too small" at one point, |
2464 |
don't delete it for being "too small" in the future. |
don't delete it for being "too small" in the future. |
2465 |
Preserve it as long as that is at all possible. */ |
Preserve it as long as that is at all possible. */ |
2484 |
min_size = width_p ? MIN_SAFE_WINDOW_WIDTH : MIN_SAFE_WINDOW_HEIGHT; |
min_size = width_p ? MIN_SAFE_WINDOW_WIDTH : MIN_SAFE_WINDOW_HEIGHT; |
2485 |
else |
else |
2486 |
min_size = width_p ? window_min_width : window_min_height; |
min_size = width_p ? window_min_width : window_min_height; |
2487 |
|
|
2488 |
if (size < min_size) |
if (size < min_size) |
2489 |
{ |
{ |
2490 |
delete_window (window); |
delete_window (window); |
2536 |
for (child = *forward; !NILP (child); child = c->next, ++nchildren) |
for (child = *forward; !NILP (child); child = c->next, ++nchildren) |
2537 |
{ |
{ |
2538 |
int child_size; |
int child_size; |
2539 |
|
|
2540 |
c = XWINDOW (child); |
c = XWINDOW (child); |
2541 |
child_size = width_p ? XINT (c->width) : XINT (c->height); |
child_size = width_p ? XINT (c->width) : XINT (c->height); |
2542 |
total += child_size; |
total += child_size; |
2543 |
|
|
2544 |
if (window_fixed_size_p (c, width_p, 0)) |
if (window_fixed_size_p (c, width_p, 0)) |
2545 |
{ |
{ |
2546 |
fixed_size += child_size; |
fixed_size += child_size; |
2565 |
for (child = *forward; !NILP (child); child = c->next) |
for (child = *forward; !NILP (child); child = c->next) |
2566 |
{ |
{ |
2567 |
int new_size, old_size; |
int new_size, old_size; |
2568 |
|
|
2569 |
c = XWINDOW (child); |
c = XWINDOW (child); |
2570 |
old_size = width_p ? XFASTINT (c->width) : XFASTINT (c->height); |
old_size = width_p ? XFASTINT (c->width) : XFASTINT (c->height); |
2571 |
new_size = old_size; |
new_size = old_size; |
2583 |
new_size = old_size + each + extra; |
new_size = old_size + each + extra; |
2584 |
extra = 0; |
extra = 0; |
2585 |
} |
} |
2586 |
|
|
2587 |
/* Set new height. Note that size_window also propagates |
/* Set new height. Note that size_window also propagates |
2588 |
edge positions to children, so it's not a no-op if we |
edge positions to children, so it's not a no-op if we |
2589 |
didn't change the child's size. */ |
didn't change the child's size. */ |
2596 |
|
|
2597 |
/* We should have covered the parent exactly with child windows. */ |
/* We should have covered the parent exactly with child windows. */ |
2598 |
xassert (size == last_pos - first_pos); |
xassert (size == last_pos - first_pos); |
2599 |
|
|
2600 |
/* Now delete any children that became too small. */ |
/* Now delete any children that became too small. */ |
2601 |
if (!nodelete_p) |
if (!nodelete_p) |
2602 |
for (child = *forward; !NILP (child); child = c->next) |
for (child = *forward; !NILP (child); child = c->next) |
2638 |
size_window (window, width, 1, nodelete); |
size_window (window, width, 1, nodelete); |
2639 |
} |
} |
2640 |
|
|
2641 |
|
/* Change window heights in windows rooted in WINDOW by N lines. */ |
2642 |
|
|
2643 |
|
void |
2644 |
|
change_window_heights (window, n) |
2645 |
|
Lisp_Object window; |
2646 |
|
int n; |
2647 |
|
{ |
2648 |
|
struct window *w = XWINDOW (window); |
2649 |
|
|
2650 |
|
XSETFASTINT (w->top, XFASTINT (w->top) + n); |
2651 |
|
XSETFASTINT (w->height, XFASTINT (w->height) - n); |
2652 |
|
|
2653 |
|
if (INTEGERP (w->orig_top)) |
2654 |
|
XSETFASTINT (w->orig_top, XFASTINT (w->orig_top) + n); |
2655 |
|
if (INTEGERP (w->orig_height)) |
2656 |
|
XSETFASTINT (w->orig_height, XFASTINT (w->orig_height) - n); |
2657 |
|
|
2658 |
|
/* Handle just the top child in a vertical split. */ |
2659 |
|
if (!NILP (w->vchild)) |
2660 |
|
change_window_heights (w->vchild, n); |
2661 |
|
|
2662 |
|
/* Adjust all children in a horizontal split. */ |
2663 |
|
for (window = w->hchild; !NILP (window); window = w->next) |
2664 |
|
{ |
2665 |
|
w = XWINDOW (window); |
2666 |
|
change_window_heights (window, n); |
2667 |
|
} |
2668 |
|
} |
2669 |
|
|
2670 |
|
|
2671 |
int window_select_count; |
int window_select_count; |
2672 |
|
|
2690 |
{ |
{ |
2691 |
struct window *w = XWINDOW (window); |
struct window *w = XWINDOW (window); |
2692 |
struct buffer *b = XBUFFER (buffer); |
struct buffer *b = XBUFFER (buffer); |
2693 |
int count = specpdl_ptr - specpdl; |
int count = SPECPDL_INDEX (); |
2694 |
|
|
2695 |
w->buffer = buffer; |
w->buffer = buffer; |
2696 |
|
|
2773 |
{ |
{ |
2774 |
if (!NILP (w->dedicated) && !EQ (tem, buffer)) |
if (!NILP (w->dedicated) && !EQ (tem, buffer)) |
2775 |
error ("Window is dedicated to `%s'", |
error ("Window is dedicated to `%s'", |
2776 |
XSTRING (XBUFFER (tem)->name)->data); |
SDATA (XBUFFER (tem)->name)); |
2777 |
|
|
2778 |
unshow_buffer (w); |
unshow_buffer (w); |
2779 |
} |
} |
2785 |
DEFUN ("select-window", Fselect_window, Sselect_window, 1, 1, 0, |
DEFUN ("select-window", Fselect_window, Sselect_window, 1, 1, 0, |
2786 |
doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer. |
doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer. |
2787 |
If WINDOW is not already selected, also make WINDOW's buffer current. |
If WINDOW is not already selected, also make WINDOW's buffer current. |
2788 |
|
Also make WINDOW the frame's selected window. |
2789 |
|
|
2790 |
Note that the main editor command loop |
Note that the main editor command loop |
2791 |
selects the buffer of the selected window before each command. */) |
selects the buffer of the selected window before each command. */) |
2792 |
(window) |
(window) |
2797 |
|
|
2798 |
/* Note that selected_window can be nil |
/* Note that selected_window can be nil |
2799 |
when this is called from Fset_window_configuration. */ |
when this is called from Fset_window_configuration. */ |
2800 |
|
|
2801 |
static Lisp_Object |
static Lisp_Object |
2802 |
select_window_1 (window, recordflag) |
select_window_1 (window, recordflag) |
2803 |
register Lisp_Object window; |
register Lisp_Object window; |
2880 |
{ |
{ |
2881 |
Lisp_Object frame = XWINDOW (window)->frame; |
Lisp_Object frame = XWINDOW (window)->frame; |
2882 |
FRAME_PTR f = XFRAME (frame); |
FRAME_PTR f = XFRAME (frame); |
2883 |
|
|
2884 |
FRAME_SAMPLE_VISIBILITY (f); |
FRAME_SAMPLE_VISIBILITY (f); |
2885 |
|
|
2886 |
if (!EQ (frame, selected_frame)) |
if (!EQ (frame, selected_frame)) |
2887 |
{ |
{ |
2888 |
if (FRAME_ICONIFIED_P (f)) |
if (FRAME_ICONIFIED_P (f)) |
2890 |
else if (FRAME_VISIBLE_P (f)) |
else if (FRAME_VISIBLE_P (f)) |
2891 |
Fraise_frame (frame); |
Fraise_frame (frame); |
2892 |
} |
} |
2893 |
|
|
2894 |
return window; |
return window; |
2895 |
} |
} |
2896 |
|
|
2926 |
return XCDR (car); |
return XCDR (car); |
2927 |
} |
} |
2928 |
return Qnil; |
return Qnil; |
2929 |
} |
} |
2930 |
|
|
2931 |
DEFUN ("same-window-p", Fsame_window_p, Ssame_window_p, 1, 1, 0, |
DEFUN ("same-window-p", Fsame_window_p, Ssame_window_p, 1, 1, 0, |
2932 |
doc: /* Returns non-nil if a new buffer named BUFFER-NAME would use the same window. |
doc: /* Returns non-nil if a new buffer named BUFFER-NAME would use the same window. |
3029 |
XSETFASTINT (tem, 0); |
XSETFASTINT (tem, 0); |
3030 |
else |
else |
3031 |
XSETFRAME (tem, last_nonminibuf_frame); |
XSETFRAME (tem, last_nonminibuf_frame); |
3032 |
|
|
3033 |
window = Fget_buffer_window (buffer, tem); |
window = Fget_buffer_window (buffer, tem); |
3034 |
if (!NILP (window) |
if (!NILP (window) |
3035 |
&& (NILP (not_this_window) || !EQ (window, selected_window))) |
&& (NILP (not_this_window) || !EQ (window, selected_window))) |
3066 |
frames = Qnil; |
frames = Qnil; |
3067 |
if (FRAME_MINIBUF_ONLY_P (f)) |
if (FRAME_MINIBUF_ONLY_P (f)) |
3068 |
XSETFRAME (frames, last_nonminibuf_frame); |
XSETFRAME (frames, last_nonminibuf_frame); |
3069 |
/* Don't try to create a window if would get an error */ |
/* Don't try to create a window if we would get an error. */ |
3070 |
if (split_height_threshold < window_min_height << 1) |
if (split_height_threshold < window_min_height << 1) |
3071 |
split_height_threshold = window_min_height << 1; |
split_height_threshold = window_min_height << 1; |
3072 |
|
|
3173 |
BEGV = BEG; |
BEGV = BEG; |
3174 |
ZV = Z; |
ZV = Z; |
3175 |
SET_PT (BEG); |
SET_PT (BEG); |
3176 |
|
#if 0 /* rms: there should be no reason for this. */ |
3177 |
XBUFFER (buf)->prevent_redisplay_optimizations_p = 1; |
XBUFFER (buf)->prevent_redisplay_optimizations_p = 1; |
3178 |
|
#endif |
3179 |
set_buffer_internal (old); |
set_buffer_internal (old); |
3180 |
|
|
3181 |
if (!EQ (Vtemp_buffer_show_function, Qnil)) |
if (!EQ (Vtemp_buffer_show_function, Qnil)) |
3194 |
set_marker_restricted_both (w->pointm, buf, 1, 1); |
set_marker_restricted_both (w->pointm, buf, 1, 1); |
3195 |
|
|
3196 |
/* Run temp-buffer-show-hook, with the chosen window selected |
/* Run temp-buffer-show-hook, with the chosen window selected |
3197 |
and it sbuffer current. */ |
and its buffer current. */ |
3198 |
if (!NILP (Vrun_hooks)) |
if (!NILP (Vrun_hooks)) |
3199 |
{ |
{ |
3200 |
Lisp_Object tem; |
Lisp_Object tem; |
3204 |
tem = Fsymbol_value (Qtemp_buffer_show_hook); |
tem = Fsymbol_value (Qtemp_buffer_show_hook); |
3205 |
if (!NILP (tem)) |
if (!NILP (tem)) |
3206 |
{ |
{ |
3207 |
int count = specpdl_ptr - specpdl; |
int count = SPECPDL_INDEX (); |
3208 |
Lisp_Object prev_window; |
Lisp_Object prev_window; |
3209 |
prev_window = selected_window; |
prev_window = selected_window; |
3210 |
|
|
3211 |
/* Select the window that was chosen, for running the hook. */ |
/* Select the window that was chosen, for running the hook. */ |
3212 |
|
/* Both this Fselect_window and the select_window_1 |
3213 |
|
below will (may) incorrectly set-buffer to the buffer |
3214 |
|
displayed in the window. --stef */ |
3215 |
record_unwind_protect (Fselect_window, prev_window); |
record_unwind_protect (Fselect_window, prev_window); |
3216 |
select_window_1 (window, 0); |
select_window_1 (window, 0); |
3217 |
Fset_buffer (w->buffer); |
Fset_buffer (w->buffer); |
3399 |
return Qnil; |
return Qnil; |
3400 |
} |
} |
3401 |
|
|
3402 |
DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p", |
DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 3, "p", |
3403 |
doc: /* Make current window ARG lines smaller. |
doc: /* Make current window ARG lines smaller. |
3404 |
From program, optional second arg non-nil means shrink sideways arg columns. |
From program, optional second arg non-nil means shrink sideways arg columns. |
3405 |
Interactively, if an argument is not given, make the window one line smaller. */) |
Interactively, if an argument is not given, make the window one line smaller. |
3406 |
(arg, side) |
|
3407 |
register Lisp_Object arg, side; |
Optional third arg PRESERVE-BEFORE, if non-nil, means do not change the size |
3408 |
|
of the siblings above or to the left of the selected window. Only |
3409 |
|
siblings to the right or below are changed. */) |
3410 |
|
(arg, side, preserve_before) |
3411 |
|
register Lisp_Object arg, side, preserve_before; |
3412 |
{ |
{ |
3413 |
CHECK_NUMBER (arg); |
CHECK_NUMBER (arg); |
3414 |
enlarge_window (selected_window, -XINT (arg), !NILP (side), 0); |
enlarge_window (selected_window, -XINT (arg), !NILP (side), |
3415 |
|
!NILP (preserve_before)); |
3416 |
|
|
3417 |
if (! NILP (Vwindow_configuration_change_hook)) |
if (! NILP (Vwindow_configuration_change_hook)) |
3418 |
call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
3436 |
return XFASTINT (p->width); |
return XFASTINT (p->width); |
3437 |
} |
} |
3438 |
|
|
3439 |
|
|
3440 |
#define CURBEG(w) \ |
#define CURBEG(w) \ |
3441 |
*(widthflag ? &(XWINDOW (w)->left) : &(XWINDOW (w)->top)) |
*(widthflag ? &(XWINDOW (w)->left) : &(XWINDOW (w)->top)) |
3442 |
|
|
3479 |
{ |
{ |
3480 |
p = XWINDOW (window); |
p = XWINDOW (window); |
3481 |
parent = p->parent; |
parent = p->parent; |
3482 |
|
|
3483 |
if (NILP (parent)) |
if (NILP (parent)) |
3484 |
{ |
{ |
3485 |
if (widthflag) |
if (widthflag) |
3486 |
error ("No other window to side of this one"); |
error ("No other window to side of this one"); |
3487 |
break; |
break; |
3488 |
} |
} |
3489 |
|
|
3490 |
if (widthflag |
if (widthflag |
3491 |
? !NILP (XWINDOW (parent)->hchild) |
? !NILP (XWINDOW (parent)->hchild) |
3492 |
: !NILP (XWINDOW (parent)->vchild)) |
: !NILP (XWINDOW (parent)->vchild)) |
3493 |
break; |
break; |
3494 |
|
|
3495 |
window = parent; |
window = parent; |
3496 |
} |
} |
3497 |
|
|
3581 |
{ |
{ |
3582 |
if (this_one > delta) |
if (this_one > delta) |
3583 |
this_one = delta; |
this_one = delta; |
3584 |
|
|
3585 |
(*setsizefun) (next, (*sizefun) (next) - this_one, 0); |
(*setsizefun) (next, (*sizefun) (next) - this_one, 0); |
3586 |
(*setsizefun) (window, XINT (*sizep) + this_one, 0); |
(*setsizefun) (window, XINT (*sizep) + this_one, 0); |
3587 |
|
|
3588 |
delta -= this_one; |
delta -= this_one; |
3589 |
} |
} |
3590 |
|
|
3591 |
next = XWINDOW (next)->next; |
next = XWINDOW (next)->next; |
3592 |
} |
} |
3593 |
|
|
3594 |
if (delta == 0) |
if (delta == 0) |
3595 |
break; |
break; |
3596 |
|
|
3597 |
if (!preserve_before && ! NILP (prev)) |
if (!preserve_before && ! NILP (prev)) |
3598 |
{ |
{ |
3599 |
int this_one = ((*sizefun) (prev) |
int this_one = ((*sizefun) (prev) |
3603 |
{ |
{ |
3604 |
if (this_one > delta) |
if (this_one > delta) |
3605 |
this_one = delta; |
this_one = delta; |
3606 |
|
|
3607 |
first_affected = prev; |
first_affected = prev; |
3608 |
|
|
3609 |
(*setsizefun) (prev, (*sizefun) (prev) - this_one, 0); |
(*setsizefun) (prev, (*sizefun) (prev) - this_one, 0); |
3610 |
(*setsizefun) (window, XINT (*sizep) + this_one, 0); |
(*setsizefun) (window, XINT (*sizep) + this_one, 0); |
3611 |
|
|
3612 |
delta -= this_one; |
delta -= this_one; |
3613 |
} |
} |
3614 |
|
|
3615 |
prev = XWINDOW (prev)->prev; |
prev = XWINDOW (prev)->prev; |
3616 |
} |
} |
3617 |
} |
} |
3675 |
|
|
3676 |
The function size_window will compute the new height h' |
The function size_window will compute the new height h' |
3677 |
of the window from delta1 as: |
of the window from delta1 as: |
3678 |
|
|
3679 |
e = delta1/n |
e = delta1/n |
3680 |
x = delta1 - delta1/n * n for the 1st resizable child |
x = delta1 - delta1/n * n for the 1st resizable child |
3681 |
h' = h + e + x |
h' = h + e + x |
3683 |
where n is the number of children that can be resized. |
where n is the number of children that can be resized. |
3684 |
We can ignore x by choosing a delta1 that is a multiple of |
We can ignore x by choosing a delta1 that is a multiple of |
3685 |
n. We want the height of this window to come out as |
n. We want the height of this window to come out as |
3686 |
|
|
3687 |
h' = h + delta |
h' = h + delta |
3688 |
|
|
3689 |
So, delta1 must be |
So, delta1 must be |
3690 |
|
|
3691 |
h + e = h + delta |
h + e = h + delta |
3692 |
delta1/n = delta |
delta1/n = delta |
3693 |
delta1 = n * delta. |
delta1 = n * delta. |
3694 |
|
|
3695 |
The number of children n rquals the number of resizable |
The number of children n equals the number of resizable |
3696 |
children of this window + 1 because we know window itself |
children of this window + 1 because we know window itself |
3697 |
is resizable (otherwise we would have signalled an error. */ |
is resizable (otherwise we would have signalled an error. */ |
3698 |
|
|
3749 |
RESTORE_ORIG_SIZES |
RESTORE_ORIG_SIZES |
3750 |
}; |
}; |
3751 |
|
|
3752 |
static int save_restore_orig_size P_ ((struct window *, |
static int save_restore_orig_size P_ ((struct window *, |
3753 |
enum save_restore_action)); |
enum save_restore_action)); |
3754 |
|
|
3755 |
/* Shrink windows rooted in window W to HEIGHT. Take the space needed |
/* Shrink windows rooted in window W to HEIGHT. Take the space needed |
3791 |
int last_top; |
int last_top; |
3792 |
|
|
3793 |
last_child = Qnil; |
last_child = Qnil; |
3794 |
|
|
3795 |
/* Find the last child. We are taking space from lowest windows |
/* Find the last child. We are taking space from lowest windows |
3796 |
first, so we iterate over children from the last child |
first, so we iterate over children from the last child |
3797 |
backwards. */ |
backwards. */ |
3802 |
for (child = last_child; delta && !NILP (child); child = c->prev) |
for (child = last_child; delta && !NILP (child); child = c->prev) |
3803 |
{ |
{ |
3804 |
int this_one; |
int this_one; |
3805 |
|
|
3806 |
c = XWINDOW (child); |
c = XWINDOW (child); |
3807 |
this_one = XFASTINT (c->height) - MIN_SAFE_WINDOW_HEIGHT; |
this_one = XFASTINT (c->height) - MIN_SAFE_WINDOW_HEIGHT; |
3808 |
|
|
3832 |
If ACTION is CHECK_ORIG_SIZES, check if orig_top and orig_height |
If ACTION is CHECK_ORIG_SIZES, check if orig_top and orig_height |
3833 |
members are valid for all windows in the window tree. Value is |
members are valid for all windows in the window tree. Value is |
3834 |
non-zero if they are valid. |
non-zero if they are valid. |
3835 |
|
|
3836 |
If ACTION is SAVE_ORIG_SIZES, save members top and height in |
If ACTION is SAVE_ORIG_SIZES, save members top and height in |
3837 |
orig_top and orig_height for all windows in the tree. |
orig_top and orig_height for all windows in the tree. |
3838 |
|
|
3858 |
if (!save_restore_orig_size (XWINDOW (w->vchild), action)) |
if (!save_restore_orig_size (XWINDOW (w->vchild), action)) |
3859 |
success_p = 0; |
success_p = 0; |
3860 |
} |
} |
3861 |
|
|
3862 |
switch (action) |
switch (action) |
3863 |
{ |
{ |
3864 |
case CHECK_ORIG_SIZES: |
case CHECK_ORIG_SIZES: |
3903 |
{ |
{ |
3904 |
struct frame *f = XFRAME (w->frame); |
struct frame *f = XFRAME (w->frame); |
3905 |
struct window *root; |
struct window *root; |
3906 |
|
|
3907 |
xassert (MINI_WINDOW_P (w)); |
xassert (MINI_WINDOW_P (w)); |
3908 |
xassert (delta >= 0); |
xassert (delta >= 0); |
3909 |
|
|
3910 |
/* Check values of window_min_width and window_min_height for |
/* Check values of window_min_width and window_min_height for |
3911 |
validity. */ |
validity. */ |
3912 |
check_min_window_sizes (); |
check_min_window_sizes (); |
3922 |
min_height. */ |
min_height. */ |
3923 |
delta = max (0, XFASTINT (root->height) - min_height); |
delta = max (0, XFASTINT (root->height) - min_height); |
3924 |
} |
} |
3925 |
|
|
3926 |
if (delta) |
if (delta) |
3927 |
{ |
{ |
3928 |
/* Save original window sizes and positions, if not already done. */ |
/* Save original window sizes and positions, if not already done. */ |
3937 |
w->height = make_number (XFASTINT (w->height) + delta); |
w->height = make_number (XFASTINT (w->height) + delta); |
3938 |
XSETFASTINT (w->last_modified, 0); |
XSETFASTINT (w->last_modified, 0); |
3939 |
XSETFASTINT (w->last_overlay_modified, 0); |
XSETFASTINT (w->last_overlay_modified, 0); |
3940 |
|
|
3941 |
adjust_glyphs (f); |
adjust_glyphs (f); |
3942 |
} |
} |
3943 |
} |
} |
4069 |
int whole; |
int whole; |
4070 |
int noerror; |
int noerror; |
4071 |
{ |
{ |
4072 |
|
immediate_quit = 1; |
4073 |
|
|
4074 |
/* If we must, use the pixel-based version which is much slower than |
/* If we must, use the pixel-based version which is much slower than |
4075 |
the line-based one but can handle varying line heights. */ |
the line-based one but can handle varying line heights. */ |
4076 |
if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame))) |
if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame))) |
4077 |
window_scroll_pixel_based (window, n, whole, noerror); |
window_scroll_pixel_based (window, n, whole, noerror); |
4078 |
else |
else |
4079 |
window_scroll_line_based (window, n, whole, noerror); |
window_scroll_line_based (window, n, whole, noerror); |
4080 |
|
|
4081 |
|
immediate_quit = 0; |
4082 |
} |
} |
4083 |
|
|
4084 |
|
|
4103 |
int vscrolled = 0; |
int vscrolled = 0; |
4104 |
|
|
4105 |
SET_TEXT_POS_FROM_MARKER (start, w->start); |
SET_TEXT_POS_FROM_MARKER (start, w->start); |
4106 |
|
|
4107 |
/* If PT is not visible in WINDOW, move back one half of |
/* If PT is not visible in WINDOW, move back one half of |
4108 |
the screen. Allow PT to be partially visible, otherwise |
the screen. Allow PT to be partially visible, otherwise |
4109 |
something like (scroll-down 1) with PT in the line before |
something like (scroll-down 1) with PT in the line before |
4117 |
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); |
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); |
4118 |
it.current_y = it.last_visible_y; |
it.current_y = it.last_visible_y; |
4119 |
move_it_vertically (&it, - window_box_height (w) / 2); |
move_it_vertically (&it, - window_box_height (w) / 2); |
4120 |
|
|
4121 |
/* The function move_iterator_vertically may move over more than |
/* The function move_iterator_vertically may move over more than |
4122 |
the specified y-distance. If it->w is small, e.g. a |
the specified y-distance. If it->w is small, e.g. a |
4123 |
mini-buffer window, we may end up in front of the window's |
mini-buffer window, we may end up in front of the window's |
4165 |
else |
else |
4166 |
move_it_by_lines (&it, n, 1); |
move_it_by_lines (&it, n, 1); |
4167 |
|
|
4168 |
/* End if we end up at ZV or BEGV. */ |
/* We failed if we find ZV is already on the screen (scrolling up, |
4169 |
|
means there's nothing past the end), or if we can't start any |
4170 |
|
earlier (scrolling down, means there's nothing past the top). */ |
4171 |
if ((n > 0 && IT_CHARPOS (it) == ZV) |
if ((n > 0 && IT_CHARPOS (it) == ZV) |
4172 |
|| (n < 0 && IT_CHARPOS (it) == CHARPOS (start))) |
|| (n < 0 && IT_CHARPOS (it) == CHARPOS (start))) |
4173 |
{ |
{ |
4174 |
if (IT_CHARPOS (it) == ZV) |
if (IT_CHARPOS (it) == ZV) |
4175 |
{ |
{ |
4176 |
if (it.current_y + it.max_ascent + it.max_descent |
if (it.current_y < it.last_visible_y |
4177 |
> it.last_visible_y) |
&& (it.current_y + it.max_ascent + it.max_descent |
4178 |
|
>= it.last_visible_y)) |
4179 |
{ |
{ |
4180 |
/* The last line was only partially visible, make it fully |
/* The last line was only partially visible, make it fully |
4181 |
visible. */ |
visible. */ |
4212 |
{ |
{ |
4213 |
int pos = IT_CHARPOS (it); |
int pos = IT_CHARPOS (it); |
4214 |
int bytepos; |
int bytepos; |
4215 |
|
|
4216 |
|
/* If in the middle of a multi-glyph character move forward to |
4217 |
|
the next character. */ |
4218 |
|
if (in_display_vector_p (&it)) |
4219 |
|
{ |
4220 |
|
++pos; |
4221 |
|
move_it_to (&it, pos, -1, -1, -1, MOVE_TO_POS); |
4222 |
|
} |
4223 |
|
|
4224 |
/* Set the window start, and set up the window for redisplay. */ |
/* Set the window start, and set up the window for redisplay. */ |
4225 |
set_marker_restricted (w->start, make_number (pos), |
set_marker_restricted (w->start, make_number (pos), |
4226 |
w->buffer); |
w->buffer); |
4234 |
window-scroll-functions. */ |
window-scroll-functions. */ |
4235 |
w->force_start = Qt; |
w->force_start = Qt; |
4236 |
} |
} |
4237 |
|
|
4238 |
it.current_y = it.vpos = 0; |
it.current_y = it.vpos = 0; |
4239 |
|
|
4240 |
/* Preserve the screen position if we must. */ |
/* Preserve the screen position if we must. */ |
4241 |
if (preserve_y >= 0) |
if (preserve_y >= 0) |
4242 |
{ |
{ |
4277 |
/* Save our position, in case it's correct. */ |
/* Save our position, in case it's correct. */ |
4278 |
charpos = IT_CHARPOS (it); |
charpos = IT_CHARPOS (it); |
4279 |
bytepos = IT_BYTEPOS (it); |
bytepos = IT_BYTEPOS (it); |
4280 |
|
|
4281 |
/* See if point is on a partially visible line at the end. */ |
/* See if point is on a partially visible line at the end. */ |
4282 |
move_it_by_lines (&it, 1, 1); |
move_it_by_lines (&it, 1, 1); |
4283 |
if (it.current_y > it.last_visible_y) |
if (it.current_y > it.last_visible_y) |
4452 |
Lisp_Object n; |
Lisp_Object n; |
4453 |
int direction; |
int direction; |
4454 |
{ |
{ |
4455 |
int count = BINDING_STACK_SIZE (); |
int count = SPECPDL_INDEX (); |
4456 |
|
|
4457 |
xassert (abs (direction) == 1); |
xassert (abs (direction) == 1); |
4458 |
|
|
4566 |
{ |
{ |
4567 |
Lisp_Object window; |
Lisp_Object window; |
4568 |
struct window *w; |
struct window *w; |
4569 |
int count = BINDING_STACK_SIZE (); |
int count = SPECPDL_INDEX (); |
4570 |
|
|
4571 |
window = Fother_window_for_scrolling (); |
window = Fother_window_for_scrolling (); |
4572 |
w = XWINDOW (window); |
w = XWINDOW (window); |
4611 |
Lisp_Object result; |
Lisp_Object result; |
4612 |
int hscroll; |
int hscroll; |
4613 |
struct window *w = XWINDOW (selected_window); |
struct window *w = XWINDOW (selected_window); |
4614 |
|
|
4615 |
if (NILP (arg)) |
if (NILP (arg)) |
4616 |
XSETFASTINT (arg, window_internal_width (w) - 2); |
XSETFASTINT (arg, window_internal_width (w) - 2); |
4617 |
else |
else |
4641 |
Lisp_Object result; |
Lisp_Object result; |
4642 |
int hscroll; |
int hscroll; |
4643 |
struct window *w = XWINDOW (selected_window); |
struct window *w = XWINDOW (selected_window); |
4644 |
|
|
4645 |
if (NILP (arg)) |
if (NILP (arg)) |
4646 |
XSETFASTINT (arg, window_internal_width (w) - 2); |
XSETFASTINT (arg, window_internal_width (w) - 2); |
4647 |
else |
else |
4649 |
|
|
4650 |
hscroll = XINT (w->hscroll) - XINT (arg); |
hscroll = XINT (w->hscroll) - XINT (arg); |
4651 |
result = Fset_window_hscroll (selected_window, make_number (hscroll)); |
result = Fset_window_hscroll (selected_window, make_number (hscroll)); |
4652 |
|
|
4653 |
if (interactive_p (0)) |
if (interactive_p (0)) |
4654 |
w->min_hscroll = w->hscroll; |
w->min_hscroll = w->hscroll; |
4655 |
|
|
4705 |
move_it_vertically (&it, height); |
move_it_vertically (&it, height); |
4706 |
bottom_y = line_bottom_y (&it); |
bottom_y = line_bottom_y (&it); |
4707 |
|
|
4708 |
|
/* rms: On a non-window display, |
4709 |
|
the value of it.vpos at the bottom of the screen |
4710 |
|
seems to be 1 larger than window_box_height (w). |
4711 |
|
This kludge fixes a bug whereby (move-to-window-line -1) |
4712 |
|
when ZV is on the last screen line |
4713 |
|
moves to the previous screen line instead of the last one. */ |
4714 |
|
if (! FRAME_WINDOW_P (XFRAME (w->frame))) |
4715 |
|
height++; |
4716 |
|
|
4717 |
/* Add in empty lines at the bottom of the window. */ |
/* Add in empty lines at the bottom of the window. */ |
4718 |
if (bottom_y < height) |
if (bottom_y < height) |
4719 |
{ |
{ |
4781 |
{ |
{ |
4782 |
struct it it; |
struct it it; |
4783 |
struct text_pos pt; |
struct text_pos pt; |
4784 |
|
|
4785 |
SET_TEXT_POS (pt, PT, PT_BYTE); |
SET_TEXT_POS (pt, PT, PT_BYTE); |
4786 |
start_display (&it, w, pt); |
start_display (&it, w, pt); |
4787 |
move_it_vertically (&it, - window_box_height (w) / 2); |
move_it_vertically (&it, - window_box_height (w) / 2); |
4793 |
struct it it; |
struct it it; |
4794 |
struct text_pos pt; |
struct text_pos pt; |
4795 |
int y0, y1, h, nlines; |
int y0, y1, h, nlines; |
4796 |
|
|
4797 |
SET_TEXT_POS (pt, PT, PT_BYTE); |
SET_TEXT_POS (pt, PT, PT_BYTE); |
4798 |
start_display (&it, w, pt); |
start_display (&it, w, pt); |
4799 |
y0 = it.current_y; |
y0 = it.current_y; |
4810 |
the end of the buffer, count in some empty lines. */ |
the end of the buffer, count in some empty lines. */ |
4811 |
if (it.vpos < nlines) |
if (it.vpos < nlines) |
4812 |
y1 += (nlines - it.vpos) * CANON_Y_UNIT (it.f); |
y1 += (nlines - it.vpos) * CANON_Y_UNIT (it.f); |
4813 |
|
|
4814 |
h = window_box_height (w) - (y1 - y0); |
h = window_box_height (w) - (y1 - y0); |
4815 |
|
|
4816 |
start_display (&it, w, pt); |
start_display (&it, w, pt); |
4835 |
arg = make_number (ht / 2); |
arg = make_number (ht / 2); |
4836 |
else if (XINT (arg) < 0) |
else if (XINT (arg) < 0) |
4837 |
arg = make_number (XINT (arg) + ht); |
arg = make_number (XINT (arg) + ht); |
4838 |
|
|
4839 |
pos = *vmotion (PT, - XINT (arg), w); |
pos = *vmotion (PT, - XINT (arg), w); |
4840 |
charpos = pos.bufpos; |
charpos = pos.bufpos; |
4841 |
bytepos = pos.bytepos; |
bytepos = pos.bytepos; |
4844 |
/* Set the new window start. */ |
/* Set the new window start. */ |
4845 |
set_marker_both (w->start, w->buffer, charpos, bytepos); |
set_marker_both (w->start, w->buffer, charpos, bytepos); |
4846 |
w->window_end_valid = Qnil; |
w->window_end_valid = Qnil; |
4847 |
w->force_start = Qt; |
|
4848 |
|
w->optional_new_start = Qt; |
4849 |
|
|
4850 |
if (bytepos == BEGV_BYTE || FETCH_BYTE (bytepos - 1) == '\n') |
if (bytepos == BEGV_BYTE || FETCH_BYTE (bytepos - 1) == '\n') |
4851 |
w->start_at_line_beg = Qt; |
w->start_at_line_beg = Qt; |
4852 |
else |
else |
4853 |
w->start_at_line_beg = Qnil; |
w->start_at_line_beg = Qnil; |
4854 |
|
|
4855 |
set_buffer_internal (obuf); |
set_buffer_internal (obuf); |
4856 |
return Qnil; |
return Qnil; |
4857 |
} |
} |
5006 |
Lisp_Object new_current_buffer; |
Lisp_Object new_current_buffer; |
5007 |
Lisp_Object frame; |
Lisp_Object frame; |
5008 |
FRAME_PTR f; |
FRAME_PTR f; |
5009 |
|
int old_point = -1; |
5010 |
|
|
5011 |
while (!WINDOW_CONFIGURATIONP (configuration)) |
while (!WINDOW_CONFIGURATIONP (configuration)) |
5012 |
wrong_type_argument (Qwindow_configuration_p, configuration); |
wrong_type_argument (Qwindow_configuration_p, configuration); |
5017 |
new_current_buffer = data->current_buffer; |
new_current_buffer = data->current_buffer; |
5018 |
if (NILP (XBUFFER (new_current_buffer)->name)) |
if (NILP (XBUFFER (new_current_buffer)->name)) |
5019 |
new_current_buffer = Qnil; |
new_current_buffer = Qnil; |
5020 |
|
else |
5021 |
|
{ |
5022 |
|
if (XBUFFER (new_current_buffer) == current_buffer) |
5023 |
|
old_point = PT; |
5024 |
|
else |
5025 |
|
old_point = BUF_PT (XBUFFER (new_current_buffer)); |
5026 |
|
} |
5027 |
|
|
5028 |
frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; |
frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; |
5029 |
f = XFRAME (frame); |
f = XFRAME (frame); |
5030 |
|
|
5031 |
/* If f is a dead frame, don't bother rebuilding its window tree. |
/* If f is a dead frame, don't bother rebuilding its window tree. |
5032 |
However, there is other stuff we should still try to do below. */ |
However, there is other stuff we should still try to do below. */ |
5033 |
if (FRAME_LIVE_P (f)) |
if (FRAME_LIVE_P (f)) |
5084 |
FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
5085 |
|
|
5086 |
/* Problem: Freeing all matrices and later allocating them again |
/* Problem: Freeing all matrices and later allocating them again |
5087 |
is a serious redisplay flickering problem. What we would |
is a serious redisplay flickering problem. What we would |
5088 |
really like to do is to free only those matrices not reused |
really like to do is to free only those matrices not reused |
5089 |
below. */ |
below. */ |
5090 |
root_window = XWINDOW (FRAME_ROOT_WINDOW (f)); |
root_window = XWINDOW (FRAME_ROOT_WINDOW (f)); |
5211 |
FRAME_ROOT_WINDOW (f) = data->root_window; |
FRAME_ROOT_WINDOW (f) = data->root_window; |
5212 |
/* Prevent "swapping out point" in the old selected window |
/* Prevent "swapping out point" in the old selected window |
5213 |
using the buffer that has been restored into it. |
using the buffer that has been restored into it. |
5214 |
That swapping out has already been done, |
Use the point value from the beginning of this function |
5215 |
near the beginning of this function. */ |
since unshow_buffer (called from delete_all_subwindows) |
5216 |
|
could have altered it. */ |
5217 |
selected_window = Qnil; |
selected_window = Qnil; |
5218 |
if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) |
if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) |
5219 |
set_marker_restricted (XWINDOW (data->current_window)->pointm, |
set_marker_restricted (XWINDOW (data->current_window)->pointm, |
5220 |
make_number (BUF_PT (XBUFFER (XWINDOW (data->current_window)->buffer))), |
make_number (old_point), |
5221 |
XWINDOW (data->current_window)->buffer); |
XWINDOW (data->current_window)->buffer); |
5222 |
|
|
5223 |
Fselect_window (data->current_window); |
Fselect_window (data->current_window); |
5224 |
XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window |
XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window |
5225 |
= selected_window; |
= selected_window; |
5258 |
if (NILP (leaf_windows[i]->buffer)) |
if (NILP (leaf_windows[i]->buffer)) |
5259 |
{ |
{ |
5260 |
/* Assert it's not reused as a combination. */ |
/* Assert it's not reused as a combination. */ |
5261 |
xassert (NILP (leaf_windows[i]->hchild) |
xassert (NILP (leaf_windows[i]->hchild) |
5262 |
&& NILP (leaf_windows[i]->vchild)); |
&& NILP (leaf_windows[i]->vchild)); |
5263 |
free_window_matrices (leaf_windows[i]); |
free_window_matrices (leaf_windows[i]); |
5264 |
} |
} |
5265 |
else if (EQ (leaf_windows[i]->buffer, new_current_buffer)) |
else if (EQ (leaf_windows[i]->buffer, new_current_buffer)) |
5266 |
++n; |
++n; |
5267 |
} |
} |
5268 |
|
|
5269 |
adjust_glyphs (f); |
adjust_glyphs (f); |
5270 |
|
|
5271 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
5341 |
} |
} |
5342 |
|
|
5343 |
|
|
5344 |
/* Fill vector FLAT with leaf windows under W, starting at index I. |
/* Fill vector FLAT with leaf windows under W, starting at index I. |
5345 |
Value is last index + 1. */ |
Value is last index + 1. */ |
5346 |
|
|
5347 |
static int |
static int |
5356 |
i = get_leaf_windows (XWINDOW (w->hchild), flat, i); |
i = get_leaf_windows (XWINDOW (w->hchild), flat, i); |
5357 |
else if (!NILP (w->vchild)) |
else if (!NILP (w->vchild)) |
5358 |
i = get_leaf_windows (XWINDOW (w->vchild), flat, i); |
i = get_leaf_windows (XWINDOW (w->vchild), flat, i); |
5359 |
else |
else |
5360 |
flat[i++] = w; |
flat[i++] = w; |
5361 |
|
|
5362 |
w = NILP (w->next) ? 0 : XWINDOW (w->next); |
w = NILP (w->next) ? 0 : XWINDOW (w->next); |
5530 |
Lisp_Object args; |
Lisp_Object args; |
5531 |
{ |
{ |
5532 |
register Lisp_Object val; |
register Lisp_Object val; |
5533 |
register int count = specpdl_ptr - specpdl; |
register int count = SPECPDL_INDEX (); |
5534 |
|
|
5535 |
record_unwind_protect (Fset_window_configuration, |
record_unwind_protect (Fset_window_configuration, |
5536 |
Fcurrent_window_configuration (Qnil)); |
Fcurrent_window_configuration (Qnil)); |
5568 |
XSETFASTINT (left, 0); |
XSETFASTINT (left, 0); |
5569 |
if (INTEGERP (left) && XFASTINT (left) == 0) |
if (INTEGERP (left) && XFASTINT (left) == 0) |
5570 |
left = Qnil; |
left = Qnil; |
5571 |
|
|
5572 |
if ((INTEGERP (right) && XINT (right) < 0) |
if ((INTEGERP (right) && XINT (right) < 0) |
5573 |
|| (FLOATP (right) && XFLOAT_DATA (right) <= 0)) |
|| (FLOATP (right) && XFLOAT_DATA (right) <= 0)) |
5574 |
XSETFASTINT (right, 0); |
XSETFASTINT (right, 0); |
5614 |
Lisp_Object result; |
Lisp_Object result; |
5615 |
struct frame *f; |
struct frame *f; |
5616 |
struct window *w; |
struct window *w; |
5617 |
|
|
5618 |
if (NILP (window)) |
if (NILP (window)) |
5619 |
window = selected_window; |
window = selected_window; |
5620 |
else |
else |
5621 |
CHECK_WINDOW (window); |
CHECK_WINDOW (window); |
5622 |
w = XWINDOW (window); |
w = XWINDOW (window); |
5623 |
f = XFRAME (w->frame); |
f = XFRAME (w->frame); |
5624 |
|
|
5625 |
if (FRAME_WINDOW_P (f)) |
if (FRAME_WINDOW_P (f)) |
5626 |
result = CANON_Y_FROM_PIXEL_Y (f, -w->vscroll); |
result = CANON_Y_FROM_PIXEL_Y (f, -w->vscroll); |
5627 |
else |
else |
5640 |
{ |
{ |
5641 |
struct window *w; |
struct window *w; |
5642 |
struct frame *f; |
struct frame *f; |
5643 |
|
|
5644 |
if (NILP (window)) |
if (NILP (window)) |
5645 |
window = selected_window; |
window = selected_window; |
5646 |
else |
else |
5647 |
CHECK_WINDOW (window); |
CHECK_WINDOW (window); |
5648 |
CHECK_NUMBER_OR_FLOAT (vscroll); |
CHECK_NUMBER_OR_FLOAT (vscroll); |
5649 |
|
|
5650 |
w = XWINDOW (window); |
w = XWINDOW (window); |
5651 |
f = XFRAME (w->frame); |
f = XFRAME (w->frame); |
5652 |
|
|
5653 |
if (FRAME_WINDOW_P (f)) |
if (FRAME_WINDOW_P (f)) |
5654 |
{ |
{ |
5655 |
int old_dy = w->vscroll; |
int old_dy = w->vscroll; |
5656 |
|
|
5657 |
w->vscroll = - CANON_Y_UNIT (f) * XFLOATINT (vscroll); |
w->vscroll = - CANON_Y_UNIT (f) * XFLOATINT (vscroll); |
5658 |
w->vscroll = min (w->vscroll, 0); |
w->vscroll = min (w->vscroll, 0); |
5659 |
|
|
5661 |
area becomes larger than before. */ |
area becomes larger than before. */ |
5662 |
if (w->vscroll < 0 && w->vscroll < old_dy) |
if (w->vscroll < 0 && w->vscroll < old_dy) |
5663 |
adjust_glyphs (f); |
adjust_glyphs (f); |
5664 |
|
|
5665 |
/* Prevent redisplay shortcuts. */ |
/* Prevent redisplay shortcuts. */ |
5666 |
XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; |
XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; |
5667 |
} |
} |
5668 |
|
|
5669 |
return Fwindow_vscroll (window); |
return Fwindow_vscroll (window); |
5670 |
} |
} |
5671 |
|
|
5672 |
|
|
5673 |
/* Call FN for all leaf windows on frame F. FN is called with the |
/* Call FN for all leaf windows on frame F. FN is called with the |
5674 |
first argument being a pointer to the leaf window, and with |
first argument being a pointer to the leaf window, and with |
5696 |
void *user_data; |
void *user_data; |
5697 |
{ |
{ |
5698 |
int cont; |
int cont; |
5699 |
|
|
5700 |
for (cont = 1; w && cont;) |
for (cont = 1; w && cont;) |
5701 |
{ |
{ |
5702 |
if (!NILP (w->hchild)) |
if (!NILP (w->hchild)) |
5703 |
cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data); |
cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data); |
5704 |
else if (!NILP (w->vchild)) |
else if (!NILP (w->vchild)) |
5705 |
cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data); |
cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data); |
5706 |
else |
else |
5707 |
cont = fn (w, user_data); |
cont = fn (w, user_data); |
5708 |
|
|
5709 |
w = NILP (w->next) ? 0 : XWINDOW (w->next); |
w = NILP (w->next) ? 0 : XWINDOW (w->next); |
5710 |
} |
} |
5711 |
|
|
5728 |
&& ! NILP (Vminibuf_scroll_window) |
&& ! NILP (Vminibuf_scroll_window) |
5729 |
&& w == XWINDOW (Vminibuf_scroll_window))) |
&& w == XWINDOW (Vminibuf_scroll_window))) |
5730 |
freeze_p = NULL; |
freeze_p = NULL; |
5731 |
|
|
5732 |
w->frozen_window_start_p = freeze_p != NULL; |
w->frozen_window_start_p = freeze_p != NULL; |
5733 |
return 1; |
return 1; |
5734 |
} |
} |
5767 |
wrong_type_argument (Qwindow_configuration_p, c1); |
wrong_type_argument (Qwindow_configuration_p, c1); |
5768 |
if (!WINDOW_CONFIGURATIONP (c2)) |
if (!WINDOW_CONFIGURATIONP (c2)) |
5769 |
wrong_type_argument (Qwindow_configuration_p, c2); |
wrong_type_argument (Qwindow_configuration_p, c2); |
5770 |
|
|
5771 |
d1 = (struct save_window_data *) XVECTOR (c1); |
d1 = (struct save_window_data *) XVECTOR (c1); |
5772 |
d2 = (struct save_window_data *) XVECTOR (c2); |
d2 = (struct save_window_data *) XVECTOR (c2); |
5773 |
sw1 = XVECTOR (d1->saved_windows); |
sw1 = XVECTOR (d1->saved_windows); |
5898 |
{ |
{ |
5899 |
Qwindow_size_fixed = intern ("window-size-fixed"); |
Qwindow_size_fixed = intern ("window-size-fixed"); |
5900 |
staticpro (&Qwindow_size_fixed); |
staticpro (&Qwindow_size_fixed); |
5901 |
|
|
5902 |
staticpro (&Qwindow_configuration_change_hook); |
staticpro (&Qwindow_configuration_change_hook); |
5903 |
Qwindow_configuration_change_hook |
Qwindow_configuration_change_hook |
5904 |
= intern ("window-configuration-change-hook"); |
= intern ("window-configuration-change-hook"); |
6015 |
doc: /* Function to call to make a new frame for a special buffer. |
doc: /* Function to call to make a new frame for a special buffer. |
6016 |
It is called with two arguments, the buffer and optional buffer specific |
It is called with two arguments, the buffer and optional buffer specific |
6017 |
data, and should return a window displaying that buffer. |
data, and should return a window displaying that buffer. |
6018 |
The default value makes a separate frame for the buffer, |
The default value normally makes a separate frame for the buffer, |
6019 |
using `special-display-frame-alist' to specify the frame parameters. |
using `special-display-frame-alist' to specify the frame parameters. |
6020 |
|
But if the buffer specific data includes (same-buffer . t) then the |
6021 |
|
buffer is displayed in the current selected window. |
6022 |
|
Otherwise if it includes (same-frame . t) then the buffer is displayed in |
6023 |
|
a new window in the currently selected frame. |
6024 |
|
|
6025 |
A buffer is special if its is listed in `special-display-buffer-names' |
A buffer is special if it is listed in `special-display-buffer-names' |
6026 |
or matches a regexp in `special-display-regexps'. */); |
or matches a regexp in `special-display-regexps'. */); |
6027 |
Vspecial_display_function = Qnil; |
Vspecial_display_function = Qnil; |
6028 |
|
|