From: Byrial Jensen Date: Tue, 13 Dec 2011 03:06:26 +0000 (-0800) Subject: fix for repeating key issue, with this allissues this bug should be closed; fixes... X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=b9fc0b7de303a80d0be96e1ee40917d949370726;p=xboard.git fix for repeating key issue, with this allissues this bug should be closed; fixes #35000 --- diff --git a/xboard.c b/xboard.c index e2a48f7..527c3b3 100644 --- a/xboard.c +++ b/xboard.c @@ -387,6 +387,9 @@ void StopExaminingProc P((Widget w, XEvent *event, String *prms, void UploadProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void BackwardProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void ForwardProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); +void TempBackwardProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); +void TempForwardProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); +Boolean TempBackwardActive = False; void ToStartProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void ToEndProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void RevertProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); @@ -980,6 +983,8 @@ XtActionsRec boardActions[] = { { "UploadProc", UploadProc }, { "BackwardProc", BackwardProc }, { "ForwardProc", ForwardProc }, + { "TempBackwardProc", TempBackwardProc }, + { "TempForwardProc", TempForwardProc }, { "ToStartProc", ToStartProc }, { "ToEndProc", ToEndProc }, { "RevertProc", RevertProc }, @@ -1108,8 +1113,8 @@ char globalTranslations[] = "\ :F1: ManProc() \n \ :F2: FlipViewProc() \n \ - :Ctrl.: BackwardProc() \n \ - :Ctrl.: ForwardProc() \n \ + :Ctrl.: TempBackwardProc() \n \ + :Ctrl.: TempForwardProc() \n \ :Ctrl1: AskQuestionProc(\"Direct command\",\ \"Send to chess program:\",,1) \n \ :Ctrl2: AskQuestionProc(\"Direct command\",\ @@ -6241,6 +6246,37 @@ void BackwardProc(w, event, prms, nprms) BackwardEvent(); } +void TempBackwardProc(w, event, prms, nprms) + Widget w; + XEvent *event; + String *prms; + Cardinal *nprms; +{ + if (!TempBackwardActive) { + TempBackwardActive = True; + BackwardEvent(); + } +} + +void TempForwardProc(w, event, prms, nprms) + Widget w; + XEvent *event; + String *prms; + Cardinal *nprms; +{ + /* Check to see if triggered by a key release event for a repeating key. + * If so the next queued event will be a key press of the same key at the same time */ + if (XEventsQueued(xDisplay, QueuedAfterReading)) { + XEvent next; + XPeekEvent(xDisplay, &next); + if (next.type == KeyPress && next.xkey.time == event->xkey.time && + next.xkey.keycode == event->xkey.keycode) + return; + } + ForwardEvent(); + TempBackwardActive = False; +} + void ToStartProc(w, event, prms, nprms) Widget w; XEvent *event;