From: H.G. Muller <h.g.muller@hccnet.nl>
Date: Sun, 28 Nov 2010 19:24:46 +0000 (+0100)
Subject: Let move-history window scroll to bottom after adding move
X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=2cb4a110b66e8c1aef35ce2309596b0d81880561;p=xboard.git

Let move-history window scroll to bottom after adding move

By activating the scrollbar of the viewport through XtCallActionProc
the move-history window is scrolled to the bottom.
---

diff --git a/xhistory.c b/xhistory.c
index 008d4ca..76e3239 100644
--- a/xhistory.c
+++ b/xhistory.c
@@ -224,6 +224,7 @@ HistoryFill()
 
 void HistorySet(char movelist[][2*MOVE_LEN],int first,int last,int current){
   int i,b,m;
+  Widget scroll;
   if(hist){
     if(last >= hist->aNr) HistoryAlloc(last+_LL_);
     for(i=0;i<last;i++) {
@@ -275,6 +276,13 @@ void HistorySet(char movelist[][2*MOVE_LEN],int first,int last,int current){
       if(current) XawListHighlight(hist->mvb, current/2+1);
       else XawListUnhighlight(hist->mvb);
     }
+    if(scroll = XtNameToWidget(hist->sh, "*form.viewport.vertical")) { // [HGM] always scroll to bottom
+      static char *params[3] = { "", "Forward", "FullLength" };
+      static XEvent event;
+      XtCallActionProc(scroll, "StartScroll", &event, params+1, 1);
+      XtCallActionProc(scroll, "NotifyScroll", &event, params+2, 1);
+      XtCallActionProc(scroll, "EndScroll", &event, params, 0);
+    }
   }
   EvalGraphSet( first, last, current, pvInfoList ); // piggy-backed
 }