From f59ca295a7e69ee56afc4b1f4bac28586920d8d4 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Wed, 27 Jan 2016 16:03:04 +0100 Subject: [PATCH] Fix double-clicks for copying in Edit Position mode The time measurement between clicks on the same square in Edit Position mode was seeing presses as well as releases, so that a fast click would be mistaken for a double click on that square. Only presses should be judged this way. In addition the piece should be grabbed for dragging again on the second press, as the first release had ended the drag. --- backend.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend.c b/backend.c index d362be5..29e5297 100644 --- a/backend.c +++ b/backend.c @@ -7540,7 +7540,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) return; } } -printf("to click %d,%d\n",x,y); + /* fromX != -1 */ if (clickType == Press && gameMode != EditPosition) { ChessSquare fromP; @@ -7603,10 +7603,10 @@ printf("to click %d,%d\n",x,y); // ignore clicks on holdings if(x < BOARD_LEFT || x >= BOARD_RGHT) return; } -printf("A type=%d\n",clickType); - if(x == fromX && y == fromY && gameMode == EditPosition && SubtractTimeMarks(&lastClickTime, &prevClickTime) < 200) { + if(x == fromX && y == fromY && clickType == Press && gameMode == EditPosition && SubtractTimeMarks(&lastClickTime, &prevClickTime) < 200) { gatingPiece = boards[currentMove][fromY][fromX]; // prepare to copy rather than move + DragPieceBegin(xPix, yPix, FALSE); dragging = 1; return; } @@ -7641,7 +7641,7 @@ printf("A type=%d\n",clickType); } clearFlag = 0; -printf("B\n"); + if(gameMode != EditPosition && !appData.testLegality && !legal[y][x] && fromX >= BOARD_LEFT && fromX < BOARD_RGHT && (x != killX || y != killY) && !sweepSelecting) { if(dragging) DragPieceEnd(xPix, yPix), dragging = 0; @@ -7649,7 +7649,7 @@ printf("B\n"); DrawPosition(TRUE, NULL); return; // ignore to-click } -printf("(%d,%d)-(%d,%d) %d %d\n",fromX,fromY,toX,toY,x,y); + /* we now have a different from- and (possibly off-board) to-square */ /* Completed move */ if(!sweepSelecting) { -- 1.7.0.4