X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xgamelist.c;h=5767b9810951b20d1e9e087291128fcd4a723a54;hb=f29ff21f23c2a22fc55e14ba48c53d704c22289d;hp=2d3ce029da675d11af076479ddf54206b4d1d1f9;hpb=744e2a204303df22753aa3b1d84a7a9ac5290213;p=xboard.git diff --git a/xgamelist.c b/xgamelist.c index 2d3ce02..5767b98 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 \ @@ -361,6 +363,7 @@ GameListPrepare(int byPos) } static char *list[1003]; +int listEnd; static void GameListReplace(int page) @@ -372,7 +375,8 @@ GameListReplace(int page) int i; if(page) *st++ = _("previous page"); else if(listLength > 1000) *st++ = ""; - for(i=0; i<1000; i++) if( !(*st++ = glc->strings[page+i]) ) break; + for(i=0; i<1000; i++) if( !(*st++ = glc->strings[page+i]) ) { st--; break; } + listEnd = st - list; if(page + 1000 <= listLength) *st++ = _("next page"); *st = NULL; @@ -570,18 +574,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; + if(direction == 2) index = listEnd-1; + if(index < 0 || index >= listEnd) 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); } }