Repair in WinBoard what the XBoard PromoDialog broke
[xboard.git] / winboard / winboard.c
index fae7a9d..458aaf6 100644 (file)
@@ -3821,9 +3821,13 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
   case WM_MBUTTONUP:\r
   case WM_RBUTTONUP:\r
     ReleaseCapture();\r
+    { extern int promotionChoice; extern Board promoBoard;\r
+      if(promotionChoice == 3 && (promoBoard[y][x] == EmptySquare || x == fromX && y == fromY))\r
+         break; // [HGM] promopopup: suppression of up-click selection as long as pseudo-popup is used\r
+    }\r
     RightClick(Release, pt.x - boardRect.left, pt.y - boardRect.top, &fromX, &fromY);\r
     break;\r
\r
+\r
   case WM_MBUTTONDOWN:\r
   case WM_RBUTTONDOWN:\r
     ErrorPopDown();\r
@@ -4036,6 +4040,17 @@ PromotionPopUp()
   PromotionPopup(hwndMain);\r
 }\r
 \r
+void\r
+PromoDialog(int h, int w, Board board, Boolean clearBoard, char *title, int x, int y)\r
+{      // dummy routine to mimic with pseudo-popup what front-end should do:\r
+       // display a popup with h x w mini-board, and divert any mouse clicks\r
+       // on it to the back-end routines RightClick and LeftClick, just\r
+       // like the mouse event hadler of the board widget does now.\r
+       // (Note it would have to off-set x if holdings are displayed!)\r
+       DisplayMessage("Click on your piece of choice", "");\r
+       DrawPosition(TRUE, board);\r
+}\r
+\r
 /* Toggle ShowThinking */\r
 VOID\r
 ToggleShowThinking()\r