From 470049525f4c6af994570ae6a4cf3311f442e929 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Sun, 5 Sep 1999 21:22:46 +0000 Subject: [PATCH] (Fset_window_vscroll): Make window the first argument, amount to scroll the second. Take non-negative vscroll as argument. (Fwindow_vscroll): Return non-negative vscroll. --- src/window.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/window.c b/src/window.c index 5f1af561632..6f1a325d67c 100644 --- a/src/window.c +++ b/src/window.c @@ -4643,43 +4643,51 @@ Value is a multiple of the canonical character height of WINDOW.") (window) Lisp_Object window; { + Lisp_Object result; struct frame *f; struct window *w; if (NILP (window)) window = selected_window; + else + CHECK_WINDOW (window, 0); w = XWINDOW (window); f = XFRAME (w->frame); if (FRAME_WINDOW_P (f)) - return CANON_Y_FROM_PIXEL_Y (f, w->vscroll); + result = CANON_Y_FROM_PIXEL_Y (f, -w->vscroll); else - return make_number (0); + result = make_number (0); + return result; } DEFUN ("set-window-vscroll", Fset_window_vscroll, Sset_window_vscroll, - 1, 2, 0, - "Set amount by WINDOW should be scrolled vertically to VSCROLL.\n\ + 2, 2, 0, + "Set amount by which WINDOW should be scrolled vertically to VSCROLL.\n\ WINDOW nil or omitted means use the selected window. VSCROLL is a\n\ -multiple of the canonical character height of WINDOW.") - (vscroll, window) - Lisp_Object vscroll, window; +non-negative multiple of the canonical character height of WINDOW.") + (window, vscroll) + Lisp_Object window, vscroll; { struct window *w; struct frame *f; - CHECK_NUMBER_OR_FLOAT (vscroll, 0); - if (NILP (window)) window = selected_window; + else + CHECK_WINDOW (window, 0); + CHECK_NUMBER_OR_FLOAT (vscroll, 1); + w = XWINDOW (window); f = XFRAME (w->frame); if (FRAME_WINDOW_P (f)) { int old_dy = w->vscroll; - w->vscroll = min (0, CANON_Y_UNIT (f) * XFLOATINT (vscroll)); + + w->vscroll = - CANON_Y_UNIT (f) * XFLOATINT (vscroll); + w->vscroll = min (w->vscroll, 0); /* Adjust glyph matrix of the frame if the virtual display area becomes larger than before. */ @@ -4690,7 +4698,7 @@ multiple of the canonical character height of WINDOW.") XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; } - return Qnil; + return Fwindow_vscroll (window); } -- 2.39.5