Commit 535e0b8e authored by Jim Blandy's avatar Jim Blandy
Browse files

* window.c (window_internal_width): New function, which accounts

	for scrollbars if present.
	* lisp.h (window_internal_height, window_internal_width): Add
	extern declarations for these.
	* dispnew.c (direct_output_for_insert, direct_output_forward_char,
	buffer_posn_from_coords): Use window_internal_width instead of
	writing out its definition.
	* indent.c (compute_motion): Doc fix; mention scrollbars and
	(pos_tab_offset, Fvertical_motion): Use window_internal_width
	instead of writing it out.
	* window.c (Fpos_visible_in_window_p, Fwindow_width, Fscroll_left,
	Fscroll_right): Same.
	* xdisp.c (redisplay, try_window, try_window_id,
	display_text_line): Same.

	* termhooks.h (mouse_position_hook): Doc fix.
	(set_vertical_scrollbar_hook): This doesn't return anything any
	more, and doesn't take a struct scrollbar * argument any more.
	(condemn_scrollbars_hook, redeem_scrollbar_hook,
	judge_scrollbars_hook): Doc fixes.
	* term.c (mouse_position_hook): Doc fix.
	(set_vertical_scrollbar_hook): This doesn't return
	anything any more.  Doc fixes.
	* keyboard.c (kbd_buffer_get_event): Receive the scrollbar's
	window from *mouse_position_hook and pass it to
	make_lispy_movement, instead of working with a pointer to a struct
	(make_lispy_event): We don't need a window_from_scrollbar function
	anymore; we are given the window directly in *EVENT.
	Unify the code which generates
	text-area mouse clicks and scrollbar clicks; use the same code to
	distinguish clicks from drags on the scrollbar as in the text area.
	Distinguish clicks from drags by storing a copy of the lispy
	position list returned as part of the event.
	(button_down_location): Make this a lisp vector, rather than an
	array of random structures.
	(struct mouse_position): Remove this; it's been replaced by a lisp
	(make_lispy_movement): Accept the scrollbar's window as a
	parameter, rather than the scrollbar itself.
	If FRAME is zero, assume that the other arguments are garbage.
	(syms_of_keyboard): No need to staticpro each window of
	button_down_location now; just initialize and staticpro it.
	* window.c (window_from_scrollbar): Function deleted; no longer
	* xdisp.c (redisplay_window): Just pass the window to
	set_vertical_scrollbar hook; don't pass the scrollbar object too.
	* xterm.c (XTmouse_position): Don't return a pointer to the
	scrollbar for scrollbar motion; instead, return the scrollbar's
parent ec3f896c
/* Window creation, deletion and examination for GNU Emacs.
Does not include redisplay.
Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc.
This file is part of GNU Emacs.
......@@ -225,9 +225,7 @@ POS defaults to point; WINDOW, to the selected window.")
/* If that info is not correct, calculate afresh */
posval = *compute_motion (top, 0, 0, posint, height, 0,
XFASTINT (w->width) - 1
- (XFASTINT (w->width) + XFASTINT (w->left)
!= FRAME_WIDTH (XFRAME (w->frame))),
window_internal_width (w) - 1,
XINT (w->hscroll), 0);
return posval.vpos < height ? Qt : Qnil;
......@@ -269,11 +267,7 @@ DEFUN ("window-width", Fwindow_width, Swindow_width, 0, 1, 0,
register struct window *w = decode_window (window);
register int width = XFASTINT (w->width);
/* If this window does not end at the right margin,
must deduct one column for the border */
if ((width + XFASTINT (w->left)) == FRAME_WIDTH (XFRAME (WINDOW_FRAME (w))))
return make_number (width);
return make_number (width - 1);
return make_number (window_internal_width (w));
DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
......@@ -432,34 +426,6 @@ window_from_coordinates (frame, x, y, part)
return Qnil;
/* Find the window containing the scrollbar BAR on FRAME. We need to
search for scrollbars, rather than just having a field in the
scrollbar saying what window it's attached to, because scrollbars
may be deallocated before the events which occurred on them are
dequeued. We can't dereference a scrollbar pointer until we know
it's live by finding it in a window structure. */
window_from_scrollbar (frame, bar)
FRAME_PTR frame;
struct scrollbar *bar;
register Lisp_Object tem, first;
tem = first = FRAME_SELECTED_WINDOW (frame);
return tem;
tem = Fnext_window (tem, Qt, Qlambda);
while (! EQ (tem, first));
return Qnil;
DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0,
"Return window containing row ROW, column COLUMN on FRAME.\n\
If omitted, FRAME defaults to the currently selected frame.\n\
......@@ -1676,8 +1642,7 @@ Returns the window displaying BUFFER.")
if (!NILP (window)
&& window_height (window) >= split_height_threshold
(XFASTINT (XWINDOW (window)->width)
&& (XFASTINT (XWINDOW (window)->width)
window = Fsplit_window (window, Qnil, Qnil);
......@@ -2055,6 +2020,36 @@ window_internal_height (w)
return ht;
/* Return the number of columns in W.
Don't count columns occupied by scrollbars or the vertical bar
separating W from the sibling to its right. */
window_internal_width (w)
struct window *w;
int left = XINT (w->left);
int width = XINT (w->width);
/* If this window is flush against the right edge of the frame, its
internal width is its full width. */
if (left + width >= FRAME_WIDTH (f))
return width;
/* If we are not flush right, then our rightmost columns are
occupied by some sort of separator. */
/* Scrollbars occupy a few columns. */
/* The column of `|' characters separating side-by-side windows
occupies one column only. */
return width - 1;
/* Scroll contents of window WINDOW up N lines. */
......@@ -2252,7 +2247,7 @@ Default for ARG is window width minus 2.")
if (NILP (arg))
XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2;
XFASTINT (arg) = window_internal_width (selected_window) - 2;
arg = Fprefix_numeric_value (arg);
......@@ -2269,7 +2264,7 @@ Default for ARG is window width minus 2.")
register Lisp_Object arg;
if (NILP (arg))
XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2;
XFASTINT (arg) = window_internal_width (selected_window) - 2;
arg = Fprefix_numeric_value (arg);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment