From f95d2445401b6419ede201531c31628c81b8ffdd Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 8 Aug 2011 10:31:24 +0200 Subject: [PATCH] Add key bindings for loading next/previous game of list These bindings are set both for the game list and the board window. To make them useful, focus has to be transferred to the board widget after loading (it tends to transfer to the tags window), which now seems to work, but not always. From the game list the shellWidget seems to get focus rather than the board, which is bad as it is not sensitive to the key bindings. --- xboard.c | 2 ++ xgamelist.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/xboard.c b/xboard.c index 9e300b0..51c169e 100644 --- a/xboard.c +++ b/xboard.c @@ -1051,6 +1051,8 @@ char globalTranslations[] = :Ctrlo: LoadGameProc() \n \ :MetaNext: LoadNextGameProc() \n \ :MetaPrior: LoadPrevGameProc() \n \ + :CtrlDown: LoadSelectedProc(3) \n \ + :CtrlUp: LoadSelectedProc(-3) \n \ :Ctrls: SaveGameProc() \n \ :Ctrlc: CopyGameProc() \n \ :Ctrlv: PasteGameProc() \n \ diff --git a/xgamelist.c b/xgamelist.c index 2d3ce02..abccb04 100644 --- a/xgamelist.c +++ b/xgamelist.c @@ -101,6 +101,8 @@ char gameListTranslations[] = "(2): LoadSelectedProc(0) \n \ Home: LoadSelectedProc(-2) \n \ End: LoadSelectedProc(2) \n \ + CtrlUp: LoadSelectedProc(-3) \n \ + CtrlDown: LoadSelectedProc(3) \n \ Up: LoadSelectedProc(-1) \n \ Down: LoadSelectedProc(1) \n \ Left: LoadSelectedProc(-1) \n \ @@ -570,18 +572,22 @@ LoadSelectedProc(w, event, prms, nprms) } if(direction != 0) { + int doLoad = abs(direction) > 2; + if(doLoad) direction /= 3; index += direction; if(direction == -2) index = 0; if(direction == 2) index = listLength-1; if(index < 0 || index >= listLength) return; XawListHighlight(listwidg, index); - return; + if(!doLoad) return; } index = atoi(list[index])-1; // [HGM] filter: read true index from sequence nr of line if (cmailMsgLoaded) { CmailLoadGame(glc->fp, index + 1, glc->filename, True); } else { LoadGame(glc->fp, index + 1, glc->filename, True); + XSync(xDisplay, False); + XSetInputFocus(xDisplay, XtWindow(boardWidget), RevertToPointerRoot, CurrentTime); } } -- 1.7.0.4