iced-yoda/winit/src/a11y.rs
Votre Nom 12c870af7a yoda: iced_winit dead-code purge (29→0 warnings)
Removed code paths inherited from past refactors that no longer have any
reader:

- ViewFn type alias (window.rs)
- a11y_enabled flag and resized flag (lib.rs) — assigned but never read
- BootConfig.fonts/graphics_settings/is_wayland — already passed to
  run_instance(...) directly; the BootConfig copies were never read
- Runner.system_theme oneshot::Sender — stored but no producer ever
  wired; receiver side already falls back to default
- event_loop/control_flow.rs — local ControlFlow enum, all callers use
  winit::event_loop::ControlFlow
- event_loop/proxy.rs — Proxy<Message> never constructed
- Error::Connect(ConnectError) variant — never constructed
- Common.has_focus / ime_pos / ime_size — never read after assignment
- SctkPopupData.grab — replicated settings.grab, never read back
- SubsurfaceEventVariant::Created.surface field — destructure does
  `surface: _` everywhere, the value is unused

Visibility tightening:
- a11y.rs WinitActivationHandler / WinitActionHandler /
  WinitDeactivationHandler: pub proxy → pub(crate) proxy
- conversion::touch_event: pub → private (no external callers)
- proxy::Proxy:🆕 pub → pub(crate)

Allow attributes (intentional, not warning-suppression):
- conversion::RawImage: #[allow(dead_code)] — fields kept for
  IconProvider downcast-via-AsAny on winit's side
- event_loop::Error: #[allow(dead_code)] — variant payloads kept for
  Debug, never inspected programmatically
- lib.rs Event<Message>: #[allow(hidden_glob_reexports)] — intentional
  shadow of winit::event::Event coming from `pub use winit`
- window.rs/lib.rs: #[allow(deprecated)] on enable_ime/disable_ime/
  process_event with TODOs for set_ime_* → request_ime_update and
  try_next → try_recv migrations

Five orphan imports also removed (Hash/Hasher, BorrowMut, 3× Compositor).

Leyoda 2026 – GPLv3
2026-05-27 07:21:20 +02:00

62 lines
1.7 KiB
Rust

use crate::Control;
use crate::futures::futures::channel::mpsc;
use iced_accessibility::accesskit::{
ActivationHandler, Node, NodeId, Role, Tree, TreeId, TreeUpdate,
};
use iced_runtime::core;
pub struct WinitActivationHandler {
pub(crate) proxy: mpsc::UnboundedSender<Control>,
pub title: String,
}
impl ActivationHandler for WinitActivationHandler {
fn request_initial_tree(
&mut self,
) -> Option<iced_accessibility::accesskit::TreeUpdate> {
let node_id = core::id::window_node_id();
let _ = self
.proxy
.unbounded_send(Control::AccessibilityEnabled(true));
let mut node = Node::new(Role::Window);
node.set_label(self.title.clone());
let root = NodeId(node_id);
Some(TreeUpdate {
tree_id: TreeId::ROOT,
nodes: vec![(root, node)],
tree: Some(Tree::new(root)),
focus: root,
})
}
}
pub struct WinitActionHandler {
pub id: core::window::Id,
pub(crate) proxy: mpsc::UnboundedSender<Control>,
}
impl iced_accessibility::accesskit::ActionHandler for WinitActionHandler {
fn do_action(
&mut self,
request: iced_accessibility::accesskit::ActionRequest,
) {
let _ = self
.proxy
.unbounded_send(Control::Accessibility(self.id, request));
}
}
pub struct WinitDeactivationHandler {
pub(crate) proxy: mpsc::UnboundedSender<Control>,
}
impl iced_accessibility::accesskit::DeactivationHandler
for WinitDeactivationHandler
{
fn deactivate_accessibility(&mut self) {
let _ = self
.proxy
.unbounded_send(Control::AccessibilityEnabled(false));
}
}