From c02fbfe9731feb19c40845e37bd4ecb9f612dec1 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 25 Jul 2022 22:17:52 +0200 Subject: [PATCH] Make it easier to disable tts This is a small step in mitigating https://github.com/emilk/egui/issues/1125 --- eframe/src/web/screen_reader.rs | 10 +++++----- egui-winit/src/screen_reader.rs | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/eframe/src/web/screen_reader.rs b/eframe/src/web/screen_reader.rs index 87ac204e..058407b7 100644 --- a/eframe/src/web/screen_reader.rs +++ b/eframe/src/web/screen_reader.rs @@ -1,9 +1,9 @@ pub struct ScreenReader { - #[cfg(feature = "screen_reader")] + #[cfg(feature = "tts")] tts: Option, } -#[cfg(not(feature = "screen_reader"))] +#[cfg(not(feature = "tts"))] #[allow(clippy::derivable_impls)] // False positive impl Default for ScreenReader { fn default() -> Self { @@ -11,7 +11,7 @@ impl Default for ScreenReader { } } -#[cfg(feature = "screen_reader")] +#[cfg(feature = "tts")] impl Default for ScreenReader { fn default() -> Self { let tts = match tts::Tts::default() { @@ -29,11 +29,11 @@ impl Default for ScreenReader { } impl ScreenReader { - #[cfg(not(feature = "screen_reader"))] + #[cfg(not(feature = "tts"))] #[allow(clippy::unused_self)] pub fn speak(&mut self, _text: &str) {} - #[cfg(feature = "screen_reader")] + #[cfg(feature = "tts")] pub fn speak(&mut self, text: &str) { if text.is_empty() { return; diff --git a/egui-winit/src/screen_reader.rs b/egui-winit/src/screen_reader.rs index 87ac204e..058407b7 100644 --- a/egui-winit/src/screen_reader.rs +++ b/egui-winit/src/screen_reader.rs @@ -1,9 +1,9 @@ pub struct ScreenReader { - #[cfg(feature = "screen_reader")] + #[cfg(feature = "tts")] tts: Option, } -#[cfg(not(feature = "screen_reader"))] +#[cfg(not(feature = "tts"))] #[allow(clippy::derivable_impls)] // False positive impl Default for ScreenReader { fn default() -> Self { @@ -11,7 +11,7 @@ impl Default for ScreenReader { } } -#[cfg(feature = "screen_reader")] +#[cfg(feature = "tts")] impl Default for ScreenReader { fn default() -> Self { let tts = match tts::Tts::default() { @@ -29,11 +29,11 @@ impl Default for ScreenReader { } impl ScreenReader { - #[cfg(not(feature = "screen_reader"))] + #[cfg(not(feature = "tts"))] #[allow(clippy::unused_self)] pub fn speak(&mut self, _text: &str) {} - #[cfg(feature = "screen_reader")] + #[cfg(feature = "tts")] pub fn speak(&mut self, text: &str) { if text.is_empty() { return;