From: H.G.Muller Date: Tue, 5 Jul 2022 19:26:54 +0000 (+0200) Subject: Add interface to NVDA screen reader in accessibility patch X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=8326d930f1d084ae8870fc04b37fdfc1b0899a75;p=xboard.git Add interface to NVDA screen reader in accessibility patch When the compiler switch NVDA is defined, the accessible version will use the NVDA screen reader when that is running. Otherwise it will still use JAWS. --- diff --git a/winboard/jaws.c b/winboard/jaws.c index 1524a80..a6c1927 100644 --- a/winboard/jaws.c +++ b/winboard/jaws.c @@ -240,16 +240,41 @@ AdaptMenu() DrawMenuBar(hwndMain); } +#ifdef NVDA + +# include "nvdaController.h" + + void + SayNVDA(char *text, BOOL interrupt) + { + static wchar_t buf[8000]; + if(interrupt) nvdaController_cancelSpeech(); + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, text, -1, buf, 8000); + nvdaController_speakText(buf); + } + + +# undef UNICODE + +#endif + BOOL InitJAWS() { // to be called at beginning of WinMain, after InitApplication and InitInstance - HINSTANCE hApi = LoadLibrary("jfwapi32.dll"); - if(!hApi) { +#ifdef NVDA + RealSayString = (PSAYSTRING) &SayNVDA; // assume NVDA + if(nvdaController_testIfRunning()) { // no NVDA; try JAWS +#else + { +#endif + HINSTANCE hApi = LoadLibrary("jfwapi32.dll"); + if(!hApi) { // no interface to JAWS either DisplayInformation("Missing jfwapi32.dll"); return (FALSE); + } + RealSayString = (PSAYSTRING)GetProcAddress(hApi, "JFWSayString"); } - RealSayString = (PSAYSTRING)GetProcAddress(hApi, "JFWSayString"); if(!RealSayString) { DisplayInformation("SayString returned a null pointer"); return (FALSE);