-
Notifications
You must be signed in to change notification settings - Fork 0
/
scrollbar.c
666 lines (589 loc) · 18.7 KB
/
scrollbar.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
/*
* $XConsortium: scrollbar.c /main/47 1996/12/01 23:47:08 swick $
* $XFree86: xc/programs/xterm/scrollbar.c,v 3.26 2000/03/03 20:02:34 dawes Exp $
*/
/*
* Copyright 2000 by Thomas E. Dickey <dickey@clark.net>
*
* All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name(s) of the above copyright
* holders shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization.
*
*
* Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of Digital Equipment
* Corporation not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior permission.
*
*
* DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <xterm.h>
#include <X11/Xatom.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#ifdef MOTIF
#include <X11/cursorfont.h>
#include <Xm/ScrollBar.h>
#else
#include <X11/Xaw/Scrollbar.h>
#endif /* MOTIF */
#include <data.h>
#include <error.h>
#include <menu.h>
#include <xcharmouse.h>
/* Event handlers */
#ifdef MOTIF
static void ScrollTextTo ();
#else
static void ScrollTextTo PROTO_XT_CALLBACK_ARGS;
#endif /* MOTIF */
static void ScrollTextUpDownBy PROTO_XT_CALLBACK_ARGS;
/* resize the text window for a terminal screen, modifying the
* appropriate WM_SIZE_HINTS and taking advantage of bit gravity.
*/
static void
ResizeScreen(register XtermWidget xw, int min_width, int min_height)
{
register TScreen *screen = &xw->screen;
#ifndef nothack
XSizeHints sizehints;
long supp;
#endif
XtGeometryResult geomreqresult;
Dimension reqWidth, reqHeight, repWidth, repHeight;
#ifndef NO_ACTIVE_ICON
struct _vtwin *saveWin = screen->whichVwin;
/* all units here want to be in the normal font units */
screen->whichVwin = &screen->fullVwin;
#endif /* NO_ACTIVE_ICON */
/*
* I'm going to try to explain, as I understand it, why we
* have to do XGetWMNormalHints and XSetWMNormalHints here,
* although I can't guarantee that I've got it right.
*
* In a correctly written toolkit program, the Shell widget
* parses the user supplied geometry argument. However,
* because of the way xterm does things, the VT100 widget does
* the parsing of the geometry option, not the Shell widget.
* The result of this is that the Shell widget doesn't set the
* correct window manager hints, and doesn't know that the
* user has specified a geometry.
*
* The XtVaSetValues call below tells the Shell widget to
* change its hints. However, since it's confused about the
* hints to begin with, it doesn't get them all right when it
* does the SetValues -- it undoes some of what the VT100
* widget did when it originally set the hints.
*
* To fix this, we do the following:
*
* 1. Get the sizehints directly from the window, going around
* the (confused) shell widget.
* 2. Call XtVaSetValues to let the shell widget know which
* hints have changed. Note that this may not even be
* necessary, since we're going to right ahead after that
* and set the hints ourselves, but it's good to put it
* here anyway, so that when we finally do fix the code so
* that the Shell does the right thing with hints, we
* already have the XtVaSetValues in place.
* 3. We set the sizehints directly, this fixing up whatever
* damage was done by the Shell widget during the
* XtVaSetValues.
*
* Gross, huh?
*
* The correct fix is to redo VTRealize, VTInitialize and
* VTSetValues so that font processing happens early enough to
* give back responsibility for the size hints to the Shell.
*
* Someday, we hope to have time to do this. Someday, we hope
* to have time to completely rewrite xterm.
*/
TRACE(("ResizeScreen(min_width=%d, min_height=%d) xw=%#lx\n",
min_width, min_height, (long) xw));
#ifndef nothack
/*
* NOTE: If you change the way any of the hints are calculated
* below, make sure you change the calculation both in the
* sizehints assignments and in the XtVaSetValues.
*/
if (! XGetWMNormalHints(screen->display, XtWindow(XtParent(xw)),
&sizehints, &supp))
sizehints.flags = 0;
sizehints.base_width = min_width;
sizehints.base_height = min_height;
sizehints.width_inc = FontWidth(screen);
sizehints.height_inc = FontHeight(screen);
sizehints.min_width = sizehints.base_width + sizehints.width_inc;
sizehints.min_height = sizehints.base_height + sizehints.height_inc;
sizehints.flags |= (PBaseSize|PMinSize|PResizeInc);
/* These are obsolete, but old clients may use them */
sizehints.width = (screen->max_col + 1) * FontWidth(screen)
+ min_width;
sizehints.height = (screen->max_row + 1) * FontHeight(screen)
+ min_height;
#endif
/*
* Note: width and height are not set here because they are
* obsolete.
*/
XtVaSetValues(XtParent(xw),
XtNbaseWidth, min_width,
XtNbaseHeight, min_height,
XtNwidthInc, FontWidth(screen),
XtNheightInc, FontHeight(screen),
XtNminWidth, min_width + FontWidth(screen),
XtNminHeight, min_height + FontHeight(screen),
NULL);
reqWidth = screen->fullVwin.f_width * (screen->max_col + 1) + min_width;
reqHeight = screen->fullVwin.f_height * (screen->max_row + 1) + min_height;
TRACE(("...requesting screensize chars %dx%d, pixels %dx%d\n",
(screen->max_row + 1),
(screen->max_col + 1),
reqHeight, reqWidth));
geomreqresult = XtMakeResizeRequest ((Widget)xw, reqWidth, reqHeight,
&repWidth, &repHeight);
if (geomreqresult == XtGeometryAlmost) {
TRACE(("...almost, retry screensize %dx%d\n", repHeight, repWidth));
geomreqresult = XtMakeResizeRequest ((Widget)xw, repWidth,
repHeight, NULL, NULL);
}
XSync(screen->display, FALSE); /* synchronize */
if(XtAppPending(app_con))
xevents();
#ifndef nothack
XSetWMNormalHints(screen->display, XtWindow(XtParent(xw)), &sizehints);
#endif
#ifndef NO_ACTIVE_ICON
screen->whichVwin = saveWin;
#endif /* NO_ACTIVE_ICON */
}
void DoResizeScreen (register XtermWidget xw)
{
int border = 2 * xw->screen.border;
ResizeScreen (xw, border + xw->screen.fullVwin.scrollbar, border);
}
static Widget
CreateScrollBar(XtermWidget xw, int x, int y, int height)
{
Widget scrollWidget;
#ifdef MOTIF
static Arg argList[] = {
{XmNx, (XtArgVal) 0},
{XmNy, (XtArgVal) 0},
{XmNheight, (XtArgVal) 0},
/* motif widget doesn't have reverse video garbage */
{XmNorientation, (XtArgVal) XmVERTICAL},
{XmNsliderMark, (XtArgVal) XmNONE},
{XmNborderWidth, (XtArgVal) 1},
};
argList[0].value = (XtArgVal) x;
argList[1].value = (XtArgVal) y;
argList[2].value = (XtArgVal) height;
scrollWidget = XtCreateWidget("scrollbar", xmScrollBarWidgetClass,
(Widget)xw, argList, XtNumber(argList));
XtAddCallback (scrollWidget, XmNvalueChangedCallback, ScrollTextTo, 0);
XtAddCallback (scrollWidget, XmNdragCallback, ScrollTextTo, 0);
#else
static Arg argList[] = {
{XtNx, (XtArgVal) 0},
{XtNy, (XtArgVal) 0},
{XtNheight, (XtArgVal) 0},
{XtNreverseVideo, (XtArgVal) 0},
{XtNorientation, (XtArgVal) XtorientVertical},
{XtNborderWidth, (XtArgVal) 1},
};
argList[0].value = (XtArgVal) x;
argList[1].value = (XtArgVal) y;
argList[2].value = (XtArgVal) height;
argList[3].value = (XtArgVal) xw->misc.re_verse;
scrollWidget = XtCreateWidget("scrollbar", scrollbarWidgetClass,
(Widget)xw, argList, XtNumber(argList));
XtAddCallback (scrollWidget, XtNscrollProc, ScrollTextUpDownBy, 0);
XtAddCallback (scrollWidget, XtNjumpProc, ScrollTextTo, 0);
#endif /* MOTIF */
return (scrollWidget);
}
void
ScrollBarReverseVideo(register Widget scrollWidget)
{
#ifndef MOTIF
Arg args[4];
Cardinal nargs = XtNumber(args);
unsigned long bg, fg, bdr;
Pixmap bdpix;
XtSetArg(args[0], XtNbackground, &bg);
XtSetArg(args[1], XtNforeground, &fg);
XtSetArg(args[2], XtNborderColor, &bdr);
XtSetArg(args[3], XtNborderPixmap, &bdpix);
XtGetValues (scrollWidget, args, nargs);
args[0].value = (XtArgVal) fg;
args[1].value = (XtArgVal) bg;
nargs--; /* don't set border_pixmap */
if (bdpix == XtUnspecifiedPixmap) { /* if not pixmap then pixel */
args[2].value = args[1].value; /* keep border visible */
} else { /* ignore since pixmap */
nargs--; /* don't set border pixel */
}
XtSetValues (scrollWidget, args, nargs);
#endif /* MOTIF */
}
void
ScrollBarDrawThumb(register Widget scrollWidget)
{
#ifdef MOTIF
Arg args[4];
Cardinal nargs = XtNumber(args);
#endif /* MOTIF */
register TScreen *screen = &term->screen;
register int thumbTop, thumbHeight, totalHeight;
thumbTop = screen->topline + screen->savedlines;
thumbHeight = screen->max_row + 1;
totalHeight = thumbHeight + screen->savedlines;
#ifdef MOTIF
XtSetArg(args[0], XmNmaximum, totalHeight);
XtSetArg(args[1], XmNsliderSize, thumbHeight);
XtSetArg(args[2], XmNvalue, thumbTop);
XtSetArg(args[3], XmNpageIncrement, thumbHeight);
XtSetValues(scrollWidget, args, nargs);
#else
XawScrollbarSetThumb(scrollWidget,
((float)thumbTop) / totalHeight,
((float)thumbHeight) / totalHeight);
#endif /* MOTIF */
}
void
ResizeScrollBar(TScreen *screen)
{
XtConfigureWidget(
screen->scrollWidget,
#ifdef SCROLLBAR_RIGHT
(term->misc.useRight)
? (term->core.width -
screen->scrollWidget->core.width -
screen->scrollWidget->core.border_width)
: -1,
#else
-1,
#endif
-1,
screen->scrollWidget->core.width,
screen->fullVwin.height + screen->border * 2,
screen->scrollWidget->core.border_width);
ScrollBarDrawThumb(screen->scrollWidget);
}
void
WindowScroll(register TScreen *screen, int top)
{
register int i, lines;
register int scrolltop, scrollheight, refreshtop;
register int x = 0;
if (top < -screen->savedlines)
top = -screen->savedlines;
else if (top > 0)
top = 0;
if((i = screen->topline - top) == 0) {
ScrollBarDrawThumb(screen->scrollWidget);
return;
}
if(screen->cursor_state)
HideCursor();
lines = i > 0 ? i : -i;
if(lines > screen->max_row + 1)
lines = screen->max_row + 1;
scrollheight = screen->max_row - lines + 1;
if(i > 0)
refreshtop = scrolltop = 0;
else {
scrolltop = lines;
refreshtop = scrollheight;
}
x = OriginX(screen);
scrolling_copy_area(screen, scrolltop, scrollheight, -i);
screen->topline = top;
ScrollSelection(screen, i);
XClearArea(
screen->display,
VWindow(screen),
(int) x,
(int) refreshtop * FontHeight(screen) + screen->border,
(unsigned) Width(screen),
(unsigned) lines * FontHeight(screen),
FALSE);
ScrnRefresh(screen, refreshtop, 0, lines, screen->max_col + 1, False);
ScrollBarDrawThumb(screen->scrollWidget);
}
void
ScrollBarOn (XtermWidget xw, int init, int doalloc)
{
#ifdef MOTIF
Cursor arrowCursor;
#endif /* MOTIF */
register TScreen *screen = &xw->screen;
register int i, j, k;
if(screen->fullVwin.scrollbar)
return;
if (init) { /* then create it only */
if (screen->scrollWidget) return;
/* make it a dummy size and resize later */
if ((screen->scrollWidget = CreateScrollBar (xw, -1, -1, 5))
== NULL) {
Bell(XkbBI_MinorError,0);
return;
}
return;
}
if (!screen->scrollWidget) {
Bell (XkbBI_MinorError,0);
Bell (XkbBI_MinorError,0);
return;
}
if (doalloc && screen->allbuf) {
/* FIXME: this is not integrated well with Allocate */
if((screen->allbuf =
(ScrnBuf) realloc((char *) screen->visbuf,
(unsigned) MAX_PTRS*(screen->max_row + 2 +
screen->savelines) *
sizeof(char *)))
== NULL)
Error (ERROR_SBRALLOC);
screen->visbuf = &screen->allbuf[MAX_PTRS * screen->savelines];
memmove( (char *)screen->visbuf, (char *)screen->allbuf,
MAX_PTRS * (screen->max_row + 2) * sizeof (char *));
for (i = k = 0; i < screen->savelines; i++) {
k += BUF_HEAD;
for (j = BUF_HEAD; j < MAX_PTRS; j++) {
if((screen->allbuf[k++] =
(Char *)calloc((unsigned) screen->max_col + 1, sizeof(Char))) ==
NULL)
Error (ERROR_SBRALLOC2);
}
}
}
ResizeScrollBar (screen);
XtRealizeWidget (screen->scrollWidget);
#ifdef MOTIF
/* define pointer cursor for it */
arrowCursor = XCreateFontCursor(XtDisplay(screen->scrollWidget), XC_left_ptr);
XDefineCursor(XtDisplay(screen->scrollWidget), XtWindow(screen->scrollWidget), arrowCursor);
XFreeCursor(XtDisplay(screen->scrollWidget), arrowCursor);
#endif /* MOTIF */
screen->fullVwin.scrollbar = screen->scrollWidget->core.width +
screen->scrollWidget->core.border_width;
ScrollBarDrawThumb(screen->scrollWidget);
DoResizeScreen (xw);
#ifdef SCROLLBAR_RIGHT
/*
* Adjust the scrollbar position if we're asked to turn on scrollbars
* for the first time after the xterm is already running. That makes
* the window grow after we've initially configured the scrollbar's
* position. (There must be a better way).
*/
if (term->misc.useRight
&& screen->fullVwin.fullwidth < term->core.width)
XtVaSetValues(screen->scrollWidget,
XtNx, screen->fullVwin.fullwidth - screen->scrollWidget->core.border_width,
NULL);
#endif
XtMapWidget(screen->scrollWidget);
update_scrollbar ();
if (screen->visbuf) {
XClearWindow (screen->display, XtWindow (term));
Redraw ();
}
}
void
ScrollBarOff(register TScreen *screen)
{
if(!screen->fullVwin.scrollbar)
return;
XtUnmapWidget(screen->scrollWidget);
screen->fullVwin.scrollbar = 0;
DoResizeScreen (term);
update_scrollbar ();
if (screen->visbuf) {
XClearWindow (screen->display, XtWindow (term));
Redraw ();
}
}
/*
* Toggle the visibility of the scrollbars.
*/
void
ToggleScrollBar(XtermWidget w)
{
register TScreen *screen = &w->screen;
if (screen->fullVwin.scrollbar) {
ScrollBarOff (screen);
} else {
ScrollBarOn (w, FALSE, FALSE);
}
update_scrollbar();
}
/*ARGSUSED*/
static void
ScrollTextTo(
Widget scrollbarWidget GCC_UNUSED,
XtPointer client_data GCC_UNUSED,
#ifdef MOTIF
XmScrollBarCallbackStruct *call_data)
#else
XtPointer call_data)
#endif /* MOTIF */
{
float *topPercent = (float *) call_data;
register TScreen *screen = &term->screen;
int thumbTop; /* relative to first saved line */
int newTopLine;
/*
screen->savedlines : Number of offscreen text lines,
screen->maxrow + 1 : Number of onscreen text lines,
screen->topline : -Number of lines above the last screen->max_row+1 lines
*/
#ifdef MOTIF
thumbTop = call_data->value;
#else
thumbTop = (int) (*topPercent * (screen->savedlines + screen->max_row+1));
#endif /* MOTIF */
newTopLine = thumbTop - screen->savedlines;
WindowScroll(screen, newTopLine);
}
/*ARGSUSED*/
static void
ScrollTextUpDownBy(
Widget scrollbarWidget GCC_UNUSED,
XtPointer client_data GCC_UNUSED,
XtPointer call_data)
{
long pixels = (long) call_data;
register TScreen *screen = &term->screen;
register int rowOnScreen, newTopLine;
rowOnScreen = pixels / FontHeight(screen);
if (rowOnScreen == 0) {
if (pixels < 0)
rowOnScreen = -1;
else if (pixels > 0)
rowOnScreen = 1;
}
newTopLine = screen->topline + rowOnScreen;
WindowScroll(screen, newTopLine);
}
/*
* assume that b is lower case and allow plural
*/
static int
specialcmplowerwiths (char *a, char *b)
{
register char ca, cb;
if (!a || !b) return 0;
while (1) {
ca = char2lower(*a);
cb = *b;
if (ca != cb || ca == '\0') break; /* if not eq else both nul */
a++, b++;
}
if (cb == '\0' && (ca == '\0' || (ca == 's' && a[1] == '\0')))
return 1;
return 0;
}
static long
params_to_pixels (TScreen *screen, String *params, Cardinal n)
{
register int mult = 1;
register char *s;
switch (n > 2 ? 2 : n) {
case 2:
s = params[1];
if (specialcmplowerwiths (s, "page")) {
mult = (screen->max_row + 1) * FontHeight(screen);
} else if (specialcmplowerwiths (s, "halfpage")) {
mult = ((screen->max_row + 1) * FontHeight(screen)) >> 1;
} else if (specialcmplowerwiths (s, "pixel")) {
mult = 1;
} else {
/* else assume that it is Line */
mult = FontHeight(screen);
}
mult *= atoi (params[0]);
break;
case 1:
mult = atoi (params[0]) * FontHeight(screen); /* lines */
break;
default:
mult = screen->scrolllines * FontHeight(screen);
break;
}
return mult;
}
static long
AmountToScroll(Widget gw, String *params, Cardinal nparams)
{
if (IsXtermWidget(gw)) {
register TScreen *screen = &((XtermWidget)gw)->screen;
if (nparams > 2
&& screen->send_mouse_pos != MOUSE_OFF)
return 0;
return params_to_pixels (screen, params, nparams);
}
return 0;
}
/*ARGSUSED*/
void HandleScrollForward (
Widget gw,
XEvent *event GCC_UNUSED,
String *params,
Cardinal *nparams)
{
long amount;
if ((amount = AmountToScroll(gw, params, *nparams)) != 0) {
ScrollTextUpDownBy (gw, (XtPointer) 0, (XtPointer)amount);
}
}
/*ARGSUSED*/
void HandleScrollBack (
Widget gw,
XEvent *event GCC_UNUSED,
String *params,
Cardinal *nparams)
{
long amount;
if ((amount = -AmountToScroll(gw, params, *nparams)) != 0) {
ScrollTextUpDownBy (gw, (XtPointer) 0, (XtPointer)amount);
}
}