Fix some warnings and header-file improvement
[xboard.git] / xhistory.c
index 008d4ca..c00a9b8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * xhistory.c -- Move list window, part of X front end for XBoard
  *
- * Copyright 2000, 2009, 2010 Free Software Foundation, Inc.
+ * Copyright 2000, 2009, 2010, 2011 Free Software Foundation, Inc.
  * ------------------------------------------------------------------------
  *
  * GNU XBoard is free software: you can redistribute it and/or modify
@@ -79,12 +79,6 @@ extern char *getenv();
 
 #define _LL_ 100
 
-extern Widget formWidget, shellWidget, boardWidget, menuBarWidget, historyShell;
-extern Display *xDisplay;
-extern int squareSize;
-extern Pixmap xMarkPixmap;
-extern char *layoutName;
-
 struct History{
   String *Nr,*white,*black;
   int     aNr;  /* space actually alocated */
@@ -224,6 +218,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 +270,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
 }