--- chooser.c Mon May 23 17:05:39 2005 +++ /net/alf/export/alanc/X.org/head/cvs-rw/xc/programs/xdm/chooser.c Mon May 23 17:00:27 2005 @@ -1042,7 +1042,32 @@ if (!h->willing) XawListUnhighlight (list); else + { + /* Scroll viewport to make sure new selection is visible */ + Arg size[2]; + Dimension height, portheight; + Position y; + int lineheight, liney, newy = 0; + + XtSetArg (size[0], XtNheight, &height); + XtSetArg (size[1], XtNy, &y); + XtGetValues (list, size, (Cardinal) 2); + + XtSetArg (size[0], XtNheight, &portheight); + XtGetValues (viewport, size, (Cardinal) 1); + + lineheight = height / NameTableSize; + liney = lineheight * line; + + if ((y + liney) < 0) { + XawViewportSetCoordinates(viewport, 0, liney); + } else if ((y + liney + lineheight) > portheight) { + XawViewportSetCoordinates(viewport, 0, + (liney + lineheight) - portheight); + } + return 1; + } } } return 0;