#include "macterm.h"
#endif
-#ifndef max
-#define max(a, b) ((a) < (b) ? (b) : (a))
-#endif
-
/* Values returned from coordinates_in_window. */
enum window_part
Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
-Lisp_Object Qwindow_size_fixed, Qleft_fringe, Qright_fringe;
+Lisp_Object Qwindow_size_fixed;
extern Lisp_Object Qheight, Qwidth;
static int displayed_window_lines P_ ((struct window *));
{
if (NILP (frame))
frame = selected_frame;
- CHECK_LIVE_FRAME (frame, 0);
+ CHECK_LIVE_FRAME (frame);
return FRAME_MINIBUF_WINDOW (XFRAME (frame));
}
if (!NILP (pos))
{
- CHECK_NUMBER_COERCE_MARKER (pos, 0);
+ CHECK_NUMBER_COERCE_MARKER (pos);
posint = XINT (pos);
}
else if (w == XWINDOW (selected_window))
if (NILP (window))
return XWINDOW (selected_window);
- CHECK_LIVE_WINDOW (window, 0);
+ CHECK_LIVE_WINDOW (window);
return XWINDOW (window);
}
struct window *w = decode_window (window);
int hscroll;
- CHECK_NUMBER (ncol, 1);
+ CHECK_NUMBER (ncol);
hscroll = max (0, XINT (ncol));
/* Prevent redisplay shortcuts when changing the hscroll. */
if it is on the border between the window and its right sibling,
return 3.
if it is on the window's top line, return 4;
- if it is in the bitmap area to the left/right of the window,
+ if it is in left or right fringe of the window,
return 5 or 6, and convert *X and *Y to window-relative corrdinates.
X and Y are frame relative pixel coordinates. */
everywhere. */
struct frame *f = XFRAME (WINDOW_FRAME (w));
int left_x, right_x, top_y, bottom_y;
- int flags_area_width = FRAME_LEFT_FLAGS_AREA_WIDTH (f);
enum window_part part;
- int ux = CANON_X_UNIT (f), uy = CANON_Y_UNIT (f);
+ int ux = CANON_X_UNIT (f);
int x0 = XFASTINT (w->left) * ux;
int x1 = x0 + XFASTINT (w->width) * ux;
/* The width of the area where the vertical line can be dragged.
else if (*y < top_y
|| *y >= bottom_y
|| *x < (left_x
- - flags_area_width
+ - FRAME_LEFT_FRINGE_WIDTH (f)
- FRAME_LEFT_SCROLL_BAR_WIDTH (f) * ux)
|| *x > (right_x
- + flags_area_width
+ + FRAME_RIGHT_FRINGE_WIDTH (f)
+ FRAME_RIGHT_SCROLL_BAR_WIDTH (f) * ux))
{
part = ON_NOTHING;
if (!w->pseudo_window_p
&& !FRAME_HAS_VERTICAL_SCROLL_BARS (f)
&& !WINDOW_RIGHTMOST_P (w)
- && (abs (*x - right_x - flags_area_width) < grabbable_width))
+ && (abs (*x - right_x - FRAME_RIGHT_FRINGE_WIDTH (f)) < grabbable_width))
{
part = ON_VERTICAL_BORDER;
}
else if (*x < left_x || *x > right_x)
{
- /* Other lines than the mode line don't include flags areas and
+ /* Other lines than the mode line don't include fringes and
scroll bars on the left. */
/* Convert X and Y to window-relative pixel coordinates. */
terminals, the vertical line's x coordinate is right_x. */
if (*x < left_x || *x > right_x)
{
- /* Other lines than the mode line don't include flags areas and
+ /* Other lines than the mode line don't include fringes and
scroll bars on the left. */
/* Convert X and Y to window-relative pixel coordinates. */
the coordinates relative to the window are returned.
If they are in the mode line of WINDOW, `mode-line' is returned.
If they are in the top mode line of WINDOW, `header-line' is returned.
-If they are in the fringe to the left of the window,
- `left-fringe' is returned, if they are in the area on the right of
- the window, `right-fringe' is returned.
+If they are in the left fringe of WINDOW, `left-fringe' is returned.
+If they are in the right fringe of WINDOW, `right-fringe' is returned.
If they are on the border between WINDOW and its right sibling,
`vertical-line' is returned. */)
(coordinates, window)
int x, y;
Lisp_Object lx, ly;
- CHECK_LIVE_WINDOW (window, 0);
+ CHECK_LIVE_WINDOW (window);
w = XWINDOW (window);
f = XFRAME (w->frame);
- CHECK_CONS (coordinates, 1);
+ CHECK_CONS (coordinates);
lx = Fcar (coordinates);
ly = Fcdr (coordinates);
- CHECK_NUMBER_OR_FLOAT (lx, 1);
- CHECK_NUMBER_OR_FLOAT (ly, 1);
+ CHECK_NUMBER_OR_FLOAT (lx);
+ CHECK_NUMBER_OR_FLOAT (ly);
x = PIXEL_X_FROM_CANON_X (f, lx);
y = PIXEL_Y_FROM_CANON_Y (f, ly);
if (NILP (frame))
frame = selected_frame;
- CHECK_LIVE_FRAME (frame, 2);
+ CHECK_LIVE_FRAME (frame);
f = XFRAME (frame);
/* Check that arguments are integers or floats. */
- CHECK_NUMBER_OR_FLOAT (x, 0);
- CHECK_NUMBER_OR_FLOAT (y, 1);
+ CHECK_NUMBER_OR_FLOAT (x);
+ CHECK_NUMBER_OR_FLOAT (y);
return window_from_coordinates (f,
PIXEL_X_FROM_CANON_X (f, x),
Lisp_Object buf;
buf = w->buffer;
- CHECK_BUFFER (buf, 0);
+ CHECK_BUFFER (buf);
#if 0 /* This change broke some things. We should make it later. */
/* If we don't know the end position, return nil.
{
register struct window *w = decode_window (window);
- CHECK_NUMBER_COERCE_MARKER (pos, 1);
+ CHECK_NUMBER_COERCE_MARKER (pos);
if (w == XWINDOW (selected_window)
&& XBUFFER (w->buffer) == current_buffer)
Fgoto_char (pos);
{
register struct window *w = decode_window (window);
- CHECK_NUMBER_COERCE_MARKER (pos, 1);
+ CHECK_NUMBER_COERCE_MARKER (pos);
set_marker_restricted (w->start, pos, w->buffer);
/* this is not right, but much easier than doing what is right. */
w->start_at_line_beg = Qnil;
if (NILP (window))
window = selected_window;
else
- CHECK_WINDOW (window, 0);
+ CHECK_WINDOW (window);
p = XWINDOW (window);
/* It's okay to delete an already-deleted window. */
if (NILP (*window))
*window = selected_window;
else
- CHECK_LIVE_WINDOW (*window, 0);
+ CHECK_LIVE_WINDOW (*window);
/* MINIBUF nil may or may not include minibuffers. Decide if it
does. */
Lisp_Object window;
int i;
- CHECK_NUMBER (arg, 0);
+ CHECK_NUMBER (arg);
window = selected_window;
for (i = XINT (arg); i > 0; --i)
if (NILP (window))
window = selected_window;
else
- CHECK_LIVE_WINDOW (window, 0);
+ CHECK_LIVE_WINDOW (window);
w = XWINDOW (window);
startpos = marker_position (w->start);
if (!NILP (buffer))
{
buffer = Fget_buffer (buffer);
- CHECK_BUFFER (buffer, 0);
+ CHECK_BUFFER (buffer);
window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, frame);
}
if (!NILP (buffer))
{
buffer = Fget_buffer (buffer);
- CHECK_BUFFER (buffer, 0);
+ CHECK_BUFFER (buffer);
window_loop (UNSHOW_BUFFER, buffer, 0, Qt);
}
return Qnil;
XSETWINDOW (window, w);
buffer = Fget_buffer (buffer);
- CHECK_BUFFER (buffer, 1);
+ CHECK_BUFFER (buffer);
if (NILP (XBUFFER (buffer)->name))
error ("Attempt to display deleted buffer");
register struct window *ow;
struct frame *sf;
- CHECK_LIVE_WINDOW (window, 0);
+ CHECK_LIVE_WINDOW (window);
w = XWINDOW (window);
w->frozen_window_start_p = 0;
{
Lisp_Object tem;
- CHECK_STRING (buffer_name, 1);
+ CHECK_STRING (buffer_name);
tem = Fmember (buffer_name, Vspecial_display_buffer_names);
if (!NILP (tem))
{
Lisp_Object tem;
- CHECK_STRING (buffer_name, 1);
+ CHECK_STRING (buffer_name);
tem = Fmember (buffer_name, Vsame_window_buffer_names);
if (!NILP (tem))
swp = Qnil;
buffer = Fget_buffer (buffer);
- CHECK_BUFFER (buffer, 0);
+ CHECK_BUFFER (buffer);
if (!NILP (Vdisplay_buffer_function))
return call2 (Vdisplay_buffer_function, buffer, not_this_window);
if (NILP (window))
window = selected_window;
else
- CHECK_LIVE_WINDOW (window, 0);
+ CHECK_LIVE_WINDOW (window);
o = XWINDOW (window);
fo = XFRAME (WINDOW_FRAME (o));
}
else
{
- CHECK_NUMBER (size, 1);
+ CHECK_NUMBER (size);
size_int = XINT (size);
}
(arg, side)
register Lisp_Object arg, side;
{
- CHECK_NUMBER (arg, 0);
+ CHECK_NUMBER (arg);
enlarge_window (selected_window, XINT (arg), !NILP (side));
if (! NILP (Vwindow_configuration_change_hook))
(arg, side)
register Lisp_Object arg, side;
{
- CHECK_NUMBER (arg, 0);
+ CHECK_NUMBER (arg);
enlarge_window (selected_window, -XINT (arg), !NILP (side));
if (! NILP (Vwindow_configuration_change_hook))
{
int min_height = window_min_size (root, 0, 0, 0);
if (XFASTINT (root->height) - delta < min_height)
- delta = XFASTINT (root->height) - min_height;
+ /* Note that the root window may already be smaller than
+ min_height. */
+ delta = max (0, XFASTINT (root->height) - min_height);
}
if (delta)
width -= 1;
/* On window-systems, areas to the left and right of the window
- are used to display bitmaps there. */
+ are used as fringes. */
if (FRAME_WINDOW_P (f))
- width -= FRAME_FLAGS_AREA_COLS (f);
+ width -= FRAME_FRINGE_COLS (f);
return width;
}
&& ! EQ (window, selected_window));
}
- CHECK_LIVE_WINDOW (window, 0);
+ CHECK_LIVE_WINDOW (window);
if (EQ (window, selected_window))
error ("There is no other window");
{
if (CONSP (arg))
arg = Fcar (arg);
- CHECK_NUMBER (arg, 0);
+ CHECK_NUMBER (arg);
window_scroll (window, XINT (arg), 0, 1);
}
\f
DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 1, "P",
doc: /* Scroll selected window display ARG columns left.
-Default for ARG is window width minus 2. */)
+Default for ARG is window width minus 2.
+Value is the total amount of leftward horizontal scrolling in
+effect after the change.
+If `automatic-hscrolling' is non-nil, the argument ARG modifies
+a lower bound for automatic scrolling, i.e. automatic scrolling
+will not scroll a window to a column less than the value returned
+by this function. */)
(arg)
register Lisp_Object arg;
{
DEFUN ("scroll-right", Fscroll_right, Sscroll_right, 0, 1, "P",
doc: /* Scroll selected window display ARG columns right.
-Default for ARG is window width minus 2. */)
+Default for ARG is window width minus 2.
+Value is the total amount of leftward horizontal scrolling in
+effect after the change.
+If `automatic-hscrolling' is non-nil, the argument ARG modifies
+a lower bound for automatic scrolling, i.e. automatic scrolling
+will not scroll a window to a column less than the value returned
+by this function. */)
(arg)
register Lisp_Object arg;
{
else
{
arg = Fprefix_numeric_value (arg);
- CHECK_NUMBER (arg, 0);
+ CHECK_NUMBER (arg);
}
set_buffer_internal (buf);
nlines = - XINT (arg) - 1;
move_it_by_lines (&it, nlines, 1);
- y1 = it.current_y - y0;
- h = line_bottom_y (&it) - y1;
+ y1 = line_bottom_y (&it);
/* If we can't move down NLINES lines because we hit
the end of the buffer, count in some empty lines. */
if (it.vpos < nlines)
y1 += (nlines - it.vpos) * CANON_Y_UNIT (it.f);
- y0 = it.last_visible_y - y1 - h;
-
+ h = window_box_height (w) - (y1 - y0);
+
start_display (&it, w, pt);
- move_it_vertically (&it, - y0);
+ move_it_vertically (&it, - h);
charpos = IT_CHARPOS (it);
bytepos = IT_BYTEPOS (it);
}
if (NILP (frame))
frame = selected_frame;
- CHECK_LIVE_FRAME (frame, 0);
+ CHECK_LIVE_FRAME (frame);
f = XFRAME (frame);
n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
struct window *w = decode_window (window);
if (!NILP (left))
- CHECK_NUMBER_OR_FLOAT (left, 1);
+ CHECK_NUMBER_OR_FLOAT (left);
if (!NILP (right))
- CHECK_NUMBER_OR_FLOAT (right, 2);
+ CHECK_NUMBER_OR_FLOAT (right);
/* Check widths < 0 and translate a zero width to nil.
Margins that are too wide have to be checked elsewhere. */
if (NILP (window))
window = selected_window;
else
- CHECK_WINDOW (window, 0);
+ CHECK_WINDOW (window);
w = XWINDOW (window);
f = XFRAME (w->frame);
DEFUN ("set-window-vscroll", Fset_window_vscroll, Sset_window_vscroll,
2, 2, 0,
doc: /* Set amount by which WINDOW should be scrolled vertically to VSCROLL.
-WINDOW nil or omitted means use the selected window. VSCROLL is a
-non-negative multiple of the canonical character height of WINDOW. */)
+WINDOW nil means use the selected window. VSCROLL is a non-negative
+multiple of the canonical character height of WINDOW. */)
(window, vscroll)
Lisp_Object window, vscroll;
{
if (NILP (window))
window = selected_window;
else
- CHECK_WINDOW (window, 0);
- CHECK_NUMBER_OR_FLOAT (vscroll, 1);
+ CHECK_WINDOW (window);
+ CHECK_NUMBER_OR_FLOAT (vscroll);
w = XWINDOW (window);
f = XFRAME (w->frame);
void
syms_of_window ()
{
- Qleft_fringe = intern ("left-fringe");
- staticpro (&Qleft_fringe);
- Qright_fringe = intern ("right-fringe");
- staticpro (&Qright_fringe);
-
Qwindow_size_fixed = intern ("window-size-fixed");
staticpro (&Qwindow_size_fixed);