From 2cbef99e7202b7af01c5fef277501fc5baa7b50a Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 30 Sep 2013 12:14:46 +0200 Subject: [PATCH] Fix hover event HoverEvent was relying on highlight-dragging to detect if the mouse pointer entered a new square, but on XBoard highlight dragging is sick. Now the routine remembers the previous mouse position independent of the highlights. To detect if we are in the starting square, it looks for change of the from-square, in which case it fakes (first) entry of the current square (where it saves marker state, so it can be restored after we leave the square again, in case the engine saw fit to respond to the hover command). --- backend.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backend.c b/backend.c index f449d26..0e0f80e 100644 --- a/backend.c +++ b/backend.c @@ -7169,13 +7169,17 @@ void HoverEvent (int xPix, int yPix, int x, int y) { static char baseMarker[BOARD_RANKS][BOARD_FILES], baseLegal[BOARD_RANKS][BOARD_FILES]; + static int oldX = -1, oldY = -1, oldFromX = -1, oldFromY = -1; int r, f; if(dragging == 2) DragPieceMove(xPix, yPix); // [HGM] lion: drag without button for second leg if(!first.highlight) return; - if(hiX == -1 && hiY == -1 && x == fromX && y == fromY) // record markings + if(fromX != oldFromX || fromY != oldFromY) oldX = oldY = -1; // kludge to fake entry on from-click + if(x == oldX && y == oldY) return; // only do something if we enter new square + oldFromX = fromX; oldFromY = fromY; + if(oldX == -1 && oldY == -1 && x == fromX && y == fromY) // record markings after from-change for(r=0; r