Let move-history window scroll to bottom after adding move
authorH.G. Muller <h.g.muller@hccnet.nl>
Sun, 28 Nov 2010 19:24:46 +0000 (20:24 +0100)
committerArun Persaud <arun@nubati.net>
Fri, 3 Dec 2010 07:14:23 +0000 (23:14 -0800)
By activating the scrollbar of the viewport through XtCallActionProc
the move-history window is scrolled to the bottom.

xhistory.c

index 008d4ca..76e3239 100644 (file)
@@ -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
 }