Better solution to button-height problem
[xboard.git] / xboard.c
index f05027d..f9ba5cc 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -540,6 +540,7 @@ int squareSize, smallLayout = 0, tinyLayout = 0,
   ICSInputBoxUp = False, askQuestionUp = False,
   filenameUp = False, promotionUp = False, pmFromX = -1, pmFromY = -1,
   errorUp = False, errorExitStatus = -1, lineGap, defaultLineGap;
+Dimension textHeight;
 Pixel timerForegroundPixel, timerBackgroundPixel;
 Pixel buttonForegroundPixel, buttonBackgroundPixel;
 char *chessDir, *programName, *programVersion,
@@ -960,7 +961,7 @@ XtActionsRec boardActions[] = {
     { "EvalGraphProc", EvalGraphProc},       // [HGM] Winboard_x avaluation graph window
     { "ShowGameListProc", ShowGameListProc },
     { "ShowMoveListProc", HistoryShowProc},
-    { "EditTagsProc", EditCommentProc },
+    { "EditTagsProc", EditTagsProc },
     { "EditBookProc", EditBookProc },
     { "EditCommentProc", EditCommentProc },
     { "IcsInputBoxProc", IcsInputBoxProc },
@@ -1817,7 +1818,7 @@ InitDrawingSizes (BoardSize boardSize, int flags)
     }
   }
 #if HAVE_LIBXPM
-  if(appData.monoMode == oldMono)
+  if(appData.monoMode != oldMono)
     CreateAnimVars();
 #endif
   oldMono = appData.monoMode;
@@ -2174,10 +2175,13 @@ XBoard square size (hint): %d\n\
       /* For the coordFont, use the 0th font of the fontset. */
       XFontSet coordFontSet = CreateFontSet(appData.coordFont);
       XFontStruct **font_struct_list;
+      XFontSetExtents *fontSize;
       char **font_name_list;
       XFontsOfFontSet(coordFontSet, &font_struct_list, &font_name_list);
       coordFontID = XLoadFont(xDisplay, font_name_list[0]);
       coordFontStruct = XQueryFont(xDisplay, coordFontID);
+      fontSize = XExtentsOfFontSet(fontSet); // [HGM] figure out how much vertical space font takes
+      textHeight = fontSize->max_logical_extent.height + 5; // add borderWidth
     }
 #else
     appData.font = FindFont(appData.font, fontPxlSize);
@@ -2460,6 +2464,7 @@ XBoard square size (hint): %d\n\
              programName, gres, w, h, wr, hr);
     }
     /* !! end hack */
+    if(!textHeight) textHeight = hr; // [HGM] if !NLS textHeight is still undefined, and we grab it from here
     XtSetArg(args[0], XtNleft,  XtChainLeft);  // [HGM] glue ends for good run-time sizing
     XtSetArg(args[1], XtNright, XtChainRight);
     XtSetValues(messageWidget, args, 2);
@@ -8245,11 +8250,6 @@ AnimateMove (Board board, int fromX, int fromY, int toX, int toY)
   hop = abs(fromX-toX) == 1 && abs(fromY-toY) == 2 || abs(fromX-toX) == 2 && abs(fromY-toY) == 1;
 #endif
 
-  if (appData.debugMode) {
-      fprintf(debugFP, hop ? _("AnimateMove: piece %d hops from %d,%d to %d,%d \n") :
-                             _("AnimateMove: piece %d slides from %d,%d to %d,%d \n"),
-             piece, fromX, fromY, toX, toY);  }
-
   ScreenSquare(fromX, fromY, &start, &startColor);
   ScreenSquare(toX, toY, &finish, &endColor);