Fix startup focus of board window
authorH.G. Muller <h.g.muller@hccnet.nl>
Wed, 13 Apr 2011 14:33:16 +0000 (16:33 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Thu, 14 Apr 2011 19:30:17 +0000 (21:30 +0200)
When there were open auxiliary windows, these would have focus on
starting up XBoard. The XtSetKeyboardFocus call added in XBoard main()
was ineffective in curing that. It has now been replaced by a call to
XSetInputFocus, which does do the job. By giving input focus to the form
widget, rather than the board widget, XBoard will be immediately
sensitive to all key bindings.

xboard.c

index d216fe8..2178163 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -2622,7 +2622,8 @@ XBoard square size (hint): %d\n\
     }
     gameInfo.boardWidth = 0; // [HGM] pieces: kludge to ensure InitPosition() calls InitDrawingSizes()
     InitPosition(TRUE);
-    XtSetKeyboardFocus(shellWidget, formWidget);
+//    XtSetKeyboardFocus(shellWidget, formWidget);
+    XSetInputFocus(xDisplay, XtWindow(formWidget), RevertToPointerRoot, CurrentTime);
 
     XtAppMainLoop(appContext);
     if (appData.debugMode) fclose(debugFP); // [DM] debug