Simplify screen reader detection code to use Tts APIs.

This commit is contained in:
Nolan Darilek 2022-12-16 10:24:32 -06:00
parent 2dba6d0a55
commit d83b3689f5
2 changed files with 3 additions and 14 deletions

View File

@ -11,6 +11,3 @@ crate-type = ["staticlib", "cdylib"]
env_logger = "0.10"
gdnative = "0.11"
tts = { version = "0.25", features = ["tolk"] }
[target.'cfg(windows)'.dependencies]
tolk = { version = "0.5", optional = true }

View File

@ -127,19 +127,11 @@ impl TTS {
.done();
builder
.property("can_detect_screen_reader")
.with_getter(|_: &TTS, _| cfg!(all(windows, features = "tolk")))
.with_getter(|_: &TTS, _| cfg!(windows))
.done();
#[allow(unreachable_code)]
builder
.property("has_screen_reader")
.with_getter(|_: &TTS, _| {
#[cfg(all(windows, features = "tolk"))]
{
let tolk = tolk::Tolk::new();
return tolk.detect_screen_reader().is_some();
}
false
})
.with_getter(|_, _| Tts::screen_reader_available())
.done();
builder
.property("can_detect_is_speaking")