From 8fba2f04319bfc92a9611cb2434a209dfa1f34f5 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 5 Feb 2010 20:36:50 +0100 Subject: [PATCH] Fix highlighting bug in XBoard The from-square was drawn before the to-square was erased, which led to a missing highlight line if they shared an edge or corner. --- xboard.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/xboard.c b/xboard.c index 581206c..715a7b3 100644 --- a/xboard.c +++ b/xboard.c @@ -3833,14 +3833,18 @@ SetHighlights(fromX, fromY, toX, toY) if (hi1X >= 0 && hi1Y >= 0) { drawHighlight(hi1X, hi1Y, lineGC); } + } // [HGM] first erase both, then draw new! + if (hi2X != toX || hi2Y != toY) { + if (hi2X >= 0 && hi2Y >= 0) { + drawHighlight(hi2X, hi2Y, lineGC); + } + } + if (hi1X != fromX || hi1Y != fromY) { if (fromX >= 0 && fromY >= 0) { drawHighlight(fromX, fromY, highlineGC); } } if (hi2X != toX || hi2Y != toY) { - if (hi2X >= 0 && hi2Y >= 0) { - drawHighlight(hi2X, hi2Y, lineGC); - } if (toX >= 0 && toY >= 0) { drawHighlight(toX, toY, highlineGC); } -- 1.7.0.4