yoda: iced_winit dead-code purge (29→0 warnings)
Some checks are pending
Audit / vulnerabilities (push) Waiting to run
Check / wasm (push) Waiting to run
Check / widget (push) Waiting to run
Document / all (push) Waiting to run
Format / all (push) Waiting to run
Lint / all (push) Waiting to run
Test / all (macOS-latest, 1.88) (push) Waiting to run
Test / all (macOS-latest, beta) (push) Waiting to run
Test / all (macOS-latest, stable) (push) Waiting to run
Test / all (ubuntu-latest, 1.88) (push) Waiting to run
Test / all (ubuntu-latest, beta) (push) Waiting to run
Test / all (ubuntu-latest, stable) (push) Waiting to run
Test / all (windows-latest, 1.88) (push) Waiting to run
Test / all (windows-latest, beta) (push) Waiting to run
Test / all (windows-latest, stable) (push) Waiting to run
Some checks are pending
Audit / vulnerabilities (push) Waiting to run
Check / wasm (push) Waiting to run
Check / widget (push) Waiting to run
Document / all (push) Waiting to run
Format / all (push) Waiting to run
Lint / all (push) Waiting to run
Test / all (macOS-latest, 1.88) (push) Waiting to run
Test / all (macOS-latest, beta) (push) Waiting to run
Test / all (macOS-latest, stable) (push) Waiting to run
Test / all (ubuntu-latest, 1.88) (push) Waiting to run
Test / all (ubuntu-latest, beta) (push) Waiting to run
Test / all (ubuntu-latest, stable) (push) Waiting to run
Test / all (windows-latest, 1.88) (push) Waiting to run
Test / all (windows-latest, beta) (push) Waiting to run
Test / all (windows-latest, stable) (push) Waiting to run
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
This commit is contained in:
parent
aa1c2593ac
commit
e424487704
13 changed files with 22 additions and 177 deletions
|
|
@ -7,7 +7,7 @@ use iced_accessibility::accesskit::{
|
|||
use iced_runtime::core;
|
||||
|
||||
pub struct WinitActivationHandler {
|
||||
pub proxy: mpsc::UnboundedSender<Control>,
|
||||
pub(crate) proxy: mpsc::UnboundedSender<Control>,
|
||||
pub title: String,
|
||||
}
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ impl ActivationHandler for WinitActivationHandler {
|
|||
|
||||
pub struct WinitActionHandler {
|
||||
pub id: core::window::Id,
|
||||
pub proxy: mpsc::UnboundedSender<Control>,
|
||||
pub(crate) proxy: mpsc::UnboundedSender<Control>,
|
||||
}
|
||||
|
||||
impl iced_accessibility::accesskit::ActionHandler for WinitActionHandler {
|
||||
|
|
@ -48,7 +48,7 @@ impl iced_accessibility::accesskit::ActionHandler for WinitActionHandler {
|
|||
}
|
||||
|
||||
pub struct WinitDeactivationHandler {
|
||||
pub proxy: mpsc::UnboundedSender<Control>,
|
||||
pub(crate) proxy: mpsc::UnboundedSender<Control>,
|
||||
}
|
||||
|
||||
impl iced_accessibility::accesskit::DeactivationHandler
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
//! [`winit`]: https://github.com/rust-windowing/winit
|
||||
//! [`iced_runtime`]: https://github.com/iced-rs/iced/tree/0.14/runtime
|
||||
use crate::core::input_method;
|
||||
use std::hash::Hash;
|
||||
use std::hash::Hasher;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::core::keyboard;
|
||||
|
|
@ -698,7 +696,7 @@ enum TouchInternal {
|
|||
///
|
||||
/// [`winit`]: https://github.com/rust-windowing/winit
|
||||
/// [`iced`]: https://github.com/iced-rs/iced/tree/0.12
|
||||
pub fn touch_event(
|
||||
fn touch_event(
|
||||
finger: FingerId,
|
||||
state: TouchInternal,
|
||||
_force: Option<Force>,
|
||||
|
|
@ -1591,7 +1589,10 @@ pub fn resize_direction(
|
|||
}
|
||||
}
|
||||
|
||||
// Fields are passed through to winit via `IconProvider: AsAny` for potential
|
||||
// downcast; they are not read directly here.
|
||||
#[derive(Debug)]
|
||||
#[allow(dead_code)]
|
||||
pub struct RawImage(Vec<u8>, Size<u32>);
|
||||
impl IconProvider for RawImage {}
|
||||
impl From<RawImage> for winit_core::icon::Icon {
|
||||
|
|
|
|||
|
|
@ -157,7 +157,8 @@ where
|
|||
|
||||
let (boot_sender, boot_receiver) = oneshot::channel();
|
||||
let (control_sender, control_receiver) = mpsc::unbounded();
|
||||
let (system_theme_sender, system_theme_receiver) = oneshot::channel();
|
||||
// Sender side currently not wired to a producer; receiver gets default.
|
||||
let (_system_theme_sender, system_theme_receiver) = oneshot::channel();
|
||||
|
||||
let instance = Box::pin(run_instance::<P>(
|
||||
program,
|
||||
|
|
@ -178,9 +179,6 @@ where
|
|||
|
||||
struct BootConfig {
|
||||
sender: oneshot::Sender<()>,
|
||||
fonts: Vec<Cow<'static, [u8]>>,
|
||||
graphics_settings: graphics::Settings,
|
||||
is_wayland: bool,
|
||||
}
|
||||
struct Runner<Message: 'static, F> {
|
||||
instance: std::pin::Pin<Box<F>>,
|
||||
|
|
@ -190,7 +188,6 @@ where
|
|||
sender: mpsc::UnboundedSender<Event<Message>>,
|
||||
receiver: mpsc::UnboundedReceiver<Control>,
|
||||
error: Option<Error>,
|
||||
system_theme: Option<oneshot::Sender<theme::Mode>>,
|
||||
control_sender: mpsc::UnboundedSender<Control>,
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
|
|
@ -207,16 +204,12 @@ where
|
|||
context,
|
||||
boot: Some(BootConfig {
|
||||
sender: boot_sender,
|
||||
fonts: settings.fonts,
|
||||
graphics_settings,
|
||||
is_wayland,
|
||||
}),
|
||||
id: settings.id,
|
||||
sender: event_sender,
|
||||
receiver: control_receiver,
|
||||
control_sender: control_sender.clone(),
|
||||
error: None,
|
||||
system_theme: Some(system_theme_sender),
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
adapters: Default::default(),
|
||||
|
|
@ -319,12 +312,7 @@ where
|
|||
event_loop: &dyn winit::event_loop::ActiveEventLoop,
|
||||
) {
|
||||
// create initial window
|
||||
let Some(BootConfig {
|
||||
sender,
|
||||
fonts: _,
|
||||
graphics_settings: _,
|
||||
is_wayland: _,
|
||||
}) = self.boot.take()
|
||||
let Some(BootConfig { sender }) = self.boot.take()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
|
@ -691,6 +679,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(hidden_glob_reexports)] // intentional: internal Event shadows winit::event::Event from `pub use winit`
|
||||
enum Event<Message: 'static> {
|
||||
WindowCreated {
|
||||
id: window::Id,
|
||||
|
|
@ -798,9 +787,6 @@ async fn run_instance<P>(
|
|||
> = None;
|
||||
let mut dnd_surface_id: Option<window::Id> = None;
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
let mut a11y_enabled = false;
|
||||
|
||||
#[cfg(all(feature = "linux-theme-detection", target_os = "linux"))]
|
||||
let mut system_theme = {
|
||||
let to_mode = |color_scheme| match color_scheme {
|
||||
|
|
@ -1393,7 +1379,6 @@ async fn run_instance<P>(
|
|||
}
|
||||
|
||||
let mut uis_stale = false;
|
||||
let mut resized = false;
|
||||
for (id, window) in window_manager.iter_mut() {
|
||||
if skip && !window.resize_enabled {
|
||||
continue;
|
||||
|
|
@ -1446,7 +1431,6 @@ async fn run_instance<P>(
|
|||
// FIXME what to do when we are stuck in a configure event/resize request loop
|
||||
// We don't have control over how winit handles this.
|
||||
window.resize_enabled = true;
|
||||
resized = true;
|
||||
needs_redraw = true;
|
||||
let s = winit::dpi::Size::Logical(
|
||||
requested_size.cast(),
|
||||
|
|
@ -1661,8 +1645,8 @@ async fn run_instance<P>(
|
|||
events.push((Some(id), conversion::a11y(action_request)));
|
||||
}
|
||||
#[cfg(feature = "a11y")]
|
||||
Event::AccessibilityEnabled(enabled) => {
|
||||
a11y_enabled = enabled;
|
||||
Event::AccessibilityEnabled(_enabled) => {
|
||||
// a11y enable signal currently unused at this layer
|
||||
}
|
||||
Event::PlatformSpecific(e) => {
|
||||
crate::platform_specific::handle_event(
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use iced_graphics::{Compositor, compositor};
|
||||
use iced_graphics::compositor;
|
||||
use iced_runtime::{
|
||||
core::{Vector, window}, user_interface,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
/// Set by the user callback given to the [`EventLoop::run`] method.
|
||||
///
|
||||
/// Indicates the desired behavior of the event loop after [`Event::RedrawEventsCleared`] is emitted.
|
||||
///
|
||||
/// Defaults to [`Poll`].
|
||||
///
|
||||
/// ## Persistency
|
||||
///
|
||||
/// Almost every change is persistent between multiple calls to the event loop closure within a
|
||||
/// given run loop. The only exception to this is [`ExitWithCode`] which, once set, cannot be unset.
|
||||
/// Changes are **not** persistent between multiple calls to `run_return` - issuing a new call will
|
||||
/// reset the control flow to [`Poll`].
|
||||
///
|
||||
/// [`ExitWithCode`]: Self::ExitWithCode
|
||||
/// [`Poll`]: Self::Poll
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum ControlFlow {
|
||||
/// When the current loop iteration finishes, immediately begin a new iteration regardless of
|
||||
/// whether or not new events are available to process.
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// - **Web:** Events are queued and usually sent when `requestAnimationFrame` fires but sometimes
|
||||
/// the events in the queue may be sent before the next `requestAnimationFrame` callback, for
|
||||
/// example when the scaling of the page has changed. This should be treated as an implementation
|
||||
/// detail which should not be relied on.
|
||||
Poll,
|
||||
/// When the current loop iteration finishes, suspend the thread until another event arrives.
|
||||
Wait,
|
||||
/// When the current loop iteration finishes, suspend the thread until either another event
|
||||
/// arrives or the given time is reached.
|
||||
///
|
||||
/// Useful for implementing efficient timers. Applications which want to render at the display's
|
||||
/// native refresh rate should instead use [`Poll`] and the VSync functionality of a graphics API
|
||||
/// to reduce odds of missed frames.
|
||||
///
|
||||
/// [`Poll`]: Self::Poll
|
||||
WaitUntil(std::time::Instant),
|
||||
/// Send a [`LoopDestroyed`] event and stop the event loop. This variant is *sticky* - once set,
|
||||
/// `control_flow` cannot be changed from `ExitWithCode`, and any future attempts to do so will
|
||||
/// result in the `control_flow` parameter being reset to `ExitWithCode`.
|
||||
///
|
||||
/// The contained number will be used as exit code. The [`Exit`] constant is a shortcut for this
|
||||
/// with exit code 0.
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// - **Android / iOS / WASM:** The supplied exit code is unused.
|
||||
/// - **Unix:** On most Unix-like platforms, only the 8 least significant bits will be used,
|
||||
/// which can cause surprises with negative exit values (`-42` would end up as `214`). See
|
||||
/// [`std::process::exit`].
|
||||
///
|
||||
/// [`LoopDestroyed`]: Event::LoopDestroyed
|
||||
/// [`Exit`]: ControlFlow::Exit
|
||||
ExitWithCode(i32),
|
||||
}
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
pub mod control_flow;
|
||||
pub mod proxy;
|
||||
pub mod state;
|
||||
|
||||
use crate::{
|
||||
|
|
@ -28,7 +26,7 @@ use cctk::{
|
|||
reexports::{
|
||||
calloop::{self, EventLoop},
|
||||
client::{
|
||||
ConnectError, Connection, Proxy, globals::registry_queue_init,
|
||||
Connection, Proxy, globals::registry_queue_init,
|
||||
},
|
||||
},
|
||||
registry::RegistryState,
|
||||
|
|
@ -64,8 +62,8 @@ pub struct SctkEventLoop {
|
|||
pub(crate) state: SctkState,
|
||||
}
|
||||
|
||||
#[allow(dead_code)] // payloads kept for Debug; not inspected programmatically
|
||||
pub enum Error {
|
||||
Connect(ConnectError),
|
||||
Calloop(calloop::Error),
|
||||
Global(GlobalError),
|
||||
NoDisplayHandle,
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
use cctk::sctk::reexports::calloop;
|
||||
use iced_futures::futures::{
|
||||
channel::mpsc,
|
||||
task::{Context, Poll},
|
||||
Sink,
|
||||
};
|
||||
use std::pin::Pin;
|
||||
|
||||
/// An event loop proxy that implements `Sink`.
|
||||
#[derive(Debug)]
|
||||
pub struct Proxy<Message: 'static> {
|
||||
raw: calloop::channel::Sender<Message>,
|
||||
}
|
||||
|
||||
impl<Message: 'static> Clone for Proxy<Message> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
raw: self.raw.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<Message: 'static> Proxy<Message> {
|
||||
/// Creates a new [`Proxy`] from an `EventLoopProxy`.
|
||||
pub fn new(raw: calloop::channel::Sender<Message>) -> Self {
|
||||
Self { raw }
|
||||
}
|
||||
/// send an event
|
||||
pub fn send_event(&self, message: Message) {
|
||||
let _ = self.raw.send(message);
|
||||
}
|
||||
}
|
||||
|
||||
impl<Message: 'static> Sink<Message> for Proxy<Message> {
|
||||
type Error = mpsc::SendError;
|
||||
|
||||
fn poll_ready(
|
||||
self: Pin<&mut Self>,
|
||||
_cx: &mut Context<'_>,
|
||||
) -> Poll<Result<(), Self::Error>> {
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
|
||||
fn start_send(
|
||||
self: Pin<&mut Self>,
|
||||
message: Message,
|
||||
) -> Result<(), Self::Error> {
|
||||
let _ = self.raw.send(message);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn poll_flush(
|
||||
self: Pin<&mut Self>,
|
||||
_cx: &mut Context<'_>,
|
||||
) -> Poll<Result<(), Self::Error>> {
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
|
||||
fn poll_close(
|
||||
self: Pin<&mut Self>,
|
||||
_cx: &mut Context<'_>,
|
||||
) -> Poll<Result<(), Self::Error>> {
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ use std::{
|
|||
};
|
||||
use wayland_backend::client::ObjectId;
|
||||
use winit::{
|
||||
dpi::{LogicalPosition, LogicalSize},
|
||||
dpi::LogicalSize,
|
||||
platform::wayland::WindowExtWayland,
|
||||
};
|
||||
|
||||
|
|
@ -229,9 +229,6 @@ impl CommonSurface {
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct Common {
|
||||
pub(crate) fractional_scale: Option<f64>,
|
||||
pub(crate) has_focus: bool,
|
||||
pub(crate) ime_pos: LogicalPosition<u32>,
|
||||
pub(crate) ime_size: LogicalSize<u32>,
|
||||
pub(crate) size: LogicalSize<u32>,
|
||||
pub(crate) requested_size: (Option<u32>, Option<u32>),
|
||||
pub(crate) wp_viewport: Option<WpViewport>,
|
||||
|
|
@ -241,9 +238,6 @@ impl Default for Common {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
fractional_scale: Default::default(),
|
||||
has_focus: Default::default(),
|
||||
ime_pos: Default::default(),
|
||||
ime_size: Default::default(),
|
||||
size: LogicalSize::new(1, 1),
|
||||
requested_size: (None, None),
|
||||
wp_viewport: None,
|
||||
|
|
@ -336,7 +330,6 @@ pub struct SctkPopupData {
|
|||
pub(crate) parent: PopupParent,
|
||||
pub(crate) toplevel: WlSurface,
|
||||
pub(crate) positioner: Arc<XdgPositioner>,
|
||||
pub(crate) grab: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -877,7 +870,6 @@ impl SctkState {
|
|||
parent: parent.clone(),
|
||||
toplevel: toplevel.clone(),
|
||||
positioner: positioner.clone(),
|
||||
grab: settings.grab,
|
||||
},
|
||||
last_configure: None,
|
||||
_pending_requests: Default::default(),
|
||||
|
|
@ -1519,7 +1511,6 @@ impl SctkState {
|
|||
SctkEvent::SubsurfaceEvent (crate::sctk_event::SubsurfaceEventVariant::Created{
|
||||
parent_id,
|
||||
parent,
|
||||
surface: subsurface,
|
||||
qh: self.queue_handle.clone(),
|
||||
common_surface,
|
||||
surface_id: subsurface_settings.id,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use cctk::sctk::reexports::client::protocol::wl_surface::WlSurface;
|
|||
use cctk::sctk::seat::keyboard::Modifiers;
|
||||
use cursor_icon::CursorIcon;
|
||||
use iced_futures::futures::channel::mpsc;
|
||||
use iced_graphics::{Compositor, compositor};
|
||||
use iced_graphics::compositor;
|
||||
use iced_runtime::core::{Vector, window};
|
||||
use raw_window_handle::{HasDisplayHandle, HasWindowHandle, RawWindowHandle};
|
||||
use sctk_event::SctkEvent;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use iced_futures::{
|
|||
},
|
||||
futures::{SinkExt, channel::mpsc},
|
||||
};
|
||||
use iced_graphics::{Compositor, compositor};
|
||||
use iced_graphics::compositor;
|
||||
use iced_runtime::{
|
||||
core::{
|
||||
Point,
|
||||
|
|
@ -282,7 +282,6 @@ pub enum SubsurfaceEventVariant {
|
|||
Created {
|
||||
parent_id: window::Id,
|
||||
parent: WlSurface,
|
||||
surface: WlSurface,
|
||||
qh: QueueHandle<SctkState>,
|
||||
common_surface: CommonSurface,
|
||||
surface_id: SurfaceId,
|
||||
|
|
@ -1503,7 +1502,6 @@ impl SctkEvent {
|
|||
common,
|
||||
z,
|
||||
parent,
|
||||
surface: _,
|
||||
qh,
|
||||
surface_id,
|
||||
display,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use crate::core::{
|
|||
widget::{self, Widget},
|
||||
};
|
||||
use std::{
|
||||
borrow::BorrowMut,
|
||||
cell::RefCell,
|
||||
collections::HashMap,
|
||||
fmt::Debug,
|
||||
|
|
@ -624,7 +623,7 @@ impl Drop for SubsurfaceState {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct SubsurfaceInstance {
|
||||
pub struct SubsurfaceInstance {
|
||||
pub(crate) wl_surface: WlSurface,
|
||||
pub(crate) wl_subsurface: WlSubsurface,
|
||||
pub(crate) wp_viewport: WpViewport,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ impl<T: 'static> Proxy<T> {
|
|||
const MAX_SIZE: usize = 100;
|
||||
|
||||
/// Creates a new [`Proxy`] from an `EventLoopProxy`.
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
raw: winit::event_loop::EventLoopProxy,
|
||||
event_sender: mpsc::UnboundedSender<Event<T>>,
|
||||
) -> (Self, impl Future<Output = ()>) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use crate::core::text;
|
|||
use crate::core::theme::{self, Base};
|
||||
use crate::core::time::Instant;
|
||||
use crate::core::{
|
||||
Color, Element, InputMethod, Padding, Point, Rectangle, Size, Text, Vector,
|
||||
Color, InputMethod, Padding, Point, Rectangle, Size, Text, Vector,
|
||||
};
|
||||
use crate::graphics::Compositor;
|
||||
use crate::program::{self, Program};
|
||||
|
|
@ -26,10 +26,6 @@ use winit::monitor::MonitorHandle;
|
|||
use std::collections::BTreeMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub(crate) type ViewFn<M, T, R> = Arc<
|
||||
Box<dyn Fn() -> Option<Element<'static, M, T, R>> + Send + Sync + 'static>,
|
||||
>;
|
||||
|
||||
pub struct WindowManager<P, C>
|
||||
where
|
||||
P: Program,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue