aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1993-01-14 15:17:11 +0000
committerJim Blandy1993-01-14 15:17:11 +0000
commit535e0b8ef6dc77f1a730c71c0df6316b9bb6535a (patch)
tree2b8c31f902fce351cf0e88918f9b349bd5e95a8c /src
parentec3f896ca772786663555e45b6630a9e446cae1a (diff)
downloademacs-535e0b8ef6dc77f1a730c71c0df6316b9bb6535a.tar.gz
emacs-535e0b8ef6dc77f1a730c71c0df6316b9bb6535a.zip
* 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 window_internal_width. (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 scrollbar. (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 list. (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 needed. * 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 window.
Diffstat (limited to 'src')
-rw-r--r--src/window.c79
1 files changed, 37 insertions, 42 deletions
diff --git a/src/window.c b/src/window.c
index 1d9eb2c8b0c..ef77057da37 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1,6 +1,6 @@
1/* Window creation, deletion and examination for GNU Emacs. 1/* Window creation, deletion and examination for GNU Emacs.
2 Does not include redisplay. 2 Does not include redisplay.
3 Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc. 3 Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -225,9 +225,7 @@ POS defaults to point; WINDOW, to the selected window.")
225 225
226 /* If that info is not correct, calculate afresh */ 226 /* If that info is not correct, calculate afresh */
227 posval = *compute_motion (top, 0, 0, posint, height, 0, 227 posval = *compute_motion (top, 0, 0, posint, height, 0,
228 XFASTINT (w->width) - 1 228 window_internal_width (w) - 1,
229 - (XFASTINT (w->width) + XFASTINT (w->left)
230 != FRAME_WIDTH (XFRAME (w->frame))),
231 XINT (w->hscroll), 0); 229 XINT (w->hscroll), 0);
232 230
233 return posval.vpos < height ? Qt : Qnil; 231 return posval.vpos < height ? Qt : Qnil;
@@ -269,11 +267,7 @@ DEFUN ("window-width", Fwindow_width, Swindow_width, 0, 1, 0,
269 register struct window *w = decode_window (window); 267 register struct window *w = decode_window (window);
270 register int width = XFASTINT (w->width); 268 register int width = XFASTINT (w->width);
271 269
272 /* If this window does not end at the right margin, 270 return make_number (window_internal_width (w));
273 must deduct one column for the border */
274 if ((width + XFASTINT (w->left)) == FRAME_WIDTH (XFRAME (WINDOW_FRAME (w))))
275 return make_number (width);
276 return make_number (width - 1);
277} 271}
278 272
279DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, 273DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
@@ -432,34 +426,6 @@ window_from_coordinates (frame, x, y, part)
432 return Qnil; 426 return Qnil;
433} 427}
434 428
435/* Find the window containing the scrollbar BAR on FRAME. We need to
436 search for scrollbars, rather than just having a field in the
437 scrollbar saying what window it's attached to, because scrollbars
438 may be deallocated before the events which occurred on them are
439 dequeued. We can't dereference a scrollbar pointer until we know
440 it's live by finding it in a window structure. */
441
442Lisp_Object
443window_from_scrollbar (frame, bar)
444 FRAME_PTR frame;
445 struct scrollbar *bar;
446{
447 register Lisp_Object tem, first;
448
449 tem = first = FRAME_SELECTED_WINDOW (frame);
450
451 do
452 {
453 if (WINDOW_VERTICAL_SCROLLBAR (XWINDOW (tem)) == bar)
454 return tem;
455
456 tem = Fnext_window (tem, Qt, Qlambda);
457 }
458 while (! EQ (tem, first));
459
460 return Qnil;
461}
462
463DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0, 429DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0,
464 "Return window containing row ROW, column COLUMN on FRAME.\n\ 430 "Return window containing row ROW, column COLUMN on FRAME.\n\
465If omitted, FRAME defaults to the currently selected frame.\n\ 431If omitted, FRAME defaults to the currently selected frame.\n\
@@ -1676,9 +1642,8 @@ Returns the window displaying BUFFER.")
1676 1642
1677 if (!NILP (window) 1643 if (!NILP (window)
1678 && window_height (window) >= split_height_threshold 1644 && window_height (window) >= split_height_threshold
1679 && 1645 && (XFASTINT (XWINDOW (window)->width)
1680 (XFASTINT (XWINDOW (window)->width) 1646 == FRAME_WIDTH (XFRAME (WINDOW_FRAME (XWINDOW (window))))))
1681 == FRAME_WIDTH (XFRAME (WINDOW_FRAME (XWINDOW (window))))))
1682 window = Fsplit_window (window, Qnil, Qnil); 1647 window = Fsplit_window (window, Qnil, Qnil);
1683 else 1648 else
1684 { 1649 {
@@ -2055,6 +2020,36 @@ window_internal_height (w)
2055 return ht; 2020 return ht;
2056} 2021}
2057 2022
2023
2024/* Return the number of columns in W.
2025 Don't count columns occupied by scrollbars or the vertical bar
2026 separating W from the sibling to its right. */
2027int
2028window_internal_width (w)
2029 struct window *w;
2030{
2031 FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
2032 int left = XINT (w->left);
2033 int width = XINT (w->width);
2034
2035 /* If this window is flush against the right edge of the frame, its
2036 internal width is its full width. */
2037 if (left + width >= FRAME_WIDTH (f))
2038 return width;
2039
2040 /* If we are not flush right, then our rightmost columns are
2041 occupied by some sort of separator. */
2042
2043 /* Scrollbars occupy a few columns. */
2044 if (FRAME_HAS_VERTICAL_SCROLLBARS (f))
2045 return width - VERTICAL_SCROLLBAR_WIDTH;
2046
2047 /* The column of `|' characters separating side-by-side windows
2048 occupies one column only. */
2049 return width - 1;
2050}
2051
2052
2058/* Scroll contents of window WINDOW up N lines. */ 2053/* Scroll contents of window WINDOW up N lines. */
2059 2054
2060void 2055void
@@ -2252,7 +2247,7 @@ Default for ARG is window width minus 2.")
2252{ 2247{
2253 2248
2254 if (NILP (arg)) 2249 if (NILP (arg))
2255 XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2; 2250 XFASTINT (arg) = window_internal_width (selected_window) - 2;
2256 else 2251 else
2257 arg = Fprefix_numeric_value (arg); 2252 arg = Fprefix_numeric_value (arg);
2258 2253
@@ -2269,7 +2264,7 @@ Default for ARG is window width minus 2.")
2269 register Lisp_Object arg; 2264 register Lisp_Object arg;
2270{ 2265{
2271 if (NILP (arg)) 2266 if (NILP (arg))
2272 XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2; 2267 XFASTINT (arg) = window_internal_width (selected_window) - 2;
2273 else 2268 else
2274 arg = Fprefix_numeric_value (arg); 2269 arg = Fprefix_numeric_value (arg);
2275 2270