mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 21:30:03 -04:00
Remove native screen reader support (#2669)
* Remove native screen reader support Use the "accesskit" feature flag to `eframe` instead. [AccessKit](https://github.com/AccessKit/accesskit) is the future. `tts` was a mess to compile on many platforms, so I no longer want the native `tts` dependency. * Update tts to 0.25 * Update changelogs * Turn on all feature flags for package.metadata.docs.rs * remove tts from deny.toml skip-tree * Update web build scripts * Update deny.toml
This commit is contained in:
@@ -3,6 +3,7 @@ All notable changes to the `egui-winit` integration will be noted in this file.
|
||||
|
||||
|
||||
## Unreleased
|
||||
* Remove the `screen_reader` feature. Use the `accesskit` feature flag instead ([#2669](https://github.com/emilk/egui/pull/2669)).
|
||||
|
||||
|
||||
## 0.20.1 - 2022-12-11
|
||||
|
||||
@@ -14,8 +14,7 @@ keywords = ["winit", "egui", "gui", "gamedev"]
|
||||
include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
# Avoid speech-dispatcher dependencies - see https://docs.rs/crate/egui-winit/0.20.0/builds/695196
|
||||
features = ["document-features"]
|
||||
all-features = true
|
||||
|
||||
|
||||
[features]
|
||||
@@ -37,9 +36,6 @@ links = ["webbrowser"]
|
||||
## Enable profiling with the [`puffin`](https://docs.rs/puffin) crate.
|
||||
puffin = ["dep:puffin"]
|
||||
|
||||
## Experimental support for a screen reader.
|
||||
screen_reader = ["tts"]
|
||||
|
||||
## Allow serialization of [`WindowSettings`] using [`serde`](https://docs.rs/serde).
|
||||
serde = ["egui/serde", "dep:serde"]
|
||||
|
||||
@@ -67,9 +63,6 @@ accesskit_winit = { version = "0.8.1", optional = true }
|
||||
puffin = { version = "0.14", optional = true }
|
||||
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||
|
||||
# feature screen_reader
|
||||
tts = { version = "0.24", optional = true }
|
||||
|
||||
webbrowser = { version = "0.8.3", optional = true }
|
||||
|
||||
[target.'cfg(any(target_os="linux", target_os="dragonfly", target_os="freebsd", target_os="netbsd", target_os="openbsd"))'.dependencies]
|
||||
|
||||
@@ -19,7 +19,6 @@ use egui::accesskit;
|
||||
pub use winit;
|
||||
|
||||
pub mod clipboard;
|
||||
pub mod screen_reader;
|
||||
mod window_settings;
|
||||
|
||||
pub use window_settings::WindowSettings;
|
||||
@@ -75,7 +74,6 @@ pub struct State {
|
||||
current_pixels_per_point: f32,
|
||||
|
||||
clipboard: clipboard::Clipboard,
|
||||
screen_reader: screen_reader::ScreenReader,
|
||||
|
||||
/// If `true`, mouse inputs will be treated as touches.
|
||||
/// Useful for debugging touch support in egui.
|
||||
@@ -115,7 +113,6 @@ impl State {
|
||||
current_pixels_per_point: 1.0,
|
||||
|
||||
clipboard: clipboard::Clipboard::new(wayland_display),
|
||||
screen_reader: screen_reader::ScreenReader::default(),
|
||||
|
||||
simulate_touch_screen: false,
|
||||
pointer_touch_id: None,
|
||||
@@ -615,11 +612,6 @@ impl State {
|
||||
egui_ctx: &egui::Context,
|
||||
platform_output: egui::PlatformOutput,
|
||||
) {
|
||||
if egui_ctx.options(|o| o.screen_reader) {
|
||||
self.screen_reader
|
||||
.speak(&platform_output.events_description());
|
||||
}
|
||||
|
||||
let egui::PlatformOutput {
|
||||
cursor_icon,
|
||||
open_url,
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
pub struct ScreenReader {
|
||||
#[cfg(feature = "tts")]
|
||||
tts: Option<tts::Tts>,
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "tts"))]
|
||||
#[allow(clippy::derivable_impls)] // False positive
|
||||
impl Default for ScreenReader {
|
||||
fn default() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "tts")]
|
||||
impl Default for ScreenReader {
|
||||
fn default() -> Self {
|
||||
let tts = match tts::Tts::default() {
|
||||
Ok(screen_reader) => {
|
||||
tracing::debug!("Initialized screen reader.");
|
||||
Some(screen_reader)
|
||||
}
|
||||
Err(err) => {
|
||||
tracing::warn!("Failed to load screen reader: {}", err);
|
||||
None
|
||||
}
|
||||
};
|
||||
Self { tts }
|
||||
}
|
||||
}
|
||||
|
||||
impl ScreenReader {
|
||||
#[cfg(not(feature = "tts"))]
|
||||
#[allow(clippy::unused_self)]
|
||||
pub fn speak(&mut self, _text: &str) {}
|
||||
|
||||
#[cfg(feature = "tts")]
|
||||
pub fn speak(&mut self, text: &str) {
|
||||
if text.is_empty() {
|
||||
return;
|
||||
}
|
||||
if let Some(tts) = &mut self.tts {
|
||||
tracing::debug!("Speaking: {:?}", text);
|
||||
let interrupt = true;
|
||||
if let Err(err) = tts.speak(text, interrupt) {
|
||||
tracing::warn!("Failed to read: {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user