Delay reciting of requested piece type in JAWS version
authorH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 6 Jul 2022 20:05:53 +0000 (22:05 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 6 Jul 2022 20:05:53 +0000 (22:05 +0200)
When the Move Type-In dialog closes after flushing its speech output
the NVDA screen reader prefers to read the title bar of the main window,
aborting the desired output. This has now been cured by flushing the
speech as a delayed event, so it comes after the reading of the title bar.
A call to CancelSpeech furthermore aborts the reading of the title bar.

winboard/jaws.c

index 3a9ab81..59d9880 100644 (file)
@@ -844,22 +844,33 @@ SayPieces(ChessSquare p)
 }\r
 \r
 VOID\r
+DelayedSpeak()\r
+{\r
+#ifdef NVDA\r
+       nvdaController_cancelSpeech();\r
+#endif\r
+       SayString("", TRUE);\r
+}\r
+\r
+VOID\r
 SayPieceType(char id)\r
 {\r
        int f, r, nr = 0;\r
        ChessSquare piece = CharToPiece(id);\r
        if(piece == EmptySquare) {\r
                SayString("That is not a valid piece", FALSE);\r
-               return;\r
-       }\r
-       for(r=0; r<BOARD_HEIGHT; r++) for(f=BOARD_LEFT; f<BOARD_RGHT; f++) {\r
+       } else {\r
+           for(r=0; r<BOARD_HEIGHT; r++) for(f=BOARD_LEFT; f<BOARD_RGHT; f++) {\r
                if(boards[currentMove][r][f] != piece) continue;\r
                if(!nr++) SayString(PieceToName(piece, 1), FALSE), SayString("on", FALSE);\r
                else SayString("and", FALSE);\r
                SayString(SquareToChar(f), FALSE);\r
                SayString(SquareToNum(r), FALSE);\r
-       }\r
-       if(!nr) SayString("There is no", FALSE), SayString(PieceToName(piece, 1), FALSE), SayString("on the board", FALSE);\r
+           }\r
+           if(!nr) SayString("There is no", FALSE), SayString(PieceToName(piece, 1), FALSE), SayString("on the board", FALSE);\r
+        }\r
+       ScheduleDelayedEvent(DelayedSpeak, 50); // immediate flush is interrupted by reading title bar parent window\r
+//     SayString("", TRUE); // flush\r
 }\r
 \r
 VOID\r