Skip to content

Commit

Permalink
Use lazy (just-in-time) detection after loading Tolk or changing SAPI…
Browse files Browse the repository at this point in the history
… settings.
  • Loading branch information
dkager committed Jan 8, 2016
1 parent f4ba181 commit e63dd95
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/Tolk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ TOLK_DLL_DECLSPEC void TOLK_CALL Tolk_Load() {
if (g_trySAPI)
g_sapi = new ScreenReaderDriverSAPI();
g_isLoaded = true;
Tolk_DetectScreenReader();
}

TOLK_DLL_DECLSPEC bool TOLK_CALL Tolk_IsLoaded() {
Expand Down Expand Up @@ -73,17 +72,14 @@ TOLK_DLL_DECLSPEC void TOLK_CALL Tolk_TrySAPI(bool trySAPI) {
g_sapi = NULL;
}
g_currentScreenReaderDriver = NULL;
Tolk_DetectScreenReader();
}
}

TOLK_DLL_DECLSPEC void TOLK_CALL Tolk_PreferSAPI(bool preferSAPI) {
if (g_preferSAPI == preferSAPI) return;
g_preferSAPI = preferSAPI;
if (Tolk_IsLoaded() && g_trySAPI && g_sapi) {
if (Tolk_IsLoaded() && g_trySAPI && g_sapi)
g_currentScreenReaderDriver = NULL;
Tolk_DetectScreenReader();
}
}

TOLK_DLL_DECLSPEC const wchar_t * TOLK_CALL Tolk_DetectScreenReader() {
Expand Down

0 comments on commit e63dd95

Please sign in to comment.