From c487bc03058931c96f8358728286b8db0e711806 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Wed, 3 Jul 2013 16:27:47 +0200 Subject: [PATCH] Implement hover command When the user hovers a dragged piece over a square marked as a legal capture target (by R in the highlight command), the engine is notified by a hover command indicating the square (at the moment the user enters it). Only send hover when the engine has feature highlight=1. --- backend.c | 22 ++++++++++++++++++++++ backend.h | 1 + dialogs.c | 1 + winboard/winboard.c | 2 +- xboard2.h | 2 +- 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/backend.c b/backend.c index abc4495..24ae75d 100644 --- a/backend.c +++ b/backend.c @@ -7111,6 +7111,28 @@ CanPromote (ChessSquare piece, int y) piece == WhiteLance && y == BOARD_HEIGHT-2 ); } +void +HoverEvent (int hiX, int hiY, int x, int y) +{ + static char baseMarker[BOARD_RANKS][BOARD_FILES], baseLegal[BOARD_RANKS][BOARD_FILES]; + int r, f; + if(!first.highlight) return; + if(hiX == -1 && hiY == -1 && x == fromX && y == fromY) // record markings + for(r=0; r= BOARD_WIDTH || y < 0 || y >= BOARD_HEIGHT) ) { full_repaint = TRUE; } diff --git a/xboard2.h b/xboard2.h index 98aec80..825b0f2 100644 --- a/xboard2.h +++ b/xboard2.h @@ -6,4 +6,4 @@ extern int searchTime; extern int squareSize, lineGap, defaultLineGap; extern int startedFromPositionFile; extern char *icsTextMenuString; - +extern int hi2X, hi2Y; -- 1.7.0.4