fix the irritating wandering off of the MoveHistory window in XBoard on opening/closing.
authorH.G. Muller <h.g.muller@hccnet.nl>
Sun, 22 Nov 2009 20:34:13 +0000 (12:34 -0800)
committerArun Persaud <arun@nubati.net>
Sun, 22 Nov 2009 20:34:13 +0000 (12:34 -0800)
xhistory.c

index c2ac392..6f94e62 100644 (file)
@@ -94,6 +94,7 @@ struct History{
 struct History *hist=0;
 String dots=" ... ";
 Position gameHistoryX, gameHistoryY;
+Dimension gameHistoryW;
 
 void
 HistoryPopDown(w, client_data, call_data)
@@ -103,12 +104,6 @@ HistoryPopDown(w, client_data, call_data)
   Arg args[16];
   int j;
   if(hist) {
-    // [HGM] remember old position
-    j = 0;
-    XtSetArg(args[j], XtNx, &gameHistoryX);  j++;
-    XtSetArg(args[j], XtNy, &gameHistoryY);  j++;
-    XtGetValues(hist->sh, args, j);
-
     XtPopdown(hist->sh);
     hist->Up=False;
   }
@@ -401,6 +396,18 @@ Widget HistoryCreate()
       strcpy(hist->black[i],"");
      }
 
+  // [HGM] restore old position
+  j = 0;
+  XtSetArg(args[j], XtNx, &gameHistoryX);  j++;
+  XtSetArg(args[j], XtNy, &gameHistoryY);  j++;
+  XtSetArg(args[j], XtNwidth, &gameHistoryW);  j++;
+  XtGetValues(shellWidget, args, j);
+  j = 0;
+  XtSetArg(args[j], XtNx, gameHistoryX + gameHistoryW);  j++;
+  XtSetArg(args[j], XtNy, gameHistoryY);  j++;
+  XtSetValues(hist->sh, args, j);
+    XtRealizeWidget(hist->sh);
+
     return hist->sh;
 }
 
@@ -414,12 +421,6 @@ HistoryPopUp()
 
   XtPopup(hist->sh, XtGrabNone);
 
-  // [HGM] restore old position
-  j = 0;
-  XtSetArg(args[j], XtNx, gameHistoryX);  j++;
-  XtSetArg(args[j], XtNy, gameHistoryY);  j++;
-  XtSetValues(hist->sh, args, j);
-
   j=0;
   XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++;
   XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Show Move History"),