From: H.G. Muller Date: Sat, 23 Jan 2010 22:00:10 +0000 (+0100) Subject: Use arrow keys in XBoard GameList for entry selection X-Git-Tag: master-20100206~30 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=d954a9a2cfff2fe954f09abb3392a26a20d1952e;p=xboard.git Use arrow keys in XBoard GameList for entry selection Add translations for arrows and home/end, to call LoadSelectedProc with argument to indicate the step, and let the latter perform the action. --- diff --git a/xgamelist.c b/xgamelist.c index 3a04f3f..35194ac 100644 --- a/xgamelist.c +++ b/xgamelist.c @@ -104,8 +104,14 @@ static char filterString[MSG_SIZ]; static int listLength; char gameListTranslations[] = - "(2): LoadSelectedProc() \n \ - Return: LoadSelectedProc() \n"; + "(2): LoadSelectedProc(0) \n \ + Home: LoadSelectedProc(-2) \n \ + End: LoadSelectedProc(2) \n \ + Up: LoadSelectedProc(-1) \n \ + Down: LoadSelectedProc(1) \n \ + Left: LoadSelectedProc(-1) \n \ + Right: LoadSelectedProc(1) \n \ + Return: LoadSelectedProc(0) \n"; char filterTranslations[] = "Return: SetFilterProc() \n"; @@ -320,6 +326,7 @@ GameListCreate(name, callback, client_data) XtRealizeWidget(shell); CatchDeleteWindow(shell, "GameListPopDown"); + XtSetKeyboardFocus(shell, listwidg); return shell; } @@ -523,13 +530,21 @@ LoadSelectedProc(w, event, prms, nprms) { Widget listwidg; XawListReturnStruct *rs; - int index; + int index, direction = atoi(prms[0]); if (glc == NULL) return; listwidg = XtNameToWidget(glc->shell, "*form.viewport.list"); rs = XawListShowCurrent(listwidg); index = rs->list_index; if (index < 0) return; + if(direction != 0) { + index += direction; + if(direction == -2) index = 0; + if(direction == 2) index = listLength-1; + if(index < 0 || index >= listLength) return; + XawListHighlight(listwidg, index); + return; + } index = atoi(glc->strings[index])-1; // [HGM] filter: read true index from sequence nr of line if (cmailMsgLoaded) { CmailLoadGame(glc->fp, index + 1, glc->filename, True);