diff --git a/Cargo.toml b/Cargo.toml index 9081f70fe..f86da44d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,9 +67,9 @@ unicode-segmentation = "1.7.1" windows-sys = "0.61" # Linux dependencies. -ahash = { version = "0.8.7", features = ["no-rng"] } bytemuck = { version = "1.13.1", default-features = false } calloop = "0.14.3" +foldhash = { version = "0.2.0", default-features = false, features = ["std"] } libc = "0.2.64" memmap2 = "0.9.0" percent-encoding = "2.0" diff --git a/deny.toml b/deny.toml index 7347f9736..87fb19610 100644 --- a/deny.toml +++ b/deny.toml @@ -32,6 +32,7 @@ allow = [ "ISC", # https://tldrlegal.com/license/isc-license "MIT", # https://tldrlegal.com/license/mit-license "Unicode-3.0", # https://spdx.org/licenses/Unicode-3.0.html + "Zlib", # https://spdx.org/licenses/Zlib.html ] confidence-threshold = 1.0 private = { ignore = true } diff --git a/winit-wayland/Cargo.toml b/winit-wayland/Cargo.toml index 39ec4fdcc..27a597233 100644 --- a/winit-wayland/Cargo.toml +++ b/winit-wayland/Cargo.toml @@ -29,8 +29,8 @@ tracing.workspace = true winit-core.workspace = true # Platform-specific -ahash.workspace = true calloop.workspace = true +foldhash.workspace = true libc.workspace = true memmap2.workspace = true rustix = { workspace = true, features = ["std", "system", "thread", "process", "event", "pipe"] } diff --git a/winit-wayland/src/lib.rs b/winit-wayland/src/lib.rs index b34dedadd..930562b38 100644 --- a/winit-wayland/src/lib.rs +++ b/winit-wayland/src/lib.rs @@ -14,6 +14,9 @@ //! * `wayland-csd-adwaita-crossfont`. //! * `wayland-csd-adwaita-notitle`. //! * `wayland-csd-adwaita-notitlebar`. + +#![allow(clippy::mutable_key_type)] + use std::ffi::c_void; use std::ptr::NonNull; diff --git a/winit-wayland/src/seat/mod.rs b/winit-wayland/src/seat/mod.rs index 77637d0a0..ddf0e061d 100644 --- a/winit-wayland/src/seat/mod.rs +++ b/winit-wayland/src/seat/mod.rs @@ -2,7 +2,7 @@ use std::sync::Arc; -use ahash::AHashMap; +use foldhash::HashMap; use sctk::reexports::client::backend::ObjectId; use sctk::reexports::client::protocol::wl_seat::WlSeat; use sctk::reexports::client::protocol::wl_touch::WlTouch; @@ -43,7 +43,7 @@ pub struct WinitSeatState { touch: Option, /// The mapping from touched points to the surfaces they're present. - touch_map: AHashMap, + touch_map: HashMap, /// Id of the first touch event. first_touch_id: Option, diff --git a/winit-wayland/src/state.rs b/winit-wayland/src/state.rs index d6090599b..9f5eda403 100644 --- a/winit-wayland/src/state.rs +++ b/winit-wayland/src/state.rs @@ -2,7 +2,7 @@ use std::cell::RefCell; use std::sync::atomic::Ordering; use std::sync::{Arc, Mutex}; -use ahash::AHashMap; +use foldhash::HashMap; use sctk::compositor::{CompositorHandler, CompositorState}; use sctk::output::{OutputHandler, OutputState}; use sctk::reexports::calloop::LoopHandle; @@ -62,10 +62,10 @@ pub struct WinitState { pub xdg_shell: XdgShell, /// The currently present windows. - pub windows: RefCell>>>, + pub windows: RefCell>>>, /// The requests from the `Window` to EventLoop, such as close operations and redraw requests. - pub window_requests: RefCell>>, + pub window_requests: RefCell>>, /// The events that were generated directly from the window. pub window_events_sink: Arc>, @@ -74,10 +74,10 @@ pub struct WinitState { pub window_compositor_updates: Vec, /// Currently handled seats. - pub seats: AHashMap, + pub seats: HashMap, /// Currently present cursor surfaces. - pub pointer_surfaces: AHashMap>>, + pub pointer_surfaces: HashMap>>, /// The state of the text input on the client. pub text_input_state: Option, @@ -156,7 +156,7 @@ impl WinitState { let seat_state = SeatState::new(globals, queue_handle); - let mut seats = AHashMap::default(); + let mut seats = HashMap::default(); for seat in seat_state.seats() { seats.insert(seat.id(), WinitSeatState::new()); } diff --git a/winit-wayland/src/window/state.rs b/winit-wayland/src/window/state.rs index 86711bdd1..d340742a1 100644 --- a/winit-wayland/src/window/state.rs +++ b/winit-wayland/src/window/state.rs @@ -4,8 +4,8 @@ use std::num::NonZeroU32; use std::sync::{Arc, Mutex, Weak}; use std::time::Duration; -use ahash::HashSet; use dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Size}; +use foldhash::HashSet; use sctk::compositor::{CompositorState, Region, SurfaceData, SurfaceDataExt}; use sctk::globals::GlobalData; use sctk::reexports::client::backend::ObjectId; diff --git a/winit/src/changelog/unreleased.md b/winit/src/changelog/unreleased.md index 701adecb9..14d27a6b3 100644 --- a/winit/src/changelog/unreleased.md +++ b/winit/src/changelog/unreleased.md @@ -53,3 +53,4 @@ changelog entry. - On X11, fix `set_hittest` not working on some window managers. - On Redox, handle `EINTR` when reading from `event_socket` instead of panicking. +- On Wayland, switch from using the `ahash` hashing algorithm to `foldhash`.