From cac54b5be889023f17ad111300e04eff140593f9 Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Thu, 4 Dec 2025 01:02:51 +0000 Subject: [PATCH 1/6] Add accesskit_adapter crate. Upgrade accesskit_winit to winit 0.31.0-beta.2 --- Cargo.lock | 689 +++++++++++--- Cargo.toml | 1 + platforms/adapter/CHANGELOG.md | 885 ++++++++++++++++++ platforms/adapter/Cargo.toml | 35 + platforms/adapter/src/lib.rs | 164 ++++ .../src/platform_impl/android.rs | 17 +- .../src/platform_impl/macos.rs | 30 +- .../src/platform_impl/mod.rs | 0 .../src/platform_impl/null.rs | 8 +- platforms/adapter/src/platform_impl/unix.rs | 43 + .../src/platform_impl/windows.rs | 21 +- platforms/winit/Cargo.toml | 18 +- platforms/winit/src/lib.rs | 267 ++---- platforms/winit/src/platform_impl/unix.rs | 77 -- 14 files changed, 1813 insertions(+), 442 deletions(-) create mode 100644 platforms/adapter/CHANGELOG.md create mode 100644 platforms/adapter/Cargo.toml create mode 100644 platforms/adapter/src/lib.rs rename platforms/{winit => adapter}/src/platform_impl/android.rs (71%) rename platforms/{winit => adapter}/src/platform_impl/macos.rs (52%) rename platforms/{winit => adapter}/src/platform_impl/mod.rs (100%) rename platforms/{winit => adapter}/src/platform_impl/null.rs (72%) create mode 100644 platforms/adapter/src/platform_impl/unix.rs rename platforms/{winit => adapter}/src/platform_impl/windows.rs (62%) delete mode 100644 platforms/winit/src/platform_impl/unix.rs diff --git a/Cargo.lock b/Cargo.lock index 60171d2fe..0d386f5db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,6 +29,20 @@ dependencies = [ "serde_json", ] +[[package]] +name = "accesskit_adapter" +version = "0.29.2" +dependencies = [ + "accesskit", + "accesskit_android", + "accesskit_macos", + "accesskit_unix", + "accesskit_windows", + "android-activity", + "raw-window-handle", + "winit-core", +] + [[package]] name = "accesskit_android" version = "0.5.0" @@ -65,9 +79,9 @@ dependencies = [ "accesskit", "accesskit_consumer", "hashbrown", - "objc2", - "objc2-app-kit", - "objc2-foundation", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", ] [[package]] @@ -101,7 +115,7 @@ dependencies = [ "static_assertions", "windows", "windows-core", - "winit", + "winit 0.30.9", ] [[package]] @@ -109,14 +123,17 @@ name = "accesskit_winit" version = "0.30.0" dependencies = [ "accesskit", + "accesskit_adapter", "accesskit_android", "accesskit_macos", "accesskit_unix", "accesskit_windows", - "raw-window-handle 0.5.2", - "raw-window-handle 0.6.2", + "android-activity", + "raw-window-handle", "softbuffer", - "winit", + "winit 0.31.0-beta.2", + "winit-android", + "winit-core", ] [[package]] @@ -165,7 +182,7 @@ dependencies = [ "ndk-context", "ndk-sys", "num_enum", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -417,7 +434,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" dependencies = [ - "objc2", + "objc2 0.5.2", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.3", ] [[package]] @@ -433,6 +459,15 @@ dependencies = [ "piper", ] +[[package]] +name = "borsh" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1da5ab77c1437701eeff7c88d968729e7766172279eab0676857b3d63af7a6f" +dependencies = [ + "cfg_aliases", +] + [[package]] name = "bumpalo" version = "3.12.0" @@ -462,7 +497,20 @@ dependencies = [ "polling", "rustix 0.38.44", "slab", - "thiserror", + "thiserror 1.0.64", +] + +[[package]] +name = "calloop" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb9f6e1368bd4621d2c86baa7e37de77a938adf5221e5dd3d6133340101b309e" +dependencies = [ + "bitflags 2.8.0", + "polling", + "rustix 1.1.2", + "slab", + "tracing", ] [[package]] @@ -471,12 +519,24 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" dependencies = [ - "calloop", + "calloop 0.13.0", "rustix 0.38.44", "wayland-backend", "wayland-client", ] +[[package]] +name = "calloop-wayland-source" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +dependencies = [ + "calloop 0.14.3", + "rustix 1.1.2", + "wayland-backend", + "wayland-client", +] + [[package]] name = "cc" version = "1.0.79" @@ -580,9 +640,9 @@ checksum = "1f791803201ab277ace03903de1594460708d2d54df6053f2d9e82f592b19e3b" [[package]] name = "cursor-icon" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" [[package]] name = "dispatch" @@ -590,6 +650,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" +[[package]] +name = "dispatch2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" +dependencies = [ + "bitflags 2.8.0", + "objc2 0.6.3", +] + [[package]] name = "dlib" version = "0.5.2" @@ -607,9 +677,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dpi" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" [[package]] name = "dyn-clone" @@ -886,7 +956,7 @@ dependencies = [ "combine", "jni-sys", "log", - "thiserror", + "thiserror 1.0.64", "walkdir", "windows-sys 0.45.0", ] @@ -916,11 +986,21 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "keyboard-types" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" +dependencies = [ + "bitflags 2.8.0", + "serde", +] + [[package]] name = "libc" -version = "0.2.169" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libloading" @@ -951,9 +1031,9 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "linux-raw-sys" -version = "0.9.3" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "lock_api" @@ -1035,9 +1115,8 @@ dependencies = [ "log", "ndk-sys", "num_enum", - "raw-window-handle 0.5.2", - "raw-window-handle 0.6.2", - "thiserror", + "raw-window-handle", + "thiserror 1.0.64", ] [[package]] @@ -1115,6 +1194,15 @@ dependencies = [ "objc2-encode", ] +[[package]] +name = "objc2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05" +dependencies = [ + "objc2-encode", +] + [[package]] name = "objc2-app-kit" version = "0.2.2" @@ -1122,15 +1210,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" dependencies = [ "bitflags 2.8.0", - "block2", + "block2 0.5.1", "libc", - "objc2", + "objc2 0.5.2", "objc2-core-data", "objc2-core-image", - "objc2-foundation", + "objc2-foundation 0.2.2", "objc2-quartz-core", ] +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.8.0", + "objc2 0.6.3", + "objc2-core-foundation", + "objc2-foundation 0.3.2", +] + [[package]] name = "objc2-cloud-kit" version = "0.2.2" @@ -1138,10 +1238,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" dependencies = [ "bitflags 2.8.0", - "block2", - "objc2", + "block2 0.5.1", + "objc2 0.5.2", "objc2-core-location", - "objc2-foundation", + "objc2-foundation 0.2.2", ] [[package]] @@ -1150,9 +1250,9 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" dependencies = [ - "block2", - "objc2", - "objc2-foundation", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", ] [[package]] @@ -1162,9 +1262,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" dependencies = [ "bitflags 2.8.0", - "block2", - "objc2", - "objc2-foundation", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.8.0", + "block2 0.6.2", + "dispatch2", + "objc2 0.6.3", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.8.0", + "libc", + "objc2-core-foundation", ] [[package]] @@ -1173,9 +1296,9 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" dependencies = [ - "block2", - "objc2", - "objc2-foundation", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", "objc2-metal", ] @@ -1185,10 +1308,21 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" dependencies = [ - "block2", - "objc2", + "block2 0.5.1", + "objc2 0.5.2", "objc2-contacts", - "objc2-foundation", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-video" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6" +dependencies = [ + "bitflags 2.8.0", + "objc2-core-foundation", + "objc2-core-graphics", ] [[package]] @@ -1204,10 +1338,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ "bitflags 2.8.0", - "block2", + "block2 0.5.1", "dispatch", "libc", - "objc2", + "objc2 0.5.2", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.8.0", + "block2 0.6.2", + "objc2 0.6.3", + "objc2-core-foundation", ] [[package]] @@ -1216,10 +1362,10 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" dependencies = [ - "block2", - "objc2", - "objc2-app-kit", - "objc2-foundation", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", ] [[package]] @@ -1229,9 +1375,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" dependencies = [ "bitflags 2.8.0", - "block2", - "objc2", - "objc2-foundation", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", ] [[package]] @@ -1241,9 +1387,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" dependencies = [ "bitflags 2.8.0", - "block2", - "objc2", - "objc2-foundation", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", "objc2-metal", ] @@ -1253,8 +1399,8 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" dependencies = [ - "objc2", - "objc2-foundation", + "objc2 0.5.2", + "objc2-foundation 0.2.2", ] [[package]] @@ -1264,13 +1410,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" dependencies = [ "bitflags 2.8.0", - "block2", - "objc2", + "block2 0.5.1", + "objc2 0.5.2", "objc2-cloud-kit", "objc2-core-data", "objc2-core-image", "objc2-core-location", - "objc2-foundation", + "objc2-foundation 0.2.2", "objc2-link-presentation", "objc2-quartz-core", "objc2-symbols", @@ -1278,15 +1424,27 @@ dependencies = [ "objc2-user-notifications", ] +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.8.0", + "objc2 0.6.3", + "objc2-core-foundation", + "objc2-foundation 0.3.2", +] + [[package]] name = "objc2-uniform-type-identifiers" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" dependencies = [ - "block2", - "objc2", - "objc2-foundation", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", ] [[package]] @@ -1296,10 +1454,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" dependencies = [ "bitflags 2.8.0", - "block2", - "objc2", + "block2 0.5.1", + "objc2 0.5.2", "objc2-core-location", - "objc2-foundation", + "objc2-foundation 0.2.2", ] [[package]] @@ -1563,12 +1721,6 @@ version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" -[[package]] -name = "raw-window-handle" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" - [[package]] name = "raw-window-handle" version = "0.6.2" @@ -1634,14 +1786,14 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.3" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e56a18552996ac8d29ecc3b190b4fdbb2d91ca4ec396de7bbffaf43f3d637e96" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ "bitflags 2.8.0", "errno", "libc", - "linux-raw-sys 0.9.3", + "linux-raw-sys 0.11.0", "windows-sys 0.59.0", ] @@ -1712,7 +1864,20 @@ dependencies = [ "ab_glyph", "log", "memmap2", - "smithay-client-toolkit", + "smithay-client-toolkit 0.19.2", + "tiny-skia", +] + +[[package]] +name = "sctk-adwaita" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd3accc0f3f4bbaf2c9e1957a030dc582028130c67660d44c0a0345a22ca69b" +dependencies = [ + "ab_glyph", + "log", + "memmap2", + "smithay-client-toolkit 0.20.0", "tiny-skia", ] @@ -1812,14 +1977,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" dependencies = [ "bitflags 2.8.0", - "calloop", - "calloop-wayland-source", + "calloop 0.13.0", + "calloop-wayland-source 0.3.0", "cursor-icon", "libc", "log", "memmap2", "rustix 0.38.44", - "thiserror", + "thiserror 1.0.64", "wayland-backend", "wayland-client", "wayland-csd-frame", @@ -1830,6 +1995,33 @@ dependencies = [ "xkeysym", ] +[[package]] +name = "smithay-client-toolkit" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" +dependencies = [ + "bitflags 2.8.0", + "calloop 0.14.3", + "calloop-wayland-source 0.4.1", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 1.1.2", + "thiserror 2.0.17", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + [[package]] name = "smol_str" version = "0.2.0" @@ -1839,6 +2031,16 @@ dependencies = [ "serde", ] +[[package]] +name = "smol_str" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3498b0a27f93ef1402f20eefacfaa1691272ac4eca1cdc8c596cb0a245d6cbf5" +dependencies = [ + "borsh", + "serde_core", +] + [[package]] name = "socket2" version = "0.5.7" @@ -1864,11 +2066,11 @@ dependencies = [ "js-sys", "log", "memmap2", - "objc2", - "objc2-app-kit", - "objc2-foundation", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", "objc2-quartz-core", - "raw-window-handle 0.6.2", + "raw-window-handle", "redox_syscall 0.5.13", "rustix 0.38.44", "tiny-xlib", @@ -1919,7 +2121,7 @@ dependencies = [ "fastrand", "getrandom 0.3.2", "once_cell", - "rustix 1.0.3", + "rustix 1.1.2", "windows-sys 0.59.0", ] @@ -1929,7 +2131,16 @@ version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.64", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", ] [[package]] @@ -1943,6 +2154,17 @@ dependencies = [ "syn", ] +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tiny-skia" version = "0.11.2" @@ -2041,6 +2263,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2205,13 +2428,13 @@ dependencies = [ [[package]] name = "wayland-backend" -version = "0.3.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7208998eaa3870dad37ec8836979581506e0c5c64c20c9e79e9d2a10d6f47bf" +checksum = "673a33c33048a5ade91a6b139580fa174e19fb0d23f396dca9fa15f2e1e49b35" dependencies = [ "cc", "downcast-rs", - "rustix 0.38.44", + "rustix 1.1.2", "scoped-tls", "smallvec", "wayland-sys", @@ -2219,12 +2442,12 @@ dependencies = [ [[package]] name = "wayland-client" -version = "0.31.8" +version = "0.31.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2120de3d33638aaef5b9f4472bff75f07c56379cf76ea320bd3a3d65ecaf73f" +checksum = "c66a47e840dc20793f2264eb4b3e4ecb4b75d91c0dd4af04b456128e0bdd449d" dependencies = [ "bitflags 2.8.0", - "rustix 0.38.44", + "rustix 1.1.2", "wayland-backend", "wayland-scanner", ] @@ -2253,9 +2476,9 @@ dependencies = [ [[package]] name = "wayland-protocols" -version = "0.32.6" +version = "0.32.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0781cf46869b37e36928f7b432273c0995aa8aed9552c556fb18754420541efc" +checksum = "efa790ed75fbfd71283bd2521a1cfdc022aabcc28bdcff00851f9e4ae88d9901" dependencies = [ "bitflags 2.8.0", "wayland-backend", @@ -2263,11 +2486,37 @@ dependencies = [ "wayland-scanner", ] +[[package]] +name = "wayland-protocols-experimental" +version = "20250721.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags 2.8.0", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfe33d551eb8bffd03ff067a8b44bb963919157841a99957151299a6307d19c" +dependencies = [ + "bitflags 2.8.0", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + [[package]] name = "wayland-protocols-plasma" -version = "0.3.6" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccaacc76703fefd6763022ac565b590fcade92202492381c95b2edfdf7d46b3" +checksum = "a07a14257c077ab3279987c4f8bb987851bf57081b93710381daea94f2c2c032" dependencies = [ "bitflags 2.8.0", "wayland-backend", @@ -2291,9 +2540,9 @@ dependencies = [ [[package]] name = "wayland-scanner" -version = "0.31.6" +version = "0.31.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "896fdafd5d28145fce7958917d69f2fd44469b1d4e861cb5961bcbeebc6d1484" +checksum = "54cb1e9dc49da91950bdfd8b848c49330536d9d1fb03d4bfec8cae50caa50ae3" dependencies = [ "proc-macro2", "quick-xml 0.37.2", @@ -2302,9 +2551,9 @@ dependencies = [ [[package]] name = "wayland-sys" -version = "0.31.6" +version = "0.31.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbcebb399c77d5aa9fa5db874806ee7b4eba4e73650948e8f93963f128896615" +checksum = "34949b42822155826b41db8e5d0c1be3a2bd296c747577a43a3e6daefc296142" dependencies = [ "dlib", "log", @@ -2679,9 +2928,9 @@ dependencies = [ "android-activity", "atomic-waker", "bitflags 2.8.0", - "block2", + "block2 0.5.1", "bytemuck", - "calloop", + "calloop 0.13.0", "cfg_aliases", "concurrent-queue", "core-foundation", @@ -2692,20 +2941,19 @@ dependencies = [ "libc", "memmap2", "ndk", - "objc2", - "objc2-app-kit", - "objc2-foundation", - "objc2-ui-kit", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", + "objc2-ui-kit 0.2.2", "orbclient", "percent-encoding", "pin-project", - "raw-window-handle 0.5.2", - "raw-window-handle 0.6.2", + "raw-window-handle", "redox_syscall 0.4.1", "rustix 0.38.44", - "sctk-adwaita", - "smithay-client-toolkit", - "smol_str", + "sctk-adwaita 0.10.1", + "smithay-client-toolkit 0.19.2", + "smol_str 0.2.0", "tracing", "unicode-segmentation", "wasm-bindgen", @@ -2722,6 +2970,231 @@ dependencies = [ "xkbcommon-dl", ] +[[package]] +name = "winit" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2879d2854d1a43e48f67322d4bd097afcb6eb8f8f775c8de0260a71aea1df1aa" +dependencies = [ + "bitflags 2.8.0", + "cfg_aliases", + "cursor-icon", + "dpi", + "libc", + "raw-window-handle", + "rustix 1.1.2", + "smol_str 0.3.4", + "tracing", + "winit-android", + "winit-appkit", + "winit-common", + "winit-core", + "winit-orbital", + "winit-uikit", + "winit-wayland", + "winit-web", + "winit-win32", + "winit-x11", +] + +[[package]] +name = "winit-android" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d9c0d2cd93efec3a9f9ad819cfaf0834782403af7c0d248c784ec0c61761df" +dependencies = [ + "android-activity", + "bitflags 2.8.0", + "dpi", + "ndk", + "raw-window-handle", + "smol_str 0.3.4", + "tracing", + "winit-core", +] + +[[package]] +name = "winit-appkit" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21310ca07851a49c348e0c2cc768e36b52ca65afda2c2354d78ed4b90074d8aa" +dependencies = [ + "bitflags 2.8.0", + "block2 0.6.2", + "dispatch2", + "dpi", + "objc2 0.6.3", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-video", + "objc2-foundation 0.3.2", + "raw-window-handle", + "smol_str 0.3.4", + "tracing", + "winit-common", + "winit-core", +] + +[[package]] +name = "winit-common" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45375fbac4cbb77260d83a30b1f9d8105880dbac99a9ae97f56656694680ff69" +dependencies = [ + "memmap2", + "objc2 0.6.3", + "objc2-core-foundation", + "smol_str 0.3.4", + "tracing", + "winit-core", + "x11-dl", + "xkbcommon-dl", +] + +[[package]] +name = "winit-core" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4f0ccd7abb43740e2c6124ac7cae7d865ecec74eec63783e8922577ac232583" +dependencies = [ + "bitflags 2.8.0", + "cursor-icon", + "dpi", + "keyboard-types", + "raw-window-handle", + "smol_str 0.3.4", + "web-time", +] + +[[package]] +name = "winit-orbital" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51ea1fb262e7209f265f12bd0cc792c399b14355675e65531e9c8a87db287d46" +dependencies = [ + "bitflags 2.8.0", + "dpi", + "orbclient", + "raw-window-handle", + "redox_syscall 0.5.13", + "smol_str 0.3.4", + "tracing", + "winit-core", +] + +[[package]] +name = "winit-uikit" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680a356e798837d8eb274d4556e83bceaf81698194e31aafc5cfb8a9f2fab643" +dependencies = [ + "bitflags 2.8.0", + "block2 0.6.2", + "dispatch2", + "dpi", + "objc2 0.6.3", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-ui-kit 0.3.2", + "raw-window-handle", + "smol_str 0.3.4", + "tracing", + "winit-common", + "winit-core", +] + +[[package]] +name = "winit-wayland" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce5afb2ba07da603f84b722c95f9f9396d2cedae3944fb6c0cda4a6f88de545" +dependencies = [ + "ahash", + "bitflags 2.8.0", + "calloop 0.14.3", + "cursor-icon", + "dpi", + "libc", + "memmap2", + "raw-window-handle", + "rustix 1.1.2", + "sctk-adwaita 0.11.0", + "smithay-client-toolkit 0.20.0", + "smol_str 0.3.4", + "tracing", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", + "winit-common", + "winit-core", +] + +[[package]] +name = "winit-web" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2490a953fb776fbbd5e295d54f1c3847f4f15b6c3929ec53c09acda6487a92" +dependencies = [ + "atomic-waker", + "bitflags 2.8.0", + "concurrent-queue", + "cursor-icon", + "dpi", + "js-sys", + "pin-project", + "raw-window-handle", + "smol_str 0.3.4", + "tracing", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "web-time", + "winit-core", +] + +[[package]] +name = "winit-win32" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "644ea78af0e858aa3b092e5d1c67c41995a98220c81813f1353b28bc8bb91eaa" +dependencies = [ + "bitflags 2.8.0", + "cursor-icon", + "dpi", + "raw-window-handle", + "smol_str 0.3.4", + "tracing", + "unicode-segmentation", + "windows-sys 0.59.0", + "winit-core", +] + +[[package]] +name = "winit-x11" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa5b600756534c7041aa93cd0d244d44b09fca1b89e202bd1cd80dd9f3636c46" +dependencies = [ + "bitflags 2.8.0", + "bytemuck", + "calloop 0.14.3", + "cursor-icon", + "dpi", + "libc", + "percent-encoding", + "raw-window-handle", + "rustix 1.1.2", + "smol_str 0.3.4", + "tracing", + "winit-common", + "winit-core", + "x11-dl", + "x11rb", + "xkbcommon-dl", +] + [[package]] name = "winnow" version = "0.7.3" diff --git a/Cargo.toml b/Cargo.toml index 52e5065d0..f5494fec3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ resolver = "2" members = [ "common", "consumer", + "platforms/adapter", "platforms/android", "platforms/atspi-common", "platforms/macos", diff --git a/platforms/adapter/CHANGELOG.md b/platforms/adapter/CHANGELOG.md new file mode 100644 index 000000000..3a981878a --- /dev/null +++ b/platforms/adapter/CHANGELOG.md @@ -0,0 +1,885 @@ +# Changelog + +* The following workspace dependencies were updated + * dependencies + * accesskit_macos bumped from 0.1.4 to 0.1.5 + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.8.0 to 0.8.1 + * accesskit_windows bumped from 0.10.0 to 0.10.1 + * accesskit_macos bumped from 0.2.0 to 0.2.1 + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.10.1 to 0.10.2 + * accesskit_macos bumped from 0.2.1 to 0.3.0 + +* The following workspace dependencies were updated + * dependencies + * accesskit_macos bumped from 0.3.0 to 0.4.0 + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.10.3 to 0.10.4 + * accesskit_macos bumped from 0.4.1 to 0.4.2 + * accesskit_unix bumped from 0.1.0 to 0.1.1 + +* The following workspace dependencies were updated + * dependencies + * accesskit_unix bumped from 0.3.0 to 0.3.1 + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.10.0 to 0.10.1 + * accesskit_windows bumped from 0.13.0 to 0.13.1 + * accesskit_macos bumped from 0.6.0 to 0.6.1 + * accesskit_unix bumped from 0.3.1 to 0.3.2 + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.13.1 to 0.13.2 + +* The following workspace dependencies were updated + * dependencies + * accesskit_macos bumped from 0.6.1 to 0.6.2 + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.10.1 to 0.11.0 + * accesskit_windows bumped from 0.13.2 to 0.13.3 + * accesskit_macos bumped from 0.6.2 to 0.6.3 + * accesskit_unix bumped from 0.3.2 to 0.3.3 + +* The following workspace dependencies were updated + * dependencies + * accesskit_macos bumped from 0.7.0 to 0.7.1 + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.11.0 to 0.11.1 + * accesskit_windows bumped from 0.14.0 to 0.14.1 + * accesskit_macos bumped from 0.7.1 to 0.8.0 + * accesskit_unix bumped from 0.5.0 to 0.5.1 + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.11.1 to 0.11.2 + * accesskit_windows bumped from 0.14.1 to 0.14.2 + * accesskit_macos bumped from 0.8.0 to 0.9.0 + * accesskit_unix bumped from 0.5.1 to 0.5.2 + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.14.2 to 0.14.3 + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.16.0 to 0.16.1 + * accesskit_unix bumped from 0.7.1 to 0.7.2 + +* The following workspace dependencies were updated + * dependencies + * accesskit_unix bumped from 0.7.2 to 0.7.3 + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.16.1 to 0.16.2 + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.12.2 to 0.12.3 + * accesskit_windows bumped from 0.16.2 to 0.16.3 + * accesskit_macos bumped from 0.11.0 to 0.11.1 + * accesskit_unix bumped from 0.7.3 to 0.7.4 + +* The following workspace dependencies were updated + * dependencies + * accesskit_unix bumped from 0.7.4 to 0.7.5 + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.16.3 to 0.16.4 + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.18.0 to 0.18.1 + * accesskit_macos bumped from 0.13.0 to 0.13.1 + * accesskit_unix bumped from 0.9.0 to 0.9.1 + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.18.1 to 0.18.2 + * accesskit_macos bumped from 0.13.1 to 0.13.2 + * accesskit_unix bumped from 0.9.1 to 0.9.2 + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.18.2 to 0.19.0 + * accesskit_macos bumped from 0.13.2 to 0.14.0 + * accesskit_unix bumped from 0.9.2 to 0.10.0 + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.19.0 to 0.20.0 + * accesskit_macos bumped from 0.14.0 to 0.15.0 + * accesskit_unix bumped from 0.10.0 to 0.10.1 + +* The following workspace dependencies were updated + * dependencies + * accesskit_unix bumped from 0.11.0 to 0.11.1 + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.16.2 to 0.16.3 + * accesskit_windows bumped from 0.23.1 to 0.23.2 + * accesskit_macos bumped from 0.17.2 to 0.17.3 + * accesskit_unix bumped from 0.12.2 to 0.12.3 + +* The following workspace dependencies were updated + * dependencies + * accesskit_macos bumped from 0.17.3 to 0.17.4 + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.17.0 to 0.17.1 + * accesskit_windows bumped from 0.24.0 to 0.24.1 + * accesskit_macos bumped from 0.18.0 to 0.18.1 + * accesskit_unix bumped from 0.13.0 to 0.13.1 + +## [0.29.2](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.29.1...accesskit_winit-v0.29.2) (2025-10-20) + + +### Bug Fixes + +* Fix winit examples window not showing up under Wayland ([#625](https://github.com/AccessKit/accesskit/issues/625)) ([87ce769](https://github.com/AccessKit/accesskit/commit/87ce769282b00684f2b2ab6a3410ed6edb894f22)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.29.1 to 0.29.2 + * accesskit_macos bumped from 0.22.1 to 0.22.2 + * accesskit_unix bumped from 0.17.1 to 0.17.2 + * accesskit_android bumped from 0.4.1 to 0.4.2 + +## [0.29.1](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.29.0...accesskit_winit-v0.29.1) (2025-10-02) + + +### Bug Fixes + +* Impl `Clone` and `PartialEq` on `WindowEvent` ([#618](https://github.com/AccessKit/accesskit/issues/618)) ([3a4771b](https://github.com/AccessKit/accesskit/commit/3a4771b87455cc005c18152935535818a3f9f825)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.21.0 to 0.21.1 + * accesskit_windows bumped from 0.29.0 to 0.29.1 + * accesskit_macos bumped from 0.22.0 to 0.22.1 + * accesskit_unix bumped from 0.17.0 to 0.17.1 + * accesskit_android bumped from 0.4.0 to 0.4.1 + +## [0.29.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.28.0...accesskit_winit-v0.29.0) (2025-07-16) + + +### Features + +* Let parents declare actions supported on their children ([#593](https://github.com/AccessKit/accesskit/issues/593)) ([70b534b](https://github.com/AccessKit/accesskit/commit/70b534bed168a84b84cc35199588aa8ab784fb43)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.20.0 to 0.21.0 + * accesskit_windows bumped from 0.28.0 to 0.29.0 + * accesskit_macos bumped from 0.21.0 to 0.22.0 + * accesskit_unix bumped from 0.16.0 to 0.17.0 + * accesskit_android bumped from 0.3.0 to 0.4.0 + +## [0.28.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.27.0...accesskit_winit-v0.28.0) (2025-06-26) + + +### ⚠ BREAKING CHANGES + +* Force a semver-breaking release ([#589](https://github.com/AccessKit/accesskit/issues/589)) + +### Bug Fixes + +* Force a semver-breaking release ([#589](https://github.com/AccessKit/accesskit/issues/589)) ([2887cdd](https://github.com/AccessKit/accesskit/commit/2887cddde817ba3851688068d8d10de5cef7c624)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.19.0 to 0.20.0 + * accesskit_windows bumped from 0.27.0 to 0.28.0 + * accesskit_macos bumped from 0.20.0 to 0.21.0 + * accesskit_unix bumped from 0.15.0 to 0.16.0 + * accesskit_android bumped from 0.2.0 to 0.3.0 + +## [0.27.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.26.0...accesskit_winit-v0.27.0) (2025-05-06) + + +### ⚠ BREAKING CHANGES + +* Simplify the core Android adapter API ([#558](https://github.com/AccessKit/accesskit/issues/558)) +* Drop redundant `HasPopup::True` ([#550](https://github.com/AccessKit/accesskit/issues/550)) + +### Code Refactoring + +* Drop redundant `HasPopup::True` ([#550](https://github.com/AccessKit/accesskit/issues/550)) ([56abf17](https://github.com/AccessKit/accesskit/commit/56abf17356e4c7f13f64aaeaca6a63c8f7ede553)) +* Simplify the core Android adapter API ([#558](https://github.com/AccessKit/accesskit/issues/558)) ([7ac5911](https://github.com/AccessKit/accesskit/commit/7ac5911b11f3d6b8b777b91e6476e7073f6b0e4a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.18.0 to 0.19.0 + * accesskit_windows bumped from 0.26.0 to 0.27.0 + * accesskit_macos bumped from 0.19.0 to 0.20.0 + * accesskit_unix bumped from 0.14.0 to 0.15.0 + * accesskit_android bumped from 0.1.1 to 0.2.0 + +## [0.26.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.25.0...accesskit_winit-v0.26.0) (2025-03-17) + + +### ⚠ BREAKING CHANGES + +* Panic if the window is visible when the adapter is created, for adapters where this is a problem ([#529](https://github.com/AccessKit/accesskit/issues/529)) + +### Bug Fixes + +* Panic if the window is visible when the adapter is created, for adapters where this is a problem ([#529](https://github.com/AccessKit/accesskit/issues/529)) ([c43c37b](https://github.com/AccessKit/accesskit/commit/c43c37ba2502656fcae4fd726b9b7db0bb520f31)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.25.0 to 0.26.0 + * accesskit_android bumped from 0.1.0 to 0.1.1 + +## [0.25.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.24.0...accesskit_winit-v0.25.0) (2025-03-08) + + +### ⚠ BREAKING CHANGES + +* Make accesskit_android an optional dependency of accesskit_winit ([#524](https://github.com/AccessKit/accesskit/issues/524)) + +### Bug Fixes + +* Make accesskit_android an optional dependency of accesskit_winit ([#524](https://github.com/AccessKit/accesskit/issues/524)) ([bb17d44](https://github.com/AccessKit/accesskit/commit/bb17d449b601eaffad1c7201ec5bf8de241bb8f8)) + +## [0.24.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.23.1...accesskit_winit-v0.24.0) (2025-03-06) + + +### ⚠ BREAKING CHANGES + +* Add event loop parameter to winit adapter constructors ([#517](https://github.com/AccessKit/accesskit/issues/517)) +* Drop `Tree::app_name` ([#492](https://github.com/AccessKit/accesskit/issues/492)) + +### Features + +* Android adapter ([#500](https://github.com/AccessKit/accesskit/issues/500)) ([7e65ac7](https://github.com/AccessKit/accesskit/commit/7e65ac77d7e108ac5b9f3722f488a2fdf2e3b3e0)) + + +### Bug Fixes + +* Update winit to 0.30.9 ([#511](https://github.com/AccessKit/accesskit/issues/511)) ([0be21e6](https://github.com/AccessKit/accesskit/commit/0be21e6a2979af483b573b1c9b07c677286b871d)) + + +### Code Refactoring + +* Add event loop parameter to winit adapter constructors ([#517](https://github.com/AccessKit/accesskit/issues/517)) ([0d15f24](https://github.com/AccessKit/accesskit/commit/0d15f246a301a68af4424f7602c2f3be25da9327)) +* Drop `Tree::app_name` ([#492](https://github.com/AccessKit/accesskit/issues/492)) ([089794c](https://github.com/AccessKit/accesskit/commit/089794c8f74957e91a19ae3df508e2a892f39ebc)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.17.1 to 0.18.0 + * accesskit_windows bumped from 0.24.1 to 0.25.0 + * accesskit_macos bumped from 0.18.1 to 0.19.0 + * accesskit_unix bumped from 0.13.1 to 0.14.0 + +## [0.23.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.22.4...accesskit_winit-v0.23.0) (2024-10-31) + + +### ⚠ BREAKING CHANGES + +* Rename `name` to `label` and use `value` for label content ([#475](https://github.com/AccessKit/accesskit/issues/475)) +* Rename `NodeBuilder` to `Node` and the old `Node` to `FrozenNode` ([#476](https://github.com/AccessKit/accesskit/issues/476)) +* Drop `DefaultActionVerb` ([#472](https://github.com/AccessKit/accesskit/issues/472)) +* Make the core crate no-std ([#468](https://github.com/AccessKit/accesskit/issues/468)) + +### Features + +* Make the core crate no-std ([#468](https://github.com/AccessKit/accesskit/issues/468)) ([2fa0d3f](https://github.com/AccessKit/accesskit/commit/2fa0d3f5b2b7ac11ef1751c133706f29e548bd6d)) + + +### Code Refactoring + +* Drop `DefaultActionVerb` ([#472](https://github.com/AccessKit/accesskit/issues/472)) ([ef3b003](https://github.com/AccessKit/accesskit/commit/ef3b0038224459094f650368412650bc3b69526b)) +* Rename `name` to `label` and use `value` for label content ([#475](https://github.com/AccessKit/accesskit/issues/475)) ([e0053a5](https://github.com/AccessKit/accesskit/commit/e0053a5399929e8e0d4f07aa18de604ed8766ace)) +* Rename `NodeBuilder` to `Node` and the old `Node` to `FrozenNode` ([#476](https://github.com/AccessKit/accesskit/issues/476)) ([7d8910e](https://github.com/AccessKit/accesskit/commit/7d8910e35f7bc0543724cc124941a3bd0304bcc0)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.16.3 to 0.17.0 + * accesskit_windows bumped from 0.23.2 to 0.24.0 + * accesskit_macos bumped from 0.17.4 to 0.18.0 + * accesskit_unix bumped from 0.12.3 to 0.13.0 + +## [0.22.2](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.22.1...accesskit_winit-v0.22.2) (2024-10-07) + + +### Bug Fixes + +* Update minimum supported Rust version to 1.75 ([#457](https://github.com/AccessKit/accesskit/issues/457)) ([fc622fe](https://github.com/AccessKit/accesskit/commit/fc622fe7657c80a4eedad6f6cded11d2538b54d5)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.16.1 to 0.16.2 + * accesskit_windows bumped from 0.23.0 to 0.23.1 + * accesskit_macos bumped from 0.17.1 to 0.17.2 + * accesskit_unix bumped from 0.12.1 to 0.12.2 + +## [0.22.1](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.22.0...accesskit_winit-v0.22.1) (2024-09-24) + + +### Bug Fixes + +* Use the new HWND type on accesskit_winit ([#453](https://github.com/AccessKit/accesskit/issues/453)) ([68a2462](https://github.com/AccessKit/accesskit/commit/68a24629381f0b18f6ed1ee008fe72ce9330092e)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.16.0 to 0.16.1 + * accesskit_windows bumped from 0.22.0 to 0.23.0 + * accesskit_macos bumped from 0.17.0 to 0.17.1 + * accesskit_unix bumped from 0.12.0 to 0.12.1 + +## [0.22.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.21.1...accesskit_winit-v0.22.0) (2024-06-29) + + +### ⚠ BREAKING CHANGES + +* Rename the `StaticText` role to `Label` ([#434](https://github.com/AccessKit/accesskit/issues/434)) + +### Code Refactoring + +* Rename the `StaticText` role to `Label` ([#434](https://github.com/AccessKit/accesskit/issues/434)) ([7086bc0](https://github.com/AccessKit/accesskit/commit/7086bc0fad446d3ed4a0fd5eff641a1e75f6c599)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.15.0 to 0.16.0 + * accesskit_windows bumped from 0.21.0 to 0.22.0 + * accesskit_macos bumped from 0.16.0 to 0.17.0 + * accesskit_unix bumped from 0.11.1 to 0.12.0 + +## [0.21.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.20.4...accesskit_winit-v0.21.0) (2024-06-09) + + +### Features + +* Add `author_id` property ([#424](https://github.com/AccessKit/accesskit/issues/424)) ([0d1c56f](https://github.com/AccessKit/accesskit/commit/0d1c56f0bdde58715e1c69f6015df600cb7cb8c1)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.14.0 to 0.15.0 + * accesskit_windows bumped from 0.20.0 to 0.21.0 + * accesskit_macos bumped from 0.15.0 to 0.16.0 + * accesskit_unix bumped from 0.10.1 to 0.11.0 + +## [0.20.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.19.0...accesskit_winit-v0.20.0) (2024-04-30) + + +### ⚠ BREAKING CHANGES + +* Update winit to 0.30 ([#397](https://github.com/AccessKit/accesskit/issues/397)) +* Drop `NodeClassSet` ([#389](https://github.com/AccessKit/accesskit/issues/389)) + +### Bug Fixes + +* Increase minimum supported Rust version to `1.70` ([#396](https://github.com/AccessKit/accesskit/issues/396)) ([a8398b8](https://github.com/AccessKit/accesskit/commit/a8398b847aa003de91042ac45e33126fc2cae053)) +* Update winit to 0.30 ([#397](https://github.com/AccessKit/accesskit/issues/397)) ([de93be3](https://github.com/AccessKit/accesskit/commit/de93be387c03a438fbf598670207e578686e6bcf)) + + +### Code Refactoring + +* Drop `NodeClassSet` ([#389](https://github.com/AccessKit/accesskit/issues/389)) ([1b153ed](https://github.com/AccessKit/accesskit/commit/1b153ed51f8421cdba2dc98beca2e8f5f8c781bc)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.13.0 to 0.14.0 + * accesskit_windows bumped from 0.17.0 to 0.18.0 + * accesskit_macos bumped from 0.12.0 to 0.13.0 + * accesskit_unix bumped from 0.8.0 to 0.9.0 + +## [0.19.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.18.7...accesskit_winit-v0.19.0) (2024-04-14) + + +### ⚠ BREAKING CHANGES + +* New approach to lazy initialization ([#375](https://github.com/AccessKit/accesskit/issues/375)) + +### Code Refactoring + +* New approach to lazy initialization ([#375](https://github.com/AccessKit/accesskit/issues/375)) ([9baebdc](https://github.com/AccessKit/accesskit/commit/9baebdceed7300389b6768815d7ae48f1ce401e4)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.12.3 to 0.13.0 + * accesskit_windows bumped from 0.16.4 to 0.17.0 + * accesskit_macos bumped from 0.11.1 to 0.12.0 + * accesskit_unix bumped from 0.7.5 to 0.8.0 + +## [0.18.1](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.18.0...accesskit_winit-v0.18.1) (2024-01-11) + + +### Bug Fixes + +* Run our own async executor on Unix ([#337](https://github.com/AccessKit/accesskit/issues/337)) ([8f937ba](https://github.com/AccessKit/accesskit/commit/8f937baaa510dd96da196501822b82f75f05b595)) +* Show an error at compile-time if no raw-window-handle feature is enabled for the winit adapter ([#339](https://github.com/AccessKit/accesskit/issues/339)) ([a24f5fd](https://github.com/AccessKit/accesskit/commit/a24f5fd443a683a6194b54244052ff3e1cc05de6)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit_unix bumped from 0.7.0 to 0.7.1 + +## [0.18.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.17.0...accesskit_winit-v0.18.0) (2024-01-03) + + +### ⚠ BREAKING CHANGES + +* Lazily activate Unix adapters ([#324](https://github.com/AccessKit/accesskit/issues/324)) +* Remove `accesskit_winit::Adapter::update` ([#325](https://github.com/AccessKit/accesskit/issues/325)) + +### Bug Fixes + +* Lazily activate Unix adapters ([#324](https://github.com/AccessKit/accesskit/issues/324)) ([54ed036](https://github.com/AccessKit/accesskit/commit/54ed036c99d87428a8eb5bb03fd77e9e31562d4c)) +* Remove `accesskit_winit::Adapter::update` ([#325](https://github.com/AccessKit/accesskit/issues/325)) ([f121bff](https://github.com/AccessKit/accesskit/commit/f121bffe9e651fd2ac6deb882f57e1c9b613b7eb)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.12.1 to 0.12.2 + * accesskit_windows bumped from 0.15.1 to 0.16.0 + * accesskit_macos bumped from 0.10.1 to 0.11.0 + * accesskit_unix bumped from 0.6.2 to 0.7.0 + +## [0.17.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.16.1...accesskit_winit-v0.17.0) (2023-12-14) + + +### ⚠ BREAKING CHANGES + +* Force a semver break for the winit rwh feature additions ([#322](https://github.com/AccessKit/accesskit/issues/322)) + +### Bug Fixes + +* Add a `rwh_05` feature flag to `accesskit_winit` ([#319](https://github.com/AccessKit/accesskit/issues/319)) ([f4d279c](https://github.com/AccessKit/accesskit/commit/f4d279c5ece16df2925c0e31dc82eaf192c40cd0)) +* Force a semver break for the winit rwh feature additions ([#322](https://github.com/AccessKit/accesskit/issues/322)) ([61acdb0](https://github.com/AccessKit/accesskit/commit/61acdb0ea083263c88a00ad4db637b25863852c0)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit_unix bumped from 0.6.1 to 0.6.2 + +## [0.16.1](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.16.0...accesskit_winit-v0.16.1) (2023-11-05) + + +### Bug Fixes + +* Account for window decorations when `accesskit_winit::Adapter::process_event` receives a resizing event on Unix ([#312](https://github.com/AccessKit/accesskit/issues/312)) ([e2b264c](https://github.com/AccessKit/accesskit/commit/e2b264c2e5b0fb699576f2ece905509c38ffc9be)) + +## [0.16.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.15.0...accesskit_winit-v0.16.0) (2023-11-04) + + +### ⚠ BREAKING CHANGES + +* Rename `accesskit_winit::Adapter::on_event` to `process_event` ([#307](https://github.com/AccessKit/accesskit/issues/307)) +* Bump winit to 0.29 ([#256](https://github.com/AccessKit/accesskit/issues/256)) + +### deps + +* Bump winit to 0.29 ([#256](https://github.com/AccessKit/accesskit/issues/256)) ([4eb21ff](https://github.com/AccessKit/accesskit/commit/4eb21ff64256fcf0a16ab831554b06b80de9b36e)) + + +### Bug Fixes + +* Add missing semicolons when not returning anything ([#303](https://github.com/AccessKit/accesskit/issues/303)) ([38d4de1](https://github.com/AccessKit/accesskit/commit/38d4de1442247e701047d75122a9638a2ed99b1f)) +* Use raw-window-handle 0.6 ([#310](https://github.com/AccessKit/accesskit/issues/310)) ([3fa69ab](https://github.com/AccessKit/accesskit/commit/3fa69ab4d9216b51b651d3cf2a9c8217a77069f4)) + + +### Code Refactoring + +* Rename `accesskit_winit::Adapter::on_event` to `process_event` ([#307](https://github.com/AccessKit/accesskit/issues/307)) ([6fbebde](https://github.com/AccessKit/accesskit/commit/6fbebdeb9d1e96b1776ed1faf7ad21d9cc0a68df)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.12.0 to 0.12.1 + * accesskit_windows bumped from 0.15.0 to 0.15.1 + * accesskit_macos bumped from 0.10.0 to 0.10.1 + * accesskit_unix bumped from 0.6.0 to 0.6.1 + +## [0.15.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.14.4...accesskit_winit-v0.15.0) (2023-09-27) + + +### ⚠ BREAKING CHANGES + +* Allow providing app_name, toolkit_name and toolkit_version in Tree, remove parameters from unix adapter constructor ([#291](https://github.com/AccessKit/accesskit/issues/291)) +* Make `ActionHandler::do_action` take `&mut self` ([#296](https://github.com/AccessKit/accesskit/issues/296)) +* Decouple in-tree focus from host window/view focus ([#278](https://github.com/AccessKit/accesskit/issues/278)) +* Switch to simple unsigned 64-bit integer for node IDs ([#276](https://github.com/AccessKit/accesskit/issues/276)) + +### Features + +* Allow providing app_name, toolkit_name and toolkit_version in Tree, remove parameters from unix adapter constructor ([#291](https://github.com/AccessKit/accesskit/issues/291)) ([5313860](https://github.com/AccessKit/accesskit/commit/531386023257150f49b5e4be942f359855fb7cb6)) + + +### Bug Fixes + +* Fix doc build for accesskit_winit ([#281](https://github.com/AccessKit/accesskit/issues/281)) ([e3b38b8](https://github.com/AccessKit/accesskit/commit/e3b38b8164d0c5442a5a1904165e2b05847376c2)) + + +### Code Refactoring + +* Decouple in-tree focus from host window/view focus ([#278](https://github.com/AccessKit/accesskit/issues/278)) ([d360d20](https://github.com/AccessKit/accesskit/commit/d360d20cf951e7643b81a5303006c9f7daa5bd56)) +* Make `ActionHandler::do_action` take `&mut self` ([#296](https://github.com/AccessKit/accesskit/issues/296)) ([4fc7846](https://github.com/AccessKit/accesskit/commit/4fc7846d732d61fb45c023060ebab96801a0053e)) +* Switch to simple unsigned 64-bit integer for node IDs ([#276](https://github.com/AccessKit/accesskit/issues/276)) ([3eadd48](https://github.com/AccessKit/accesskit/commit/3eadd48ec47854faa94a94ebf910ec08f514642f)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.11.2 to 0.12.0 + * accesskit_windows bumped from 0.14.3 to 0.15.0 + * accesskit_macos bumped from 0.9.0 to 0.10.0 + * accesskit_unix bumped from 0.5.2 to 0.6.0 + +## [0.14.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.13.0...accesskit_winit-v0.14.0) (2023-05-21) + + +### Features + +* Add features for async runtimes on Unix ([#248](https://github.com/AccessKit/accesskit/issues/248)) ([b56b4ea](https://github.com/AccessKit/accesskit/commit/b56b4ea7c967ee5a1dae21a2fa0dcd385346031e)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit_unix bumped from 0.4.0 to 0.5.0 + +## [0.13.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.12.5...accesskit_winit-v0.13.0) (2023-03-30) + + +### ⚠ BREAKING CHANGES + +* Force a semver-breaking version bump in downstream crates ([#234](https://github.com/AccessKit/accesskit/issues/234)) + +### Bug Fixes + +* Force a semver-breaking version bump in downstream crates ([#234](https://github.com/AccessKit/accesskit/issues/234)) ([773389b](https://github.com/AccessKit/accesskit/commit/773389bff857fa18edf15de426e029251fc34591)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.13.3 to 0.14.0 + * accesskit_macos bumped from 0.6.3 to 0.7.0 + * accesskit_unix bumped from 0.3.3 to 0.4.0 + +## [0.12.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.11.0...accesskit_winit-v0.12.0) (2023-02-18) + + +### Features + +* Feature-gate the Unix adapter in accesskit_winit ([#214](https://github.com/AccessKit/accesskit/issues/214)) ([be95807](https://github.com/AccessKit/accesskit/commit/be95807dda64f2a49b4d20cc9084b14a7aa2844e)) + +## [0.11.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.10.0...accesskit_winit-v0.11.0) (2023-02-12) + + +### ⚠ BREAKING CHANGES + +* Move thread synchronization into platform adapters; drop parking_lot ([#212](https://github.com/AccessKit/accesskit/issues/212)) + +### Code Refactoring + +* Move thread synchronization into platform adapters; drop parking_lot ([#212](https://github.com/AccessKit/accesskit/issues/212)) ([5df52e5](https://github.com/AccessKit/accesskit/commit/5df52e5545faddf6a51905409013c2f5be23981e)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.9.0 to 0.10.0 + * accesskit_windows bumped from 0.12.0 to 0.13.0 + * accesskit_macos bumped from 0.5.0 to 0.6.0 + * accesskit_unix bumped from 0.2.0 to 0.3.0 + +## [0.10.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.9.1...accesskit_winit-v0.10.0) (2023-02-05) + + +### ⚠ BREAKING CHANGES + +* Make `Node` opaque and optimize it for size ([#205](https://github.com/AccessKit/accesskit/issues/205)) + +### Code Refactoring + +* Make `Node` opaque and optimize it for size ([#205](https://github.com/AccessKit/accesskit/issues/205)) ([4811152](https://github.com/AccessKit/accesskit/commit/48111521439b76c1a8687418a4b20f9b705eac6d)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.8.1 to 0.9.0 + * accesskit_windows bumped from 0.11.0 to 0.12.0 + * accesskit_macos bumped from 0.4.2 to 0.5.0 + * accesskit_unix bumped from 0.1.1 to 0.2.0 + +## [0.9.1](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.9.0...accesskit_winit-v0.9.1) (2023-02-05) + + +### Bug Fixes + +* Don't force winit's X11 and Wayland features to be enabled ([#209](https://github.com/AccessKit/accesskit/issues/209)) ([a3ed357](https://github.com/AccessKit/accesskit/commit/a3ed35754ad8f69a8ed54adacc30b6d57c19329a)) + +## [0.9.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.8.1...accesskit_winit-v0.9.0) (2023-02-02) + + +### ⚠ BREAKING CHANGES + +* Update winit to 0.28 ([#207](https://github.com/AccessKit/accesskit/issues/207)) + +### Miscellaneous Chores + +* Update winit to 0.28 ([#207](https://github.com/AccessKit/accesskit/issues/207)) ([3ff0cf5](https://github.com/AccessKit/accesskit/commit/3ff0cf59f982af504499142a3804f7aeeb4defe0)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.10.4 to 0.11.0 + +## [0.8.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.7.3...accesskit_winit-v0.8.0) (2023-01-05) + + +### Features + +* Basic Unix platform adapter ([#198](https://github.com/AccessKit/accesskit/issues/198)) ([1cea32e](https://github.com/AccessKit/accesskit/commit/1cea32e44ee743b778ac941ceff9087ae745cb37)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.10.2 to 0.10.3 + * accesskit_macos bumped from 0.4.0 to 0.4.1 + +## [0.7.0](https://github.com/AccessKit/accesskit/compare/accesskit_winit-v0.6.6...accesskit_winit-v0.7.0) (2022-11-29) + + +### ⚠ BREAKING CHANGES + +* Move lazy initialization from the core platform adapter to the caller ([#179](https://github.com/AccessKit/accesskit/issues/179)) + +### Code Refactoring + +* Move lazy initialization from the core platform adapter to the caller ([#179](https://github.com/AccessKit/accesskit/issues/179)) ([f35c941](https://github.com/AccessKit/accesskit/commit/f35c941f395f3162db376a69cfaaaf770d376267)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit_windows bumped from 0.9.3 to 0.10.0 + * accesskit_macos bumped from 0.1.5 to 0.2.0 + +### [0.6.4](https://www.github.com/AccessKit/accesskit/compare/accesskit_winit-v0.6.3...accesskit_winit-v0.6.4) (2022-11-25) + + +### Bug Fixes + +* Reduce the winit version requirement to match egui ([#170](https://www.github.com/AccessKit/accesskit/issues/170)) ([1d27482](https://www.github.com/AccessKit/accesskit/commit/1d27482221140c1f3b3e3eaf93e7feaf8105611d)) + +## [0.6.0](https://www.github.com/AccessKit/accesskit/compare/accesskit_winit-v0.5.1...accesskit_winit-v0.6.0) (2022-11-23) + + +### Features + +* **platforms/macos:** Basic macOS platform adapter ([#158](https://www.github.com/AccessKit/accesskit/issues/158)) ([a06725e](https://www.github.com/AccessKit/accesskit/commit/a06725e952e6041dbd366944fa793b746c9f195e)) + + +### Bug Fixes + +* **platforms/macos:** Fix macOS crate version number ([#161](https://www.github.com/AccessKit/accesskit/issues/161)) ([e0a6a40](https://www.github.com/AccessKit/accesskit/commit/e0a6a401050cdcaea4efa870ed77ae94388f1ce0)) +* **platforms/windows:** Re-export the windows-rs HWND type ([#159](https://www.github.com/AccessKit/accesskit/issues/159)) ([389187a](https://www.github.com/AccessKit/accesskit/commit/389187ac5e96895ed1763d14d315d2f8f4256460)) + +### [0.5.1](https://www.github.com/AccessKit/accesskit/compare/accesskit_winit-v0.5.0...accesskit_winit-v0.5.1) (2022-11-17) + + +### Bug Fixes + +* **platforms/winit:** Eliminate some problematic indirect dependencies ([#154](https://www.github.com/AccessKit/accesskit/issues/154)) ([58048ae](https://www.github.com/AccessKit/accesskit/commit/58048aebedc293eda5c5819ea66db9b40b8926b0)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.7.0 to 0.8.0 + +## [0.5.0](https://www.github.com/AccessKit/accesskit/compare/accesskit_winit-v0.4.0...accesskit_winit-v0.5.0) (2022-11-14) + + +### Features + +* **platforms/winit:** Allow a custom action handler ([#149](https://www.github.com/AccessKit/accesskit/issues/149)) ([cdb1a16](https://www.github.com/AccessKit/accesskit/commit/cdb1a164de06f18cad497409a514f270a8336b4c)) + +## [0.4.0](https://www.github.com/AccessKit/accesskit/compare/accesskit_winit-v0.3.3...accesskit_winit-v0.4.0) (2022-11-12) + + +### ⚠ BREAKING CHANGES + +* **platforms/windows:** Update to windows-rs 0.42.0 (#148) + +### Bug Fixes + +* **consumer, platforms/windows, platforms/winit:** Update to parking_lot 0.12.1 ([#146](https://www.github.com/AccessKit/accesskit/issues/146)) ([6772855](https://www.github.com/AccessKit/accesskit/commit/6772855a7b540fd728faad15d8d208b05c1bbd8a)) +* **platforms/windows:** Update to windows-rs 0.42.0 ([#148](https://www.github.com/AccessKit/accesskit/issues/148)) ([70d1a89](https://www.github.com/AccessKit/accesskit/commit/70d1a89f51fd6c3a32b7192d9d7f3937db09d196)) + +### [0.3.3](https://www.github.com/AccessKit/accesskit/compare/accesskit_winit-v0.3.2...accesskit_winit-v0.3.3) (2022-11-11) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.6.1 to 0.7.0 + +### [0.3.2](https://www.github.com/AccessKit/accesskit/compare/accesskit_winit-v0.3.1...accesskit_winit-v0.3.2) (2022-10-11) + + +### Bug Fixes + +* **platforms/winit:** Derive `Debug` on `ActionRequestEvent` ([#141](https://www.github.com/AccessKit/accesskit/issues/141)) ([8b84c75](https://www.github.com/AccessKit/accesskit/commit/8b84c7547c6fdb52cd6d5c6d79f812dc614f08dd)) + +### [0.3.1](https://www.github.com/AccessKit/accesskit/compare/accesskit_winit-v0.3.0...accesskit_winit-v0.3.1) (2022-10-10) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.6.0 to 0.6.1 + +## [0.3.0](https://www.github.com/AccessKit/accesskit/compare/accesskit_winit-v0.2.1...accesskit_winit-v0.3.0) (2022-10-09) + + +### ⚠ BREAKING CHANGES + +* Wrap `TreeUpdate` nodes in `Arc` (#135) +* Store node ID in `TreeUpdate`, not `accesskit::Node` (#132) + +### Code Refactoring + +* Store node ID in `TreeUpdate`, not `accesskit::Node` ([#132](https://www.github.com/AccessKit/accesskit/issues/132)) ([0bb86dd](https://www.github.com/AccessKit/accesskit/commit/0bb86ddb298cb5a253a91f07be0bad8b84b2fda3)) +* Wrap `TreeUpdate` nodes in `Arc` ([#135](https://www.github.com/AccessKit/accesskit/issues/135)) ([907bc18](https://www.github.com/AccessKit/accesskit/commit/907bc1820b80d95833b6c5c3acaa2a8a4e93a6c2)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.5.1 to 0.6.0 + +### [0.2.1](https://www.github.com/AccessKit/accesskit/compare/accesskit_winit-v0.2.0...accesskit_winit-v0.2.1) (2022-10-03) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.5.0 to 0.5.1 + +## [0.2.0](https://www.github.com/AccessKit/accesskit/compare/accesskit_winit-v0.1.0...accesskit_winit-v0.2.0) (2022-09-23) + + +### ⚠ BREAKING CHANGES + +* Basic live regions (#128) +* **platforms/windows:** Bump windows-rs dependency (#126) +* **platforms/winit:** Bump winit dependency (#125) + +### Features + +* Basic live regions ([#128](https://www.github.com/AccessKit/accesskit/issues/128)) ([03d745b](https://www.github.com/AccessKit/accesskit/commit/03d745b891147175bde2693cc10b96a2f6e31f39)) + + +### Miscellaneous Chores + +* **platforms/windows:** Bump windows-rs dependency ([#126](https://www.github.com/AccessKit/accesskit/issues/126)) ([472a75e](https://www.github.com/AccessKit/accesskit/commit/472a75e4214b90396f3282f247df08100ed8362d)) +* **platforms/winit:** Bump winit dependency ([#125](https://www.github.com/AccessKit/accesskit/issues/125)) ([6026c1b](https://www.github.com/AccessKit/accesskit/commit/6026c1b2ecede3ca2f2076075ed158000154b34e)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.4.0 to 0.5.0 + +## 0.1.0 (2022-07-22) + + +### Features + +* **platforms/winit:** New winit adapter ([#121](https://www.github.com/AccessKit/accesskit/issues/121)) ([fdc274e](https://www.github.com/AccessKit/accesskit/commit/fdc274e7d3a901873d2ad0c7a4824a19111787ef)) + + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * accesskit bumped from 0.3.0 to 0.4.0 diff --git a/platforms/adapter/Cargo.toml b/platforms/adapter/Cargo.toml new file mode 100644 index 000000000..667dc48e0 --- /dev/null +++ b/platforms/adapter/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "accesskit_adapter" +version = "0.29.2" +authors.workspace = true +license = "Apache-2.0" +description = "AccessKit UI accessibility infrastructure: cross-platform adapter" +categories.workspace = true +keywords = ["gui", "ui", "accessibility"] +repository.workspace = true +edition.workspace = true +rust-version.workspace = true + +[features] +default = ["accesskit_unix", "async-io"] +async-io = ["accesskit_unix/async-io"] +tokio = ["accesskit_unix/tokio"] + +[dependencies] +accesskit = { version = "0.22", path = "../../common" } +winit-core = { version = "0.31.0-beta.2", default-features = false } +raw-window-handle = { version = "0.6.2", features = ["std"] } + +[target.'cfg(target_os = "windows")'.dependencies] +accesskit_windows = { version = "0.30.0", path = "../windows" } + +[target.'cfg(target_os = "macos")'.dependencies] +accesskit_macos = { version = "0.23.0", path = "../macos" } + +[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd"))'.dependencies] +accesskit_unix = { version = "0.18.0", path = "../unix", optional = true, default-features = false } + +[target.'cfg(target_os = "android")'.dependencies] +accesskit_android = { version = "0.5.0", path = "../android", optional = true, features = ["embedded-dex"] } +android-activity = { version = "0.6.0" } + diff --git a/platforms/adapter/src/lib.rs b/platforms/adapter/src/lib.rs new file mode 100644 index 000000000..57e8eb926 --- /dev/null +++ b/platforms/adapter/src/lib.rs @@ -0,0 +1,164 @@ +// Copyright 2022 The AccessKit Authors. All rights reserved. +// Licensed under the Apache License, Version 2.0 (found in +// the LICENSE-APACHE file). + +/// ## Compatibility with async runtimes +/// +/// The following only applies on Linux/Unix: +/// +/// While this crate's API is purely blocking, it internally spawns asynchronous tasks on an executor. +/// +/// - If you use tokio, make sure to enable the `tokio` feature of this crate. +/// - If you use another async runtime or if you don't use one at all, the default feature will suit your needs. + +#[cfg(all( + feature = "accesskit_unix", + any( + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" + ), + not(feature = "async-io"), + not(feature = "tokio") +))] +compile_error!("Either \"async-io\" (default) or \"tokio\" feature must be enabled."); + +#[cfg(all( + feature = "accesskit_unix", + any( + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" + ), + feature = "async-io", + feature = "tokio" +))] +compile_error!( + "Both \"async-io\" (default) and \"tokio\" features cannot be enabled at the same time." +); + +use std::sync::Arc; + +use accesskit::{ + ActionHandler, ActionRequest, ActivationHandler, DeactivationHandler, Rect, TreeUpdate, +}; +use raw_window_handle::RawWindowHandle; + +mod platform_impl; + +#[derive(Clone, Debug, PartialEq)] +pub enum WindowEvent { + InitialTreeRequested, + ActionRequested(ActionRequest), + AccessibilityDeactivated, +} + +pub trait EventHandler: Send + 'static { + fn handle_accesskit_event(&self, event: WindowEvent); +} + +#[derive(Clone)] +struct CombinedHandler(Arc); + +impl ActivationHandler for CombinedHandler { + fn request_initial_tree(&mut self) -> Option { + self.0 + .handle_accesskit_event(WindowEvent::InitialTreeRequested); + None + } +} +impl DeactivationHandler for CombinedHandler { + fn deactivate_accessibility(&mut self) { + self.0 + .handle_accesskit_event(WindowEvent::AccessibilityDeactivated); + } +} +impl ActionHandler for CombinedHandler { + fn do_action(&mut self, request: ActionRequest) { + self.0 + .handle_accesskit_event(WindowEvent::ActionRequested(request)); + } +} + +pub struct Adapter { + /// A user-supplied ID that we pass back to + inner: platform_impl::Adapter, +} + +impl Adapter { + /// Creates a new AccessKit adapter for a winit window. This must be done + /// before the window is shown for the first time. This means that you must + /// use [`winit::window::WindowAttributes::with_visible`] to make the window + /// initially invisible, then create the adapter, then show the window. + /// + /// Use this if you want to provide your own AccessKit handler callbacks + /// rather than dispatching requests through the winit event loop. This is + /// especially useful for the activation handler, because depending on + /// your application's architecture, implementing the handler directly may + /// allow you to return an initial tree synchronously, rather than requiring + /// some platform adapters to use a placeholder tree until you send + /// the first update. However, remember that each of these handlers may be + /// called on any thread, depending on the underlying platform adapter. + /// + /// # Panics + /// + /// Panics if the window is already visible. + pub fn with_split_handlers( + #[cfg(target_os = "android")] android_app: &AndroidApp, + #[cfg(not(target_os = "android"))] window: &RawWindowHandle, + activation_handler: impl 'static + ActivationHandler + Send, + action_handler: impl 'static + ActionHandler + Send, + deactivation_handler: impl 'static + DeactivationHandler + Send, + ) -> Self { + let inner = platform_impl::Adapter::new( + #[cfg(target_os = "android")] + android_app, + #[cfg(not(target_os = "android"))] + window, + activation_handler, + action_handler, + deactivation_handler, + ); + Self { inner } + } + + pub fn with_combined_handler( + #[cfg(target_os = "android")] android_app: &AndroidApp, + #[cfg(not(target_os = "android"))] window: &RawWindowHandle, + handler: Arc, + ) -> Self { + let handler = CombinedHandler(handler); + let inner = platform_impl::Adapter::new( + #[cfg(target_os = "android")] + android_app, + #[cfg(not(target_os = "android"))] + window, + handler.clone(), + handler.clone(), + handler, + ); + Self { inner } + } + + /// If and only if the tree has been initialized, call the provided function + /// and apply the resulting update. Note: If the caller's implementation of + /// [`ActivationHandler::request_initial_tree`] initially returned `None`, + /// or if the caller created the adapter using [`EventLoopProxy`], then + /// the [`TreeUpdate`] returned by the provided function must contain + /// a full tree. + pub fn update_if_active(&mut self, updater: impl FnOnce() -> TreeUpdate) { + self.inner.update_if_active(updater); + } + + pub fn set_focus(&mut self, is_focused: bool) { + self.inner.set_focus(is_focused); + } + + pub fn set_window_bounds(&mut self, outer_bounds: Rect, inner_bounds: Rect) { + self.inner.set_window_bounds(outer_bounds, inner_bounds); + } +} diff --git a/platforms/winit/src/platform_impl/android.rs b/platforms/adapter/src/platform_impl/android.rs similarity index 71% rename from platforms/winit/src/platform_impl/android.rs rename to platforms/adapter/src/platform_impl/android.rs index c3d402371..40cc49681 100644 --- a/platforms/winit/src/platform_impl/android.rs +++ b/platforms/adapter/src/platform_impl/android.rs @@ -7,10 +7,7 @@ use accesskit_android::{ jni::{objects::JObject, JavaVM}, InjectingAdapter, }; -use winit::{ - event::WindowEvent, event_loop::ActiveEventLoop, platform::android::ActiveEventLoopExtAndroid, - window::Window, -}; +use android_activity::AndroidApp; pub struct Adapter { adapter: InjectingAdapter, @@ -18,16 +15,14 @@ pub struct Adapter { impl Adapter { pub fn new( - event_loop: &ActiveEventLoop, - _window: &Window, + android_app: &AndroidApp, activation_handler: impl 'static + ActivationHandler + Send, action_handler: impl 'static + ActionHandler + Send, _deactivation_handler: impl 'static + DeactivationHandler, ) -> Self { - let app = event_loop.android_app(); - let vm = unsafe { JavaVM::from_raw(app.vm_as_ptr() as *mut _) }.unwrap(); + let vm = unsafe { JavaVM::from_raw(android_app.vm_as_ptr() as *mut _) }.unwrap(); let mut env = vm.get_env().unwrap(); - let activity = unsafe { JObject::from_raw(app.activity_as_ptr() as *mut _) }; + let activity = unsafe { JObject::from_raw(android_app.activity_as_ptr() as *mut _) }; let view = env .get_field( &activity, @@ -45,5 +40,7 @@ impl Adapter { self.adapter.update_if_active(updater); } - pub fn process_event(&mut self, _window: &Window, _event: &WindowEvent) {} + pub fn set_focus(&mut self, is_focused: bool) {} + + pub fn set_window_bounds(&mut self, outer_bounds: Rect, inner_bounds: Rect) {} } diff --git a/platforms/winit/src/platform_impl/macos.rs b/platforms/adapter/src/platform_impl/macos.rs similarity index 52% rename from platforms/winit/src/platform_impl/macos.rs rename to platforms/adapter/src/platform_impl/macos.rs index 50fe6ebd3..88a565838 100644 --- a/platforms/winit/src/platform_impl/macos.rs +++ b/platforms/adapter/src/platform_impl/macos.rs @@ -1,14 +1,10 @@ // Copyright 2022 The AccessKit Authors. All rights reserved. // Licensed under the Apache License, Version 2.0 (found in // the LICENSE-APACHE file). -#[cfg(feature = "rwh_05")] -use crate::raw_window_handle::{HasRawWindowHandle, RawWindowHandle}; -#[cfg(feature = "rwh_06")] -use crate::raw_window_handle::{HasWindowHandle, RawWindowHandle}; -use accesskit::{ActionHandler, ActivationHandler, DeactivationHandler, TreeUpdate}; +use accesskit::{ActionHandler, ActivationHandler, DeactivationHandler, Rect, TreeUpdate}; use accesskit_macos::SubclassingAdapter; -use winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window}; +use raw_window_handle::RawWindowHandle; pub struct Adapter { adapter: SubclassingAdapter, @@ -16,20 +12,12 @@ pub struct Adapter { impl Adapter { pub fn new( - _event_loop: &ActiveEventLoop, - window: &Window, + window_handle: &RawWindowHandle, activation_handler: impl 'static + ActivationHandler, action_handler: impl 'static + ActionHandler, _deactivation_handler: impl 'static + DeactivationHandler, ) -> Self { - #[cfg(feature = "rwh_05")] - let view = match window.raw_window_handle() { - RawWindowHandle::AppKit(handle) => handle.ns_view, - RawWindowHandle::UiKit(_) => unimplemented!(), - _ => unreachable!(), - }; - #[cfg(feature = "rwh_06")] - let view = match window.window_handle().unwrap().as_raw() { + let view = match window_handle { RawWindowHandle::AppKit(handle) => handle.ns_view.as_ptr(), RawWindowHandle::UiKit(_) => unimplemented!(), _ => unreachable!(), @@ -45,11 +33,11 @@ impl Adapter { } } - pub fn process_event(&mut self, _window: &Window, event: &WindowEvent) { - if let WindowEvent::Focused(is_focused) = event { - if let Some(events) = self.adapter.update_view_focus_state(*is_focused) { - events.raise(); - } + pub fn set_focus(&mut self, is_focused: bool) { + if let Some(events) = self.adapter.update_view_focus_state(is_focused) { + events.raise(); } } + + pub fn set_window_bounds(&mut self, _outer_bounds: Rect, _inner_bounds: Rect) {} } diff --git a/platforms/winit/src/platform_impl/mod.rs b/platforms/adapter/src/platform_impl/mod.rs similarity index 100% rename from platforms/winit/src/platform_impl/mod.rs rename to platforms/adapter/src/platform_impl/mod.rs diff --git a/platforms/winit/src/platform_impl/null.rs b/platforms/adapter/src/platform_impl/null.rs similarity index 72% rename from platforms/winit/src/platform_impl/null.rs rename to platforms/adapter/src/platform_impl/null.rs index 179999261..c68c9378a 100644 --- a/platforms/winit/src/platform_impl/null.rs +++ b/platforms/adapter/src/platform_impl/null.rs @@ -3,14 +3,12 @@ // the LICENSE-APACHE file). use accesskit::{ActionHandler, ActivationHandler, DeactivationHandler, TreeUpdate}; -use winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window}; pub struct Adapter; impl Adapter { pub fn new( - _event_loop: &ActiveEventLoop, - _window: &Window, + _window_handle: &RawWindowHandle, _activation_handler: impl 'static + ActivationHandler, _action_handler: impl 'static + ActionHandler, _deactivation_handler: impl 'static + DeactivationHandler, @@ -20,5 +18,7 @@ impl Adapter { pub fn update_if_active(&mut self, _updater: impl FnOnce() -> TreeUpdate) {} - pub fn process_event(&mut self, _window: &Window, _event: &WindowEvent) {} + pub fn set_focus(&mut self, is_focused: bool) {} + + pub fn set_window_bounds(&mut self, outer_bounds: Rect, inner_bounds: Rect) {} } diff --git a/platforms/adapter/src/platform_impl/unix.rs b/platforms/adapter/src/platform_impl/unix.rs new file mode 100644 index 000000000..50896a2a6 --- /dev/null +++ b/platforms/adapter/src/platform_impl/unix.rs @@ -0,0 +1,43 @@ +// Copyright 2022 The AccessKit Authors. All rights reserved. +// Licensed under the Apache License, Version 2.0 (found in +// the LICENSE-APACHE file). + +use accesskit::{ActionHandler, ActivationHandler, DeactivationHandler, Rect, TreeUpdate}; +use accesskit_unix::Adapter as UnixAdapter; +use raw_window_handle::RawWindowHandle; + +pub struct Adapter { + adapter: UnixAdapter, +} + +impl Adapter { + pub fn new( + _window_handle: &RawWindowHandle, + activation_handler: impl 'static + ActivationHandler + Send, + action_handler: impl 'static + ActionHandler + Send, + deactivation_handler: impl 'static + DeactivationHandler + Send, + ) -> Self { + let adapter = UnixAdapter::new(activation_handler, action_handler, deactivation_handler); + Self { adapter } + } + + fn set_root_window_bounds(&mut self, outer: Rect, inner: Rect) { + self.adapter.set_root_window_bounds(outer, inner); + } + + pub fn update_if_active(&mut self, updater: impl FnOnce() -> TreeUpdate) { + self.adapter.update_if_active(updater); + } + + fn update_window_focus_state(&mut self, is_focused: bool) { + self.adapter.update_window_focus_state(is_focused); + } + + pub fn set_focus(&mut self, is_focused: bool) { + self.update_window_focus_state(*is_focused); + } + + pub fn set_window_bounds(&mut self, outer_bounds: Rect, inner_bounds: Rect) { + self.set_root_window_bounds(outer_bounds, inner_bounds) + } +} diff --git a/platforms/winit/src/platform_impl/windows.rs b/platforms/adapter/src/platform_impl/windows.rs similarity index 62% rename from platforms/winit/src/platform_impl/windows.rs rename to platforms/adapter/src/platform_impl/windows.rs index 5f12d26ca..c297ab09b 100644 --- a/platforms/winit/src/platform_impl/windows.rs +++ b/platforms/adapter/src/platform_impl/windows.rs @@ -1,13 +1,10 @@ // Copyright 2022 The AccessKit Authors. All rights reserved. // Licensed under the Apache License, Version 2.0 (found in // the LICENSE-APACHE file). -#[cfg(feature = "rwh_05")] -use crate::raw_window_handle::{HasRawWindowHandle, RawWindowHandle}; -#[cfg(feature = "rwh_06")] -use crate::raw_window_handle::{HasWindowHandle, RawWindowHandle}; use accesskit::{ActionHandler, ActivationHandler, DeactivationHandler, TreeUpdate}; use accesskit_windows::{SubclassingAdapter, HWND}; +use raw_window_handle::RawWindowHandle; use winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window}; pub struct Adapter { @@ -16,20 +13,12 @@ pub struct Adapter { impl Adapter { pub fn new( - _event_loop: &ActiveEventLoop, - window: &Window, + window_handle: &RawWindowHandle, activation_handler: impl 'static + ActivationHandler, action_handler: impl 'static + ActionHandler + Send, _deactivation_handler: impl 'static + DeactivationHandler, ) -> Self { - #[cfg(feature = "rwh_05")] - let hwnd = match window.raw_window_handle() { - RawWindowHandle::Win32(handle) => handle.hwnd, - RawWindowHandle::WinRt(_) => unimplemented!(), - _ => unreachable!(), - }; - #[cfg(feature = "rwh_06")] - let hwnd = match window.window_handle().unwrap().as_raw() { + let hwnd = match window_handle { RawWindowHandle::Win32(handle) => handle.hwnd.get() as *mut _, RawWindowHandle::WinRt(_) => unimplemented!(), _ => unreachable!(), @@ -45,5 +34,7 @@ impl Adapter { } } - pub fn process_event(&mut self, _window: &Window, _event: &WindowEvent) {} + pub fn set_focus(&mut self, is_focused: bool) {} + + pub fn set_window_bounds(&mut self, outer_bounds: Rect, inner_bounds: Rect) {} } diff --git a/platforms/winit/Cargo.toml b/platforms/winit/Cargo.toml index 1d333aba2..b24c14de8 100644 --- a/platforms/winit/Cargo.toml +++ b/platforms/winit/Cargo.toml @@ -12,17 +12,15 @@ edition.workspace = true rust-version.workspace = true [features] -default = ["accesskit_unix", "async-io", "rwh_06", "winit/x11", "winit/wayland"] -rwh_05 = ["winit/rwh_05", "dep:rwh_05"] -rwh_06 = ["winit/rwh_06", "dep:rwh_06"] -async-io = ["accesskit_unix/async-io"] -tokio = ["accesskit_unix/tokio"] +default = ["accesskit_unix", "async-io", "winit/x11", "winit/wayland"] +async-io = ["accesskit_adapter/async-io"] +tokio = ["accesskit_adapter/tokio"] [dependencies] accesskit = { version = "0.22.0", path = "../../common" } -winit = { version = "0.30.5", default-features = false } -rwh_05 = { package = "raw-window-handle", version = "0.5", features = ["std"], optional = true } -rwh_06 = { package = "raw-window-handle", version = "0.6.2", features = ["std"], optional = true } +accesskit_adapter = { version = "0.29.2", path = "../adapter" } +winit-core = { version = "0.31.0-beta.2", default-features = false } +raw-window-handle = { version = "0.6.2", features = ["std"] } [target.'cfg(target_os = "windows")'.dependencies] accesskit_windows = { version = "0.30.0", path = "../windows" } @@ -35,9 +33,11 @@ accesskit_unix = { version = "0.18.0", path = "../unix", optional = true, defaul [target.'cfg(target_os = "android")'.dependencies] accesskit_android = { version = "0.5.0", path = "../android", optional = true, features = ["embedded-dex"] } +winit-android = { version = "0.31.0-beta.2" } +android-activity = { version = "0.6.0" } [dev-dependencies.winit] -version = "0.30.5" +version = "0.31.0-beta.2" default-features = false features = ["x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita"] diff --git a/platforms/winit/src/lib.rs b/platforms/winit/src/lib.rs index 976fa54bd..29ee4f392 100644 --- a/platforms/winit/src/lib.rs +++ b/platforms/winit/src/lib.rs @@ -2,133 +2,55 @@ // Licensed under the Apache License, Version 2.0 (found in // the LICENSE-APACHE file). -/// ## Compatibility with async runtimes -/// -/// The following only applies on Linux/Unix: -/// -/// While this crate's API is purely blocking, it internally spawns asynchronous tasks on an executor. -/// -/// - If you use tokio, make sure to enable the `tokio` feature of this crate. -/// - If you use another async runtime or if you don't use one at all, the default feature will suit your needs. - -#[cfg(all( - feature = "accesskit_unix", - any( - target_os = "linux", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "netbsd", - target_os = "openbsd" - ), - not(feature = "async-io"), - not(feature = "tokio") -))] -compile_error!("Either \"async-io\" (default) or \"tokio\" feature must be enabled."); - -#[cfg(all( - feature = "accesskit_unix", - any( - target_os = "linux", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "netbsd", - target_os = "openbsd" - ), - feature = "async-io", - feature = "tokio" -))] -compile_error!( - "Both \"async-io\" (default) and \"tokio\" features cannot be enabled at the same time." -); - -#[cfg(all(not(feature = "rwh_05"), not(feature = "rwh_06")))] -compile_error!("Either \"rwh_06\" (default) or \"rwh_05\" feature must be enabled."); - -#[cfg(all(feature = "rwh_05", feature = "rwh_06"))] -compile_error!( - "Both \"rwh_06\" (default) and \"rwh_05\" features cannot be enabled at the same time." -); - -use accesskit::{ActionHandler, ActionRequest, ActivationHandler, DeactivationHandler, TreeUpdate}; -use winit::{ +use accesskit::{ + ActionHandler, ActionRequest, ActivationHandler, DeactivationHandler, Rect, TreeUpdate, +}; +use accesskit_adapter::{Adapter, WindowEvent}; +use raw_window_handle::HasWindowHandle as _; +use std::sync::Arc; +use winit_core::event_loop::ActiveEventLoop; +use winit_core::{ event::WindowEvent as WinitWindowEvent, - event_loop::{ActiveEventLoop, EventLoopProxy}, window::{Window, WindowId}, }; -#[cfg(feature = "rwh_05")] -#[allow(unused)] -use rwh_05 as raw_window_handle; -#[cfg(feature = "rwh_06")] -#[allow(unused)] -use rwh_06 as raw_window_handle; - -mod platform_impl; - -#[derive(Debug)] -pub struct Event { - pub window_id: WindowId, - pub window_event: WindowEvent, -} - -#[derive(Clone, Debug, PartialEq)] -pub enum WindowEvent { - InitialTreeRequested, - ActionRequested(ActionRequest), - AccessibilityDeactivated, -} +#[cfg(target_os = "android")] +use winit_android::EventLoopExtAndroid as _; -struct WinitActivationHandler + Send + 'static> { +#[derive(Clone)] +struct WinitHandler { window_id: WindowId, - proxy: EventLoopProxy, + callback: Arc, } -impl + Send + 'static> ActivationHandler for WinitActivationHandler { +impl ActivationHandler for WinitHandler { fn request_initial_tree(&mut self) -> Option { - let event = Event { - window_id: self.window_id, - window_event: WindowEvent::InitialTreeRequested, - }; - self.proxy.send_event(event.into()).ok(); + (self.callback)(self.window_id, WindowEvent::InitialTreeRequested); None } } - -struct WinitActionHandler + Send + 'static> { - window_id: WindowId, - proxy: EventLoopProxy, +impl DeactivationHandler for WinitHandler { + fn deactivate_accessibility(&mut self) { + (self.callback)(self.window_id, WindowEvent::AccessibilityDeactivated); + } } - -impl + Send + 'static> ActionHandler for WinitActionHandler { +impl ActionHandler for WinitHandler { fn do_action(&mut self, request: ActionRequest) { - let event = Event { - window_id: self.window_id, - window_event: WindowEvent::ActionRequested(request), - }; - self.proxy.send_event(event.into()).ok(); + (self.callback)(self.window_id, WindowEvent::ActionRequested(request)); } } -struct WinitDeactivationHandler + Send + 'static> { - window_id: WindowId, - proxy: EventLoopProxy, -} - -impl + Send + 'static> DeactivationHandler for WinitDeactivationHandler { - fn deactivate_accessibility(&mut self) { - let event = Event { - window_id: self.window_id, - window_event: WindowEvent::AccessibilityDeactivated, - }; - self.proxy.send_event(event.into()).ok(); - } +#[derive(Debug)] +pub struct Event { + pub window_id: WindowId, + pub window_event: WindowEvent, } -pub struct Adapter { - inner: platform_impl::Adapter, +pub struct WinitAdapter { + inner: Adapter, } -impl Adapter { +impl WinitAdapter { /// Creates a new AccessKit adapter for a winit window. This must be done /// before the window is shown for the first time. This means that you must /// use [`winit::window::WindowAttributes::with_visible`] to make the window @@ -147,110 +69,59 @@ impl Adapter { /// /// Panics if the window is already visible. pub fn with_event_loop_proxy + Send + 'static>( - event_loop: &ActiveEventLoop, - window: &Window, - proxy: EventLoopProxy, + event_loop: &dyn ActiveEventLoop, + window: &dyn Window, + callback: impl Fn(WindowId, WindowEvent) + Send + Sync + 'static, ) -> Self { let window_id = window.id(); - let activation_handler = WinitActivationHandler { - window_id, - proxy: proxy.clone(), - }; - let action_handler = WinitActionHandler { + let handler = WinitHandler { window_id, - proxy: proxy.clone(), + callback: Arc::new(callback) as _, }; - let deactivation_handler = WinitDeactivationHandler { window_id, proxy }; - Self::with_direct_handlers( - event_loop, - window, - activation_handler, - action_handler, - deactivation_handler, - ) - } - /// Creates a new AccessKit adapter for a winit window. This must be done - /// before the window is shown for the first time. This means that you must - /// use [`winit::window::WindowAttributes::with_visible`] to make the window - /// initially invisible, then create the adapter, then show the window. - /// - /// Use this if you want to provide your own AccessKit handler callbacks - /// rather than dispatching requests through the winit event loop. This is - /// especially useful for the activation handler, because depending on - /// your application's architecture, implementing the handler directly may - /// allow you to return an initial tree synchronously, rather than requiring - /// some platform adapters to use a placeholder tree until you send - /// the first update. However, remember that each of these handlers may be - /// called on any thread, depending on the underlying platform adapter. - /// - /// # Panics - /// - /// Panics if the window is already visible. - pub fn with_direct_handlers( - event_loop: &ActiveEventLoop, - window: &Window, - activation_handler: impl 'static + ActivationHandler + Send, - action_handler: impl 'static + ActionHandler + Send, - deactivation_handler: impl 'static + DeactivationHandler + Send, - ) -> Self { - if window.is_visible() == Some(true) { - panic!("The AccessKit winit adapter must be created before the window is shown (made visible) for the first time."); + // Silence unused variable warning + #[cfg(not(target_os = "android"))] + let _ = event_loop; + + Self { + inner: accesskit_adapter::Adapter::with_split_handlers( + #[cfg(not(target_os = "android"))] + &window.window_handle().unwrap().as_raw(), + #[cfg(target_os = "android")] + event_loop.android_app(), + handler.clone(), + handler.clone(), + handler, + ), } - - let inner = platform_impl::Adapter::new( - event_loop, - window, - activation_handler, - action_handler, - deactivation_handler, - ); - Self { inner } - } - - /// Creates a new AccessKit adapter for a winit window. This must be done - /// before the window is shown for the first time. This means that you must - /// use [`winit::window::WindowAttributes::with_visible`] to make the window - /// initially invisible, then create the adapter, then show the window. - /// - /// This constructor provides a mix of the approaches used by - /// [`Adapter::with_event_loop_proxy`] and [`Adapter::with_direct_handlers`]. - /// It uses the event loop proxy for the action request and deactivation - /// events, which can be handled asynchronously with no drawback, - /// while using a direct, caller-provided activation handler that can - /// return the initial tree synchronously. Remember that the thread on which - /// the activation handler is called is platform-dependent. - /// - /// # Panics - /// - /// Panics if the window is already visible. - pub fn with_mixed_handlers + Send + 'static>( - event_loop: &ActiveEventLoop, - window: &Window, - activation_handler: impl 'static + ActivationHandler + Send, - proxy: EventLoopProxy, - ) -> Self { - let window_id = window.id(); - let action_handler = WinitActionHandler { - window_id, - proxy: proxy.clone(), - }; - let deactivation_handler = WinitDeactivationHandler { window_id, proxy }; - Self::with_direct_handlers( - event_loop, - window, - activation_handler, - action_handler, - deactivation_handler, - ) } /// Allows reacting to window events. /// /// This must be called whenever a new window event is received /// and before it is handled by the application. - pub fn process_event(&mut self, window: &Window, event: &WinitWindowEvent) { - self.inner.process_event(window, event); + pub fn process_event(&mut self, window: &dyn Window, event: &WinitWindowEvent) { + match event { + WinitWindowEvent::Focused(is_focused) => { + self.inner.set_focus(*is_focused); + } + WinitWindowEvent::Moved(_) | WinitWindowEvent::SurfaceResized(_) => { + let outer_position: (_, _) = window + .outer_position() + .unwrap_or_default() + .cast::() + .into(); + let outer_size: (_, _) = window.outer_size().cast::().into(); + let inner_position: (_, _) = window.surface_position().cast::().into(); + let inner_size: (_, _) = window.surface_size().cast::().into(); + + self.inner.set_window_bounds( + Rect::from_origin_size(outer_position, outer_size), + Rect::from_origin_size(inner_position, inner_size), + ) + } + _ => (), + } } /// If and only if the tree has been initialized, call the provided function diff --git a/platforms/winit/src/platform_impl/unix.rs b/platforms/winit/src/platform_impl/unix.rs deleted file mode 100644 index dba6a84ce..000000000 --- a/platforms/winit/src/platform_impl/unix.rs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 The AccessKit Authors. All rights reserved. -// Licensed under the Apache License, Version 2.0 (found in -// the LICENSE-APACHE file). - -use accesskit::{ActionHandler, ActivationHandler, DeactivationHandler, Rect, TreeUpdate}; -use accesskit_unix::Adapter as UnixAdapter; -use winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window}; - -pub struct Adapter { - adapter: UnixAdapter, -} - -impl Adapter { - pub fn new( - _event_loop: &ActiveEventLoop, - _window: &Window, - activation_handler: impl 'static + ActivationHandler + Send, - action_handler: impl 'static + ActionHandler + Send, - deactivation_handler: impl 'static + DeactivationHandler + Send, - ) -> Self { - let adapter = UnixAdapter::new(activation_handler, action_handler, deactivation_handler); - Self { adapter } - } - - fn set_root_window_bounds(&mut self, outer: Rect, inner: Rect) { - self.adapter.set_root_window_bounds(outer, inner); - } - - pub fn update_if_active(&mut self, updater: impl FnOnce() -> TreeUpdate) { - self.adapter.update_if_active(updater); - } - - fn update_window_focus_state(&mut self, is_focused: bool) { - self.adapter.update_window_focus_state(is_focused); - } - - pub fn process_event(&mut self, window: &Window, event: &WindowEvent) { - match event { - WindowEvent::Moved(outer_position) => { - let outer_position: (_, _) = outer_position.cast::().into(); - let outer_size: (_, _) = window.outer_size().cast::().into(); - let inner_position: (_, _) = window - .inner_position() - .unwrap_or_default() - .cast::() - .into(); - let inner_size: (_, _) = window.inner_size().cast::().into(); - self.set_root_window_bounds( - Rect::from_origin_size(outer_position, outer_size), - Rect::from_origin_size(inner_position, inner_size), - ) - } - WindowEvent::Resized(inner_size) => { - let outer_position: (_, _) = window - .outer_position() - .unwrap_or_default() - .cast::() - .into(); - let outer_size: (_, _) = window.outer_size().cast::().into(); - let inner_position: (_, _) = window - .inner_position() - .unwrap_or_default() - .cast::() - .into(); - let inner_size: (_, _) = inner_size.cast::().into(); - self.set_root_window_bounds( - Rect::from_origin_size(outer_position, outer_size), - Rect::from_origin_size(inner_position, inner_size), - ) - } - WindowEvent::Focused(is_focused) => { - self.update_window_focus_state(*is_focused); - } - _ => (), - } - } -} From 2e7bcc184adf8ac0413727ea2c6a31ff1929ca57 Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Fri, 2 Jan 2026 21:41:48 +0000 Subject: [PATCH 2/6] Use rust 1.85 Signed-off-by: Nico Burns --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f5494fec3..53386c4d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ categories = ["gui"] edition = "2021" license = "MIT OR Apache-2.0" repository = "https://github.com/AccessKit/accesskit" -rust-version = "1.77.2" +rust-version = "1.85.0" [workspace.dependencies] hashbrown = { version = "0.16", default-features = false, features = ["default-hasher"] } From bbb77b0c43a074305d9d551f0ec2e9613169a9e7 Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Fri, 2 Jan 2026 21:48:13 +0000 Subject: [PATCH 3/6] Upgrade winit dev-dependency to 0.31-beta.2 Signed-off-by: Nico Burns --- Cargo.lock | 274 +++-------------------------------- platforms/windows/Cargo.toml | 2 +- 2 files changed, 24 insertions(+), 252 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0d386f5db..891e5489e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "ab_glyph" @@ -115,7 +115,7 @@ dependencies = [ "static_assertions", "windows", "windows-core", - "winit 0.30.9", + "winit", ] [[package]] @@ -131,7 +131,7 @@ dependencies = [ "android-activity", "raw-window-handle", "softbuffer", - "winit 0.31.0-beta.2", + "winit", "winit-android", "winit-core", ] @@ -486,20 +486,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" -[[package]] -name = "calloop" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" -dependencies = [ - "bitflags 2.8.0", - "log", - "polling", - "rustix 0.38.44", - "slab", - "thiserror 1.0.64", -] - [[package]] name = "calloop" version = "0.14.3" @@ -513,25 +499,13 @@ dependencies = [ "tracing", ] -[[package]] -name = "calloop-wayland-source" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" -dependencies = [ - "calloop 0.13.0", - "rustix 0.38.44", - "wayland-backend", - "wayland-client", -] - [[package]] name = "calloop-wayland-source" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" dependencies = [ - "calloop 0.14.3", + "calloop", "rustix 1.1.2", "wayland-backend", "wayland-client", @@ -1231,30 +1205,6 @@ dependencies = [ "objc2-foundation 0.3.2", ] -[[package]] -name = "objc2-cloud-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" -dependencies = [ - "bitflags 2.8.0", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-core-location", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-contacts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", -] - [[package]] name = "objc2-core-data" version = "0.2.2" @@ -1302,18 +1252,6 @@ dependencies = [ "objc2-metal", ] -[[package]] -name = "objc2-core-location" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-contacts", - "objc2-foundation 0.2.2", -] - [[package]] name = "objc2-core-video" version = "0.3.2" @@ -1356,18 +1294,6 @@ dependencies = [ "objc2-core-foundation", ] -[[package]] -name = "objc2-link-presentation" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", -] - [[package]] name = "objc2-metal" version = "0.2.2" @@ -1393,37 +1319,6 @@ dependencies = [ "objc2-metal", ] -[[package]] -name = "objc2-symbols" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" -dependencies = [ - "objc2 0.5.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-ui-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" -dependencies = [ - "bitflags 2.8.0", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-cloud-kit", - "objc2-core-data", - "objc2-core-image", - "objc2-core-location", - "objc2-foundation 0.2.2", - "objc2-link-presentation", - "objc2-quartz-core", - "objc2-symbols", - "objc2-uniform-type-identifiers", - "objc2-user-notifications", -] - [[package]] name = "objc2-ui-kit" version = "0.3.2" @@ -1436,30 +1331,6 @@ dependencies = [ "objc2-foundation 0.3.2", ] -[[package]] -name = "objc2-uniform-type-identifiers" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-user-notifications" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" -dependencies = [ - "bitflags 2.8.0", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-core-location", - "objc2-foundation 0.2.2", -] - [[package]] name = "object" version = "0.32.1" @@ -1855,19 +1726,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "sctk-adwaita" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" -dependencies = [ - "ab_glyph", - "log", - "memmap2", - "smithay-client-toolkit 0.19.2", - "tiny-skia", -] - [[package]] name = "sctk-adwaita" version = "0.11.0" @@ -1877,7 +1735,7 @@ dependencies = [ "ab_glyph", "log", "memmap2", - "smithay-client-toolkit 0.20.0", + "smithay-client-toolkit", "tiny-skia", ] @@ -1970,31 +1828,6 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" -[[package]] -name = "smithay-client-toolkit" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" -dependencies = [ - "bitflags 2.8.0", - "calloop 0.13.0", - "calloop-wayland-source 0.3.0", - "cursor-icon", - "libc", - "log", - "memmap2", - "rustix 0.38.44", - "thiserror 1.0.64", - "wayland-backend", - "wayland-client", - "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols", - "wayland-protocols-wlr", - "wayland-scanner", - "xkeysym", -] - [[package]] name = "smithay-client-toolkit" version = "0.20.0" @@ -2002,8 +1835,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" dependencies = [ "bitflags 2.8.0", - "calloop 0.14.3", - "calloop-wayland-source 0.4.1", + "calloop", + "calloop-wayland-source", "cursor-icon", "libc", "log", @@ -2022,15 +1855,6 @@ dependencies = [ "xkeysym", ] -[[package]] -name = "smol_str" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" -dependencies = [ - "serde", -] - [[package]] name = "smol_str" version = "0.3.4" @@ -2918,58 +2742,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winit" -version = "0.30.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a809eacf18c8eca8b6635091543f02a5a06ddf3dad846398795460e6e0ae3cc0" -dependencies = [ - "ahash", - "android-activity", - "atomic-waker", - "bitflags 2.8.0", - "block2 0.5.1", - "bytemuck", - "calloop 0.13.0", - "cfg_aliases", - "concurrent-queue", - "core-foundation", - "core-graphics", - "cursor-icon", - "dpi", - "js-sys", - "libc", - "memmap2", - "ndk", - "objc2 0.5.2", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", - "objc2-ui-kit 0.2.2", - "orbclient", - "percent-encoding", - "pin-project", - "raw-window-handle", - "redox_syscall 0.4.1", - "rustix 0.38.44", - "sctk-adwaita 0.10.1", - "smithay-client-toolkit 0.19.2", - "smol_str 0.2.0", - "tracing", - "unicode-segmentation", - "wasm-bindgen", - "wasm-bindgen-futures", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-protocols-plasma", - "web-sys", - "web-time", - "windows-sys 0.52.0", - "x11-dl", - "x11rb", - "xkbcommon-dl", -] - [[package]] name = "winit" version = "0.31.0-beta.2" @@ -2983,7 +2755,7 @@ dependencies = [ "libc", "raw-window-handle", "rustix 1.1.2", - "smol_str 0.3.4", + "smol_str", "tracing", "winit-android", "winit-appkit", @@ -3008,7 +2780,7 @@ dependencies = [ "dpi", "ndk", "raw-window-handle", - "smol_str 0.3.4", + "smol_str", "tracing", "winit-core", ] @@ -3030,7 +2802,7 @@ dependencies = [ "objc2-core-video", "objc2-foundation 0.3.2", "raw-window-handle", - "smol_str 0.3.4", + "smol_str", "tracing", "winit-common", "winit-core", @@ -3045,7 +2817,7 @@ dependencies = [ "memmap2", "objc2 0.6.3", "objc2-core-foundation", - "smol_str 0.3.4", + "smol_str", "tracing", "winit-core", "x11-dl", @@ -3063,7 +2835,7 @@ dependencies = [ "dpi", "keyboard-types", "raw-window-handle", - "smol_str 0.3.4", + "smol_str", "web-time", ] @@ -3078,7 +2850,7 @@ dependencies = [ "orbclient", "raw-window-handle", "redox_syscall 0.5.13", - "smol_str 0.3.4", + "smol_str", "tracing", "winit-core", ] @@ -3096,9 +2868,9 @@ dependencies = [ "objc2 0.6.3", "objc2-core-foundation", "objc2-foundation 0.3.2", - "objc2-ui-kit 0.3.2", + "objc2-ui-kit", "raw-window-handle", - "smol_str 0.3.4", + "smol_str", "tracing", "winit-common", "winit-core", @@ -3112,16 +2884,16 @@ checksum = "8ce5afb2ba07da603f84b722c95f9f9396d2cedae3944fb6c0cda4a6f88de545" dependencies = [ "ahash", "bitflags 2.8.0", - "calloop 0.14.3", + "calloop", "cursor-icon", "dpi", "libc", "memmap2", "raw-window-handle", "rustix 1.1.2", - "sctk-adwaita 0.11.0", - "smithay-client-toolkit 0.20.0", - "smol_str 0.3.4", + "sctk-adwaita", + "smithay-client-toolkit", + "smol_str", "tracing", "wayland-backend", "wayland-client", @@ -3145,7 +2917,7 @@ dependencies = [ "js-sys", "pin-project", "raw-window-handle", - "smol_str 0.3.4", + "smol_str", "tracing", "wasm-bindgen", "wasm-bindgen-futures", @@ -3164,7 +2936,7 @@ dependencies = [ "cursor-icon", "dpi", "raw-window-handle", - "smol_str 0.3.4", + "smol_str", "tracing", "unicode-segmentation", "windows-sys 0.59.0", @@ -3179,14 +2951,14 @@ checksum = "aa5b600756534c7041aa93cd0d244d44b09fca1b89e202bd1cd80dd9f3636c46" dependencies = [ "bitflags 2.8.0", "bytemuck", - "calloop 0.14.3", + "calloop", "cursor-icon", "dpi", "libc", "percent-encoding", "raw-window-handle", "rustix 1.1.2", - "smol_str 0.3.4", + "smol_str", "tracing", "winit-common", "winit-core", diff --git a/platforms/windows/Cargo.toml b/platforms/windows/Cargo.toml index 554e4ca72..1422c104b 100644 --- a/platforms/windows/Cargo.toml +++ b/platforms/windows/Cargo.toml @@ -41,5 +41,5 @@ features = [ once_cell = "1.13.0" parking_lot = "0.12.4" scopeguard = "1.1.0" -winit = "0.30" +winit = "0.31.0-beta.2" From 4bc8872583a458094522a083d72c2b8a56454537 Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Fri, 2 Jan 2026 22:30:15 +0000 Subject: [PATCH 4/6] Upgrade accesskit_macos to objc2 v0.6 Signed-off-by: Nico Burns --- Cargo.lock | 95 ++++++++++++- platforms/macos/Cargo.toml | 6 +- platforms/macos/src/adapter.rs | 24 ++-- platforms/macos/src/context.rs | 15 ++- platforms/macos/src/event.rs | 6 +- platforms/macos/src/node.rs | 232 ++++++++++++++++---------------- platforms/macos/src/patch.rs | 20 ++- platforms/macos/src/subclass.rs | 56 ++++---- 8 files changed, 264 insertions(+), 190 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 891e5489e..437af377a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -79,9 +79,9 @@ dependencies = [ "accesskit", "accesskit_consumer", "hashbrown", - "objc2 0.5.2", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", + "objc2 0.6.3", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", ] [[package]] @@ -1187,10 +1187,10 @@ dependencies = [ "block2 0.5.1", "libc", "objc2 0.5.2", - "objc2-core-data", - "objc2-core-image", + "objc2-core-data 0.2.2", + "objc2-core-image 0.2.2", "objc2-foundation 0.2.2", - "objc2-quartz-core", + "objc2-quartz-core 0.2.2", ] [[package]] @@ -1200,8 +1200,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" dependencies = [ "bitflags 2.8.0", + "block2 0.6.2", + "libc", "objc2 0.6.3", + "objc2-cloud-kit", + "objc2-core-data 0.3.2", "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-image 0.3.2", + "objc2-core-text", + "objc2-core-video", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" +dependencies = [ + "bitflags 2.8.0", + "objc2 0.6.3", "objc2-foundation 0.3.2", ] @@ -1217,6 +1237,17 @@ dependencies = [ "objc2-foundation 0.2.2", ] +[[package]] +name = "objc2-core-data" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" +dependencies = [ + "bitflags 2.8.0", + "objc2 0.6.3", + "objc2-foundation 0.3.2", +] + [[package]] name = "objc2-core-foundation" version = "0.3.2" @@ -1236,8 +1267,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" dependencies = [ "bitflags 2.8.0", + "dispatch2", "libc", + "objc2 0.6.3", "objc2-core-foundation", + "objc2-io-surface", ] [[package]] @@ -1252,6 +1286,28 @@ dependencies = [ "objc2-metal", ] +[[package]] +name = "objc2-core-image" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" +dependencies = [ + "objc2 0.6.3", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags 2.8.0", + "objc2 0.6.3", + "objc2-core-foundation", + "objc2-core-graphics", +] + [[package]] name = "objc2-core-video" version = "0.3.2" @@ -1259,8 +1315,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6" dependencies = [ "bitflags 2.8.0", + "objc2 0.6.3", "objc2-core-foundation", "objc2-core-graphics", + "objc2-io-surface", ] [[package]] @@ -1290,6 +1348,18 @@ checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ "bitflags 2.8.0", "block2 0.6.2", + "libc", + "objc2 0.6.3", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.8.0", "objc2 0.6.3", "objc2-core-foundation", ] @@ -1319,6 +1389,17 @@ dependencies = [ "objc2-metal", ] +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.8.0", + "objc2 0.6.3", + "objc2-foundation 0.3.2", +] + [[package]] name = "objc2-ui-kit" version = "0.3.2" @@ -1893,7 +1974,7 @@ dependencies = [ "objc2 0.5.2", "objc2-app-kit 0.2.2", "objc2-foundation 0.2.2", - "objc2-quartz-core", + "objc2-quartz-core 0.2.2", "raw-window-handle", "redox_syscall 0.5.13", "rustix 0.38.44", diff --git a/platforms/macos/Cargo.toml b/platforms/macos/Cargo.toml index feb376d97..5e523d77f 100644 --- a/platforms/macos/Cargo.toml +++ b/platforms/macos/Cargo.toml @@ -18,14 +18,14 @@ default-target = "x86_64-apple-darwin" accesskit = { version = "0.22.0", path = "../../common" } accesskit_consumer = { version = "0.32.0", path = "../../consumer" } hashbrown.workspace = true -objc2 = "0.5.1" -objc2-foundation = { version = "0.2.0", features = [ +objc2 = "0.6.3" +objc2-foundation = { version = "0.3.0", features = [ "NSArray", "NSDictionary", "NSValue", "NSThread", ] } -objc2-app-kit = { version = "0.2.0", features = [ +objc2-app-kit = { version = "0.3.0", features = [ "NSAccessibility", "NSAccessibilityConstants", "NSAccessibilityElement", diff --git a/platforms/macos/src/adapter.rs b/platforms/macos/src/adapter.rs index 2de5dbafc..52297d365 100644 --- a/platforms/macos/src/adapter.rs +++ b/platforms/macos/src/adapter.rs @@ -15,7 +15,7 @@ use accesskit::{ Tree as TreeData, TreeUpdate, }; use accesskit_consumer::{FilterResult, Tree}; -use objc2::rc::{Id, WeakId}; +use objc2::rc::{Retained, Weak}; use objc2_app_kit::NSView; use objc2_foundation::{MainThreadMarker, NSArray, NSObject, NSPoint}; use std::fmt::{Debug, Formatter}; @@ -25,7 +25,7 @@ const PLACEHOLDER_ROOT_ID: NodeId = NodeId(0); enum State { Inactive { - view: WeakId, + view: Weak, is_view_focused: bool, action_handler: Rc, mtm: MainThreadMarker, @@ -91,8 +91,8 @@ impl Adapter { is_view_focused: bool, action_handler: impl 'static + ActionHandler, ) -> Self { - let view = unsafe { Id::retain(view as *mut NSView) }.unwrap(); - let view = WeakId::from_id(&view); + let view = unsafe { Retained::retain(view as *mut NSView) }.unwrap(); + let view = Weak::from_retained(&view); let mtm = MainThreadMarker::new().unwrap(); let state = State::Inactive { view, @@ -231,20 +231,20 @@ impl Adapter { let state = tree.state(); let node = state.root(); let platform_nodes = if filter(&node) == FilterResult::Include { - vec![Id::into_super(Id::into_super( + vec![Retained::into_super(Retained::into_super( context.get_or_create_platform_node(node.id()), ))] } else { node.filtered_children(filter) .map(|node| { - Id::into_super(Id::into_super( + Retained::into_super(Retained::into_super( context.get_or_create_platform_node(node.id()), )) }) - .collect::>>() + .collect::>>() }; - let array = NSArray::from_vec(platform_nodes); - Id::autorelease_return(array) + let array = NSArray::from_retained_slice(&platform_nodes); + Retained::autorelease_return(array) } pub fn focus( @@ -256,14 +256,14 @@ impl Adapter { let state = tree.state(); if let Some(node) = state.focus() { if can_be_focused(&node) { - return Id::autorelease_return(context.get_or_create_platform_node(node.id())) + return Retained::autorelease_return(context.get_or_create_platform_node(node.id())) as *mut _; } } null_mut() } - fn weak_view(&self) -> &WeakId { + fn weak_view(&self) -> &Weak { match &self.state { State::Inactive { view, .. } => view, State::Placeholder { @@ -292,6 +292,6 @@ impl Adapter { let root = state.root(); let point = from_ns_point(&view, &root, point); let node = root.node_at_point(point, &filter).unwrap_or(root); - Id::autorelease_return(context.get_or_create_platform_node(node.id())) as *mut _ + Retained::autorelease_return(context.get_or_create_platform_node(node.id())) as *mut _ } } diff --git a/platforms/macos/src/context.rs b/platforms/macos/src/context.rs index b3d51fa21..ee87a4ffc 100644 --- a/platforms/macos/src/context.rs +++ b/platforms/macos/src/context.rs @@ -7,7 +7,7 @@ use crate::node::PlatformNode; use accesskit::{ActionHandler, ActionRequest, NodeId}; use accesskit_consumer::Tree; use hashbrown::HashMap; -use objc2::rc::{Id, WeakId}; +use objc2::rc::{Retained, Weak}; use objc2_app_kit::*; use objc2_foundation::MainThreadMarker; use std::fmt::Debug; @@ -32,10 +32,10 @@ impl ActionHandlerNoMut for ActionHandlerWrapper { } pub(crate) struct Context { - pub(crate) view: WeakId, + pub(crate) view: Weak, pub(crate) tree: RefCell, pub(crate) action_handler: Rc, - platform_nodes: RefCell>>, + platform_nodes: RefCell>>, pub(crate) mtm: MainThreadMarker, } @@ -53,7 +53,7 @@ impl Debug for Context { impl Context { pub(crate) fn new( - view: WeakId, + view: Weak, tree: Tree, action_handler: Rc, mtm: MainThreadMarker, @@ -67,7 +67,10 @@ impl Context { }) } - pub(crate) fn get_or_create_platform_node(self: &Rc, id: NodeId) -> Id { + pub(crate) fn get_or_create_platform_node( + self: &Rc, + id: NodeId, + ) -> Retained { let mut platform_nodes = self.platform_nodes.borrow_mut(); if let Some(result) = platform_nodes.get(&id) { return result.clone(); @@ -78,7 +81,7 @@ impl Context { result } - pub(crate) fn remove_platform_node(&self, id: NodeId) -> Option> { + pub(crate) fn remove_platform_node(&self, id: NodeId) -> Option> { let mut platform_nodes = self.platform_nodes.borrow_mut(); platform_nodes.remove(&id) } diff --git a/platforms/macos/src/event.rs b/platforms/macos/src/event.rs index 6758b55e4..036cc50e5 100644 --- a/platforms/macos/src/event.rs +++ b/platforms/macos/src/event.rs @@ -36,9 +36,9 @@ impl QueuedEvent { Self::Announcement { text: node.value().unwrap(), priority: if node.live() == Live::Assertive { - NSAccessibilityPriorityLevel::NSAccessibilityPriorityHigh + NSAccessibilityPriorityLevel::High } else { - NSAccessibilityPriorityLevel::NSAccessibilityPriorityMedium + NSAccessibilityPriorityLevel::Medium }, } } @@ -77,7 +77,7 @@ impl QueuedEvent { } }; - let mut user_info = NSMutableDictionary::<_, AnyObject>::new(); + let user_info = NSMutableDictionary::<_, AnyObject>::new(); let text = NSString::from_str(&text); unsafe { user_info.setObject_forKey( diff --git a/platforms/macos/src/node.rs b/platforms/macos/src/node.rs index 095e85478..b60397cb3 100644 --- a/platforms/macos/src/node.rs +++ b/platforms/macos/src/node.rs @@ -15,11 +15,10 @@ use accesskit::{ }; use accesskit_consumer::{FilterResult, Node}; use objc2::{ - declare_class, msg_send_id, - mutability::InteriorMutable, - rc::Id, + define_class, msg_send, + rc::Retained, runtime::{AnyObject, Sel}, - sel, ClassType, DeclaredClass, + sel, ClassType, DeclaredClass, MainThreadMarker, MainThreadOnly, }; use objc2_app_kit::*; use objc2_foundation::{ @@ -357,81 +356,75 @@ impl NodeWrapper<'_> { // derived from objc2 0.6 `AnyObject::downcast_ref` // TODO: can be removed after updating objc2 to 0.6 which has `AnyObject::downcast_ref` fn downcast_ref(obj: &NSObject) -> Option<&T> { - obj.is_kind_of::() + obj.isKindOfClass(T::class()) .then(|| unsafe { &*(obj as *const NSObject).cast::() }) } +#[derive(Debug)] pub(crate) struct PlatformNodeIvars { context: Weak, node_id: NodeId, } -declare_class!( +define_class!( #[derive(Debug)] + #[unsafe(super(NSAccessibilityElement))] + #[thread_kind = MainThreadOnly] + #[ivars = PlatformNodeIvars] + #[name = "AccessKitSubclassAssociatedObject"] pub(crate) struct PlatformNode; - unsafe impl ClassType for PlatformNode { - #[inherits(NSObject)] - type Super = NSAccessibilityElement; - type Mutability = InteriorMutable; - const NAME: &'static str = "AccessKitNode"; - } - - impl DeclaredClass for PlatformNode { - type Ivars = PlatformNodeIvars; - } - - unsafe impl PlatformNode { - #[method_id(accessibilityParent)] - fn parent(&self) -> Option> { + impl PlatformNode { + #[unsafe(method_id(accessibilityParent))] + fn parent(&self) -> Option> { self.resolve_with_context(|node, context| { if let Some(parent) = node.filtered_parent(&filter) { - Some(Id::into_super(Id::into_super(Id::into_super(context.get_or_create_platform_node(parent.id()))))) + Some(Retained::into_super(Retained::into_super(Retained::into_super(context.get_or_create_platform_node(parent.id()))))) } else { context .view .load() - .and_then(|view| unsafe { NSAccessibility::accessibilityParent(&*view) }) + .and_then(|view| NSAccessibility::accessibilityParent(&*view)) } }) .flatten() } - #[method_id(accessibilityWindow)] - fn window(&self) -> Option> { + #[unsafe(method_id(accessibilityWindow))] + fn window(&self) -> Option> { self.resolve_with_context(|_, context| { context .view .load() - .and_then(|view| unsafe { NSAccessibility::accessibilityParent(&*view) }) + .and_then(|view| NSAccessibility::accessibilityParent(&*view)) }) .flatten() } - #[method_id(accessibilityTopLevelUIElement)] - fn top_level(&self) -> Option> { + #[unsafe(method_id(accessibilityTopLevelUIElement))] + fn top_level(&self) -> Option> { self.resolve_with_context(|_, context| { context .view .load() - .and_then(|view| unsafe { NSAccessibility::accessibilityParent(&*view) }) + .and_then(|view| NSAccessibility::accessibilityParent(&*view)) }) .flatten() } - #[method_id(accessibilityChildren)] - fn children(&self) -> Option>> { + #[unsafe(method_id(accessibilityChildren))] + fn children(&self) -> Option>> { self.children_internal() } - #[method_id(accessibilityChildrenInNavigationOrder)] - fn children_in_navigation_order(&self) -> Option>> { + #[unsafe(method_id(accessibilityChildrenInNavigationOrder))] + fn children_in_navigation_order(&self) -> Option>> { // For now, we assume the children are in navigation order. self.children_internal() } - #[method_id(accessibilitySelectedChildren)] - fn selected_children(&self) -> Option>> { + #[unsafe(method_id(accessibilitySelectedChildren))] + fn selected_children(&self) -> Option>> { self.resolve_with_context(|node, context| { let wrapper = NodeWrapper(node); if !wrapper.is_container_with_selectable_children() { @@ -441,13 +434,13 @@ declare_class!( .items(filter) .filter(|item| item.is_selected() == Some(true)) .map(|child| context.get_or_create_platform_node(child.id())) - .collect::>>(); - Some(NSArray::from_vec(platform_nodes)) + .collect::>>(); + Some(NSArray::from_retained_slice(&platform_nodes)) }) .flatten() } - #[method(accessibilityFrame)] + #[unsafe(method(accessibilityFrame))] fn frame(&self) -> NSRect { self.resolve_with_context(|node, context| { let view = match context.view.load() { @@ -460,7 +453,7 @@ declare_class!( node.bounding_box().map_or_else( || { if node.is_root() { - unsafe { NSAccessibility::accessibilityFrame(&*view) } + NSAccessibility::accessibilityFrame(&*view) } else { NSRect::ZERO } @@ -471,42 +464,42 @@ declare_class!( .unwrap_or(NSRect::ZERO) } - #[method_id(accessibilityRole)] - fn role(&self) -> Id { + #[unsafe(method_id(accessibilityRole))] + fn role(&self) -> Retained { self.resolve(ns_role) .unwrap_or(unsafe { NSAccessibilityUnknownRole }) .copy() } - #[method_id(accessibilitySubrole)] - fn sub_role(&self) -> Id { + #[unsafe(method_id(accessibilitySubrole))] + fn sub_role(&self) -> Retained { self.resolve(ns_sub_role) .unwrap_or(unsafe { NSAccessibilityUnknownSubrole }) .copy() } - #[method_id(accessibilityRoleDescription)] - fn role_description(&self) -> Option> { + #[unsafe(method_id(accessibilityRoleDescription))] + fn role_description(&self) -> Option> { self.resolve(|node| { if let Some(role_description) = node.role_description() { Some(NSString::from_str(role_description)) } else { - unsafe { msg_send_id![super(self), accessibilityRoleDescription] } + unsafe { msg_send![super(self), accessibilityRoleDescription] } } }) .flatten() } - #[method_id(accessibilityIdentifier)] - fn identifier(&self) -> Option> { + #[unsafe(method_id(accessibilityRetainedentifier))] + fn identifier(&self) -> Option> { self.resolve(|node| { node.author_id().map(NSString::from_str) }) .flatten() } - #[method_id(accessibilityTitle)] - fn title(&self) -> Option> { + #[unsafe(method_id(accessibilityTitle))] + fn title(&self) -> Option> { self.resolve(|node| { let wrapper = NodeWrapper(node); wrapper.title().map(|title| NSString::from_str(&title)) @@ -514,8 +507,8 @@ declare_class!( .flatten() } - #[method_id(accessibilityHelp)] - fn description(&self) -> Option> { + #[unsafe(method_id(accessibilityHelp))] + fn description(&self) -> Option> { self.resolve(|node| { let wrapper = NodeWrapper(node); wrapper.description().map(|description| NSString::from_str(&description)) @@ -523,8 +516,8 @@ declare_class!( .flatten() } - #[method_id(accessibilityPlaceholderValue)] - fn placeholder(&self) -> Option> { + #[unsafe(method_id(accessibilityPlaceholderValue))] + fn placeholder(&self) -> Option> { self.resolve(|node| { let wrapper = NodeWrapper(node); wrapper.placeholder().map(NSString::from_str) @@ -532,26 +525,26 @@ declare_class!( .flatten() } - #[method_id(accessibilityValue)] - fn value(&self) -> Option> { + #[unsafe(method_id(accessibilityValue))] + fn value(&self) -> Option> { self.resolve(|node| { let wrapper = NodeWrapper(node); wrapper.value().map(|value| match value { Value::Bool(value) => { - Id::into_super(Id::into_super(NSNumber::new_bool(value))) + Retained::into_super(Retained::into_super(NSNumber::new_bool(value))) } Value::Number(value) => { - Id::into_super(Id::into_super(NSNumber::new_f64(value))) + Retained::into_super(Retained::into_super(NSNumber::new_f64(value))) } Value::String(value) => { - Id::into_super(NSString::from_str(&value)) + Retained::into_super(NSString::from_str(&value)) } }) }) .flatten() } - #[method(setAccessibilityValue:)] + #[unsafe(method(setAccessibilityValue:))] fn set_value(&self, value: &NSObject) { if let Some(string) = downcast_ref::(value) { self.resolve_with_context(|node, context| { @@ -572,23 +565,23 @@ declare_class!( } } - #[method_id(accessibilityMinValue)] - fn min_value(&self) -> Option> { + #[unsafe(method_id(accessibilityMinValue))] + fn min_value(&self) -> Option> { self.resolve(|node| { node.min_numeric_value().map(NSNumber::new_f64) }) .flatten() } - #[method_id(accessibilityMaxValue)] - fn max_value(&self) -> Option> { + #[unsafe(method_id(accessibilityMaxValue))] + fn max_value(&self) -> Option> { self.resolve(|node| { node.max_numeric_value().map(NSNumber::new_f64) }) .flatten() } - #[method(accessibilityOrientation)] + #[unsafe(method(accessibilityOrientation))] fn orientation(&self) -> NSAccessibilityOrientation { self.resolve(|node| { match node.orientation() { @@ -600,24 +593,24 @@ declare_class!( .unwrap_or(NSAccessibilityOrientation::Unknown) } - #[method(isAccessibilityElement)] + #[unsafe(method(isAccessibilityElement))] fn is_accessibility_element(&self) -> bool { self.resolve(|node| filter(node) == FilterResult::Include) .unwrap_or(false) } - #[method(isAccessibilityFocused)] + #[unsafe(method(isAccessibilityFocused))] fn is_focused(&self) -> bool { self.resolve(|node| node.is_focused() && can_be_focused(node)) .unwrap_or(false) } - #[method(isAccessibilityEnabled)] + #[unsafe(method(isAccessibilityEnabled))] fn is_enabled(&self) -> bool { self.resolve(|node| !node.is_disabled()).unwrap_or(false) } - #[method(setAccessibilityFocused:)] + #[unsafe(method(setAccessibilityFocused:))] fn set_focused(&self, focused: bool) { self.resolve_with_context(|node, context| { if focused { @@ -641,7 +634,7 @@ declare_class!( }); } - #[method(accessibilityPerformPress)] + #[unsafe(method(accessibilityPerformPress))] fn press(&self) -> bool { self.resolve_with_context(|node, context| { let clickable = node.is_clickable(&filter); @@ -657,7 +650,7 @@ declare_class!( .unwrap_or(false) } - #[method(accessibilityPerformIncrement)] + #[unsafe(method(accessibilityPerformIncrement))] fn increment(&self) -> bool { self.resolve_with_context(|node, context| { let supports_increment = node.supports_increment(&filter); @@ -673,7 +666,7 @@ declare_class!( .unwrap_or(false) } - #[method(accessibilityPerformDecrement)] + #[unsafe(method(accessibilityPerformDecrement))] fn decrement(&self) -> bool { self.resolve_with_context(|node, context| { let supports_decrement = node.supports_decrement(&filter); @@ -689,12 +682,12 @@ declare_class!( .unwrap_or(false) } - #[method(accessibilityNotifiesWhenDestroyed)] + #[unsafe(method(accessibilityNotifiesWhenDestroyed))] fn notifies_when_destroyed(&self) -> bool { true } - #[method(accessibilityNumberOfCharacters)] + #[unsafe(method(accessibilityNumberOfCharacters))] fn number_of_characters(&self) -> NSInteger { self.resolve(|node| { if node.supports_text_ranges() { @@ -706,8 +699,8 @@ declare_class!( .unwrap_or(0) } - #[method_id(accessibilitySelectedText)] - fn selected_text(&self) -> Option> { + #[unsafe(method_id(accessibilitySelectedText))] + fn selected_text(&self) -> Option> { self.resolve(|node| { if node.supports_text_ranges() { if let Some(range) = node.text_selection() { @@ -720,7 +713,7 @@ declare_class!( .flatten() } - #[method(accessibilitySelectedTextRange)] + #[unsafe(method(accessibilitySelectedTextRange))] fn selected_text_range(&self) -> NSRange { self.resolve(|node| { if node.supports_text_ranges() { @@ -733,7 +726,7 @@ declare_class!( .unwrap_or_else(|| NSRange::new(0, 0)) } - #[method(accessibilityInsertionPointLineNumber)] + #[unsafe(method(accessibilityInsertionPointLineNumber))] fn insertion_point_line_number(&self) -> NSInteger { self.resolve(|node| { if node.supports_text_ranges() { @@ -746,7 +739,7 @@ declare_class!( .unwrap_or(0) } - #[method(accessibilityRangeForLine:)] + #[unsafe(method(accessibilityRangeForLine:))] fn range_for_line(&self, line_index: NSInteger) -> NSRange { self.resolve(|node| { if node.supports_text_ranges() && line_index >= 0 { @@ -759,7 +752,7 @@ declare_class!( .unwrap_or_else(|| NSRange::new(0, 0)) } - #[method(accessibilityRangeForPosition:)] + #[unsafe(method(accessibilityRangeForPosition:))] fn range_for_position(&self, point: NSPoint) -> NSRange { self.resolve_with_context(|node, context| { let view = match context.view.load() { @@ -779,8 +772,8 @@ declare_class!( .unwrap_or_else(|| NSRange::new(0, 0)) } - #[method_id(accessibilityStringForRange:)] - fn string_for_range(&self, range: NSRange) -> Option> { + #[unsafe(method_id(accessibilityStringForRange:))] + fn string_for_range(&self, range: NSRange) -> Option> { self.resolve(|node| { if node.supports_text_ranges() { if let Some(range) = from_ns_range(node, range) { @@ -793,7 +786,7 @@ declare_class!( .flatten() } - #[method(accessibilityFrameForRange:)] + #[unsafe(method(accessibilityFrameForRange:))] fn frame_for_range(&self, range: NSRange) -> NSRect { self.resolve_with_context(|node, context| { let view = match context.view.load() { @@ -818,7 +811,7 @@ declare_class!( .unwrap_or(NSRect::ZERO) } - #[method(accessibilityLineForIndex:)] + #[unsafe(method(accessibilityLineForIndex:))] fn line_for_index(&self, index: NSInteger) -> NSInteger { self.resolve(|node| { if node.supports_text_ranges() && index >= 0 { @@ -831,7 +824,7 @@ declare_class!( .unwrap_or(0) } - #[method(accessibilityRangeForIndex:)] + #[unsafe(method(accessibilityRangeForIndex:))] fn range_for_index(&self, index: NSInteger) -> NSRange { self.resolve(|node| { if node.supports_text_ranges() && index >= 0 { @@ -844,7 +837,7 @@ declare_class!( .unwrap_or_else(|| NSRange::new(0, 0)) } - #[method(setAccessibilitySelectedTextRange:)] + #[unsafe(method(setAccessibilitySelectedTextRange:))] fn set_selected_text_range(&self, range: NSRange) { self.resolve_with_context(|node, context| { if node.supports_text_ranges() { @@ -859,13 +852,13 @@ declare_class!( }); } - #[method(isAccessibilityRequired)] + #[unsafe(method(isAccessibilityRequired))] fn is_required(&self) -> bool { self.resolve(|node| node.is_required()) .unwrap_or(false) } - #[method(isAccessibilitySelected)] + #[unsafe(method(isAccessibilitySelected))] fn is_selected(&self) -> bool { self.resolve(|node| { let wrapper = NodeWrapper(node); @@ -876,7 +869,7 @@ declare_class!( .unwrap_or(false) } - #[method(setAccessibilitySelected:)] + #[unsafe(method(setAccessibilitySelected:))] fn set_selected(&self, selected: bool) { self.resolve_with_context(|node, context| { let wrapper = NodeWrapper(node); @@ -897,8 +890,8 @@ declare_class!( }); } - #[method_id(accessibilityAttributeValue:)] - fn accessibility_attribute_value(&self, attr: &NSString) -> Option> { + #[unsafe(method_id(accessibilityAttributeValue:))] + fn accessibility_attribute_value(&self, attr: &NSString) -> Option> { self.resolve(|node| { if attr == ns_string!("AXBrailleLabel") && node.has_braille_label() { return Some(NSString::from_str(node.braille_label().unwrap())) @@ -911,8 +904,8 @@ declare_class!( .flatten() } - #[method_id(accessibilityRows)] - fn rows(&self) -> Option>> { + #[unsafe(method_id(accessibilityRows))] + fn rows(&self) -> Option>> { self.resolve_with_context(|node, context| { let wrapper = NodeWrapper(node); if !wrapper.is_container_with_selectable_children() { @@ -921,14 +914,14 @@ declare_class!( let platform_nodes = node .items(filter) .map(|child| context.get_or_create_platform_node(child.id())) - .collect::>>(); - Some(NSArray::from_vec(platform_nodes)) + .collect::>>(); + Some(NSArray::from_retained_slice(&platform_nodes)) }) .flatten() } - #[method_id(accessibilitySelectedRows)] - fn selected_rows(&self) -> Option>> { + #[unsafe(method_id(accessibilitySelectedRows))] + fn selected_rows(&self) -> Option>> { self.resolve_with_context(|node, context| { let wrapper = NodeWrapper(node); if !wrapper.is_container_with_selectable_children() { @@ -938,13 +931,13 @@ declare_class!( .items(filter) .filter(|item| item.is_selected() == Some(true)) .map(|child| context.get_or_create_platform_node(child.id())) - .collect::>>(); - Some(NSArray::from_vec(platform_nodes)) + .collect::>>(); + Some(NSArray::from_retained_slice(&platform_nodes)) }) .flatten() } - #[method(accessibilityPerformPick)] + #[unsafe(method(accessibilityPerformPick))] fn pick(&self) -> bool { self.resolve_with_context(|node, context| { let wrapper = NodeWrapper(node); @@ -963,10 +956,10 @@ declare_class!( .unwrap_or(false) } - #[method_id(accessibilityLinkedUIElements)] - fn linked_ui_elements(&self) -> Option>> { + #[unsafe(method_id(accessibilityLinkedUIElements))] + fn linked_ui_elements(&self) -> Option>> { self.resolve_with_context(|node, context| { - let platform_nodes: Vec> = node + let platform_nodes: Vec> = node .controls() .filter(|controlled| filter(controlled) == FilterResult::Include) .map(|controlled| context.get_or_create_platform_node(controlled.id())) @@ -974,14 +967,14 @@ declare_class!( if platform_nodes.is_empty() { None } else { - Some(NSArray::from_vec(platform_nodes)) + Some(NSArray::from_retained_slice(&platform_nodes)) } }) .flatten() } - #[method_id(accessibilityTabs)] - fn tabs(&self) -> Option>> { + #[unsafe(method_id(accessibilityTabs))] + fn tabs(&self) -> Option>> { self.resolve_with_context(|node, context| { if node.role() != Role::TabList { return None; @@ -990,13 +983,13 @@ declare_class!( .filtered_children(filter) .filter(|child| child.role() == Role::Tab) .map(|tab| context.get_or_create_platform_node(tab.id())) - .collect::>>(); - Some(NSArray::from_vec(platform_nodes)) + .collect::>>(); + Some(NSArray::from_retained_slice(&platform_nodes)) }) .flatten() } - #[method(isAccessibilityModal)] + #[unsafe(method(isAccessibilityModal))] fn is_modal(&self) -> bool { self.resolve(|node| node.is_modal()) .unwrap_or(false) @@ -1009,18 +1002,18 @@ declare_class!( // of the legacy methods below only needs to cover actions not already // handled by the newer methods. - #[method_id(accessibilityActionNames)] - fn action_names(&self) -> Id> { + #[unsafe(method_id(accessibilityActionNames))] + fn action_names(&self) -> Retained> { let mut result = vec![]; self.resolve(|node| { if node.supports_action(Action::ScrollIntoView, &filter) { result.push(ns_string!(SCROLL_TO_VISIBLE_ACTION).copy()); } }); - NSArray::from_vec(result) + NSArray::from_retained_slice(&result) } - #[method(accessibilityPerformAction:)] + #[unsafe(method(accessibilityPerformAction:))] fn perform_action(&self, action: &NSString) { self.resolve_with_context(|node, context| { if action == ns_string!(SCROLL_TO_VISIBLE_ACTION) { @@ -1033,7 +1026,7 @@ declare_class!( }); } - #[method(isAccessibilitySelectorAllowed:)] + #[unsafe(method(isAccessibilitySelectorAllowed:))] fn is_selector_allowed(&self, selector: Sel) -> bool { self.resolve(|node| { if selector == sel!(setAccessibilityFocused:) { @@ -1126,10 +1119,11 @@ declare_class!( ); impl PlatformNode { - pub(crate) fn new(context: Weak, node_id: NodeId) -> Id { - let this = Self::alloc().set_ivars(PlatformNodeIvars { context, node_id }); + pub(crate) fn new(context: Weak, node_id: NodeId) -> Retained { + let mtm = MainThreadMarker::new().expect("must be on the main thread"); + let this = Self::alloc(mtm).set_ivars(PlatformNodeIvars { context, node_id }); - unsafe { msg_send_id![super(this), init] } + unsafe { msg_send![super(this), init] } } fn resolve_with_context(&self, f: F) -> Option @@ -1150,13 +1144,13 @@ impl PlatformNode { self.resolve_with_context(|node, _| f(node)) } - fn children_internal(&self) -> Option>> { + fn children_internal(&self) -> Option>> { self.resolve_with_context(|node, context| { let platform_nodes = node .filtered_children(filter) .map(|child| context.get_or_create_platform_node(child.id())) - .collect::>>(); - NSArray::from_vec(platform_nodes) + .collect::>>(); + NSArray::from_retained_slice(&platform_nodes) }) } } diff --git a/platforms/macos/src/patch.rs b/platforms/macos/src/patch.rs index 68ada2a49..cedcd372d 100644 --- a/platforms/macos/src/patch.rs +++ b/platforms/macos/src/patch.rs @@ -7,11 +7,14 @@ use objc2::{ encode::{Encode, EncodeArguments, EncodeReturn, Encoding}, ffi::class_addMethod, msg_send, - runtime::{AnyClass, AnyObject, Bool, MethodImplementation, Sel}, + runtime::{AnyClass, AnyObject, MethodImplementation, Sel}, sel, Message, }; use objc2_app_kit::NSWindow; -use std::{ffi::CString, ptr::null_mut}; +use std::{ + ffi::{CStr, CString}, + ptr::null_mut, +}; extern "C" fn focus_forwarder(this: &NSWindow, _cmd: Sel) -> *mut AnyObject { unsafe { @@ -35,7 +38,7 @@ extern "C" fn focus_forwarder(this: &NSWindow, _cmd: Sel) -> *mut AnyObject { /// if this crate is statically linked into the application's main executable. /// Also, this function assumes that the specified class is a subclass /// of `NSWindow`. -pub unsafe fn add_focus_forwarder_to_window_class(class_name: &str) { +pub unsafe fn add_focus_forwarder_to_window_class(class_name: &CStr) { let class = AnyClass::get(class_name).unwrap(); unsafe { add_method( @@ -66,19 +69,12 @@ where ); let types = method_type_encoding(&F::Return::ENCODING_RETURN, encs); - let success = Bool::from_raw(unsafe { - class_addMethod( - class as *mut _, - sel.as_ptr(), - Some(func.__imp()), - types.as_ptr(), - ) - }); + let success = unsafe { class_addMethod(class as *mut _, sel, func.__imp(), types.as_ptr()) }; assert!(success.as_bool(), "Failed to add method {sel:?}"); } fn count_args(sel: Sel) -> usize { - sel.name().chars().filter(|&c| c == ':').count() + sel.name().to_bytes().iter().filter(|&&c| c == b':').count() } fn method_type_encoding(ret: &Encoding, args: &[Encoding]) -> CString { diff --git a/platforms/macos/src/subclass.rs b/platforms/macos/src/subclass.rs index 9d5b194fb..52b07ab4d 100644 --- a/platforms/macos/src/subclass.rs +++ b/platforms/macos/src/subclass.rs @@ -6,20 +6,23 @@ use accesskit::{ActionHandler, ActivationHandler, TreeUpdate}; use objc2::{ declare::ClassBuilder, - declare_class, + define_class, ffi::{ objc_getAssociatedObject, objc_setAssociatedObject, object_setClass, OBJC_ASSOCIATION_RETAIN_NONATOMIC, }, - msg_send_id, - mutability::InteriorMutable, - rc::Id, + msg_send, + rc::Retained, runtime::{AnyClass, Sel}, - sel, ClassType, DeclaredClass, + sel, AnyThread, DeclaredClass, }; use objc2_app_kit::{NSView, NSWindow}; use objc2_foundation::{NSArray, NSObject, NSPoint}; -use std::{cell::RefCell, ffi::c_void, sync::Mutex}; +use std::{ + cell::RefCell, + ffi::{c_void, CStr}, + sync::Mutex, +}; use crate::{event::QueuedEvents, Adapter}; @@ -41,18 +44,11 @@ struct AssociatedObjectIvars { prev_class: &'static AnyClass, } -declare_class!( +define_class!( + #[unsafe(super(NSObject))] + #[ivars = AssociatedObjectIvars] + #[name = "AccessKitSubclassAssociatedObject"] struct AssociatedObject; - - unsafe impl ClassType for AssociatedObject { - type Super = NSObject; - type Mutability = InteriorMutable; - const NAME: &'static str = "AccessKitSubclassAssociatedObject"; - } - - impl DeclaredClass for AssociatedObject { - type Ivars = AssociatedObjectIvars; - } ); impl AssociatedObject { @@ -60,14 +56,14 @@ impl AssociatedObject { adapter: Adapter, activation_handler: impl 'static + ActivationHandler, prev_class: &'static AnyClass, - ) -> Id { + ) -> Retained { let state = RefCell::new(AssociatedObjectState { adapter, activation_handler: Box::new(activation_handler), }); let this = Self::alloc().set_ivars(AssociatedObjectIvars { state, prev_class }); - unsafe { msg_send_id![super(this), init] } + unsafe { msg_send![super(this), init] } } } @@ -116,8 +112,8 @@ unsafe extern "C" fn hit_test(this: &NSView, _cmd: Sel, point: NSPoint) -> *mut /// Uses dynamic Objective-C subclassing to implement the `NSView` /// accessibility methods when normal subclassing isn't an option. pub struct SubclassingAdapter { - view: Id, - associated: Id, + view: Retained, + associated: Retained, } impl SubclassingAdapter { @@ -136,16 +132,16 @@ impl SubclassingAdapter { action_handler: impl 'static + ActionHandler, ) -> Self { let view = view as *mut NSView; - let retained_view = unsafe { Id::retain(view) }.unwrap(); + let retained_view = unsafe { Retained::retain(view) }.unwrap(); Self::new_internal(retained_view, activation_handler, action_handler) } fn new_internal( - retained_view: Id, + retained_view: Retained, activation_handler: impl 'static + ActivationHandler, action_handler: impl 'static + ActionHandler, ) -> Self { - let view = Id::as_ptr(&retained_view) as *mut NSView; + let view = Retained::as_ptr(&retained_view) as *mut NSView; if !unsafe { objc_getAssociatedObject(view as *const NSView as *const _, associated_object_key()) } @@ -163,7 +159,7 @@ impl SubclassingAdapter { objc_setAssociatedObject( view as *mut _, associated_object_key(), - Id::as_ptr(&associated) as *mut _, + Retained::as_ptr(&associated) as *mut _, OBJC_ASSOCIATION_RETAIN_NONATOMIC, ) }; @@ -171,8 +167,12 @@ impl SubclassingAdapter { let subclass = match subclasses.iter().find(|entry| entry.0 == prev_class) { Some(entry) => entry.1, None => { - let name = format!("AccessKitSubclassOf{}", prev_class.name()); - let mut builder = ClassBuilder::new(&name, prev_class).unwrap(); + let name = format!( + "AccessKitSubclassOf{}\0", + prev_class.name().to_str().unwrap() + ); + let name = CStr::from_bytes_until_nul(name.as_bytes()).unwrap(); + let mut builder = ClassBuilder::new(name, prev_class).unwrap(); unsafe { builder.add_method( sel!(superclass), @@ -258,7 +258,7 @@ impl SubclassingAdapter { impl Drop for SubclassingAdapter { fn drop(&mut self) { let prev_class = self.associated.ivars().prev_class; - let view = Id::as_ptr(&self.view) as *mut NSView; + let view = Retained::as_ptr(&self.view) as *mut NSView; unsafe { object_setClass(view as *mut _, (prev_class as *const AnyClass).cast()) }; unsafe { objc_setAssociatedObject( From c41a7e0b5dcd26bf8b7d7796342f6876bf42c69c Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Fri, 2 Jan 2026 22:30:35 +0000 Subject: [PATCH 5/6] Clippy: use is_none_or function Signed-off-by: Nico Burns --- consumer/src/node.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/consumer/src/node.rs b/consumer/src/node.rs index 552109996..1584173de 100644 --- a/consumer/src/node.rs +++ b/consumer/src/node.rs @@ -701,7 +701,7 @@ impl<'a> Node<'a> { first_text_run .data() .value() - .map_or(true, |value| value.is_empty()) + .is_none_or(|value| value.is_empty()) && text_runs.next().is_none() } else { true From d412e839c0e227e6088bbf6c56e13b9ab7af2efd Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Fri, 2 Jan 2026 22:56:00 +0000 Subject: [PATCH 6/6] Fix winit simple example Signed-off-by: Nico Burns --- platforms/winit/examples/simple.rs | 100 ++++++++++++++------------ platforms/winit/examples/util/fill.rs | 26 +++---- platforms/winit/src/lib.rs | 6 +- 3 files changed, 74 insertions(+), 58 deletions(-) diff --git a/platforms/winit/examples/simple.rs b/platforms/winit/examples/simple.rs index f4ab4a63e..cadc40d17 100644 --- a/platforms/winit/examples/simple.rs +++ b/platforms/winit/examples/simple.rs @@ -2,14 +2,17 @@ mod fill; use accesskit::{Action, ActionRequest, Live, Node, NodeId, Rect, Role, Tree, TreeUpdate}; -use accesskit_winit::{Adapter, Event as AccessKitEvent, WindowEvent as AccessKitWindowEvent}; -use std::error::Error; +use accesskit_winit::{WindowEvent as AccessKitWindowEvent, WinitAdapter}; +use std::{ + error::Error, + sync::mpsc::{channel, Receiver, Sender}, +}; use winit::{ application::ApplicationHandler, event::{ElementState, KeyEvent, WindowEvent}, - event_loop::{ActiveEventLoop, EventLoop, EventLoopProxy}, + event_loop::{ActiveEventLoop, EventLoop}, keyboard::Key, - window::{Window, WindowId}, + window::{Window, WindowAttributes, WindowId}, }; const WINDOW_TITLE: &str = "Hello world"; @@ -101,7 +104,7 @@ impl UiState { result } - fn set_focus(&mut self, adapter: &mut Adapter, focus: NodeId) { + fn set_focus(&mut self, adapter: &mut WinitAdapter, focus: NodeId) { self.focus = focus; adapter.update_if_active(|| TreeUpdate { nodes: vec![], @@ -110,7 +113,7 @@ impl UiState { }); } - fn press_button(&mut self, adapter: &mut Adapter, id: NodeId) { + fn press_button(&mut self, adapter: &mut WinitAdapter, id: NodeId) { let text = if id == BUTTON_1_ID { "You pressed button 1" } else { @@ -130,13 +133,13 @@ impl UiState { } struct WindowState { - window: Window, - adapter: Adapter, + window: Box, + adapter: WinitAdapter, ui: UiState, } impl WindowState { - fn new(window: Window, adapter: Adapter, ui: UiState) -> Self { + fn new(window: Box, adapter: WinitAdapter, ui: UiState) -> Self { Self { window, adapter, @@ -146,26 +149,33 @@ impl WindowState { } struct Application { - event_loop_proxy: EventLoopProxy, window: Option, + event_recv: Receiver, + event_sender: Sender, } impl Application { - fn new(event_loop_proxy: EventLoopProxy) -> Self { + fn new() -> Self { + let (event_sender, event_recv) = channel(); Self { - event_loop_proxy, window: None, + event_sender, + event_recv, } } - fn create_window(&mut self, event_loop: &ActiveEventLoop) -> Result<(), Box> { - let window_attributes = Window::default_attributes() + fn create_window(&mut self, event_loop: &dyn ActiveEventLoop) -> Result<(), Box> { + let window_attributes = WindowAttributes::default() .with_title(WINDOW_TITLE) .with_visible(false); let window = event_loop.create_window(window_attributes)?; - let adapter = - Adapter::with_event_loop_proxy(event_loop, &window, self.event_loop_proxy.clone()); + let proxy = event_loop.create_proxy(); + let sender = self.event_sender.clone(); + let adapter = WinitAdapter::new(event_loop, &*window, move |_window_id, evt| { + sender.send(evt).unwrap(); + proxy.wake_up(); + }); window.set_visible(true); self.window = Some(WindowState::new(window, adapter, UiState::new())); @@ -173,8 +183,8 @@ impl Application { } } -impl ApplicationHandler for Application { - fn window_event(&mut self, _: &ActiveEventLoop, _: WindowId, event: WindowEvent) { +impl ApplicationHandler for Application { + fn window_event(&mut self, _: &dyn ActiveEventLoop, _: WindowId, event: WindowEvent) { let window = match &mut self.window { Some(window) => window, None => return, @@ -182,17 +192,17 @@ impl ApplicationHandler for Application { let adapter = &mut window.adapter; let state = &mut window.ui; - adapter.process_event(&window.window, &event); + adapter.process_event(&*window.window, &event); match event { WindowEvent::CloseRequested => { - fill::cleanup_window(&window.window); + fill::cleanup_window(&*window.window); self.window = None; } - WindowEvent::Resized(_) => { + WindowEvent::SurfaceResized(_) => { window.window.request_redraw(); } WindowEvent::RedrawRequested => { - fill::fill_window(&window.window); + fill::fill_window(&*window.window); } WindowEvent::KeyboardInput { event: @@ -212,7 +222,7 @@ impl ApplicationHandler for Application { state.set_focus(adapter, new_focus); window.window.request_redraw(); } - Key::Named(winit::keyboard::NamedKey::Space) => { + Key::Character(c) if c == " " => { let id = state.focus; state.press_button(adapter, id); window.window.request_redraw(); @@ -223,7 +233,7 @@ impl ApplicationHandler for Application { } } - fn user_event(&mut self, _: &ActiveEventLoop, user_event: AccessKitEvent) { + fn proxy_wake_up(&mut self, _: &dyn ActiveEventLoop) { let window = match &mut self.window { Some(window) => window, None => return, @@ -231,29 +241,31 @@ impl ApplicationHandler for Application { let adapter = &mut window.adapter; let state = &mut window.ui; - match user_event.window_event { - AccessKitWindowEvent::InitialTreeRequested => { - adapter.update_if_active(|| state.build_initial_tree()); - } - AccessKitWindowEvent::ActionRequested(ActionRequest { action, target, .. }) => { - if target == BUTTON_1_ID || target == BUTTON_2_ID { - match action { - Action::Focus => { - state.set_focus(adapter, target); - } - Action::Click => { - state.press_button(adapter, target); + for accesskit_event in self.event_recv.try_iter() { + match accesskit_event { + AccessKitWindowEvent::InitialTreeRequested => { + adapter.update_if_active(|| state.build_initial_tree()); + } + AccessKitWindowEvent::ActionRequested(ActionRequest { action, target, .. }) => { + if target == BUTTON_1_ID || target == BUTTON_2_ID { + match action { + Action::Focus => { + state.set_focus(adapter, target); + } + Action::Click => { + state.press_button(adapter, target); + } + _ => (), } - _ => (), } + window.window.request_redraw(); } - window.window.request_redraw(); + AccessKitWindowEvent::AccessibilityDeactivated => (), } - AccessKitWindowEvent::AccessibilityDeactivated => (), } } - fn resumed(&mut self, event_loop: &ActiveEventLoop) { + fn can_create_surfaces(&mut self, event_loop: &dyn ActiveEventLoop) { self.create_window(event_loop) .expect("failed to create initial window"); if let Some(window) = self.window.as_ref() { @@ -261,7 +273,7 @@ impl ApplicationHandler for Application { } } - fn about_to_wait(&mut self, event_loop: &ActiveEventLoop) { + fn about_to_wait(&mut self, event_loop: &dyn ActiveEventLoop) { if self.window.is_none() { event_loop.exit(); } @@ -286,7 +298,7 @@ fn main() -> Result<(), Box> { ))] println!("Enable Orca with [Super]+[Alt]+[S]."); - let event_loop = EventLoop::with_user_event().build()?; - let mut state = Application::new(event_loop.create_proxy()); - event_loop.run_app(&mut state).map_err(Into::into) + let event_loop = EventLoop::new()?; + let app = Application::new(); + event_loop.run_app(app).map_err(Into::into) } diff --git a/platforms/winit/examples/util/fill.rs b/platforms/winit/examples/util/fill.rs index 27625e2e9..8d62554bf 100644 --- a/platforms/winit/examples/util/fill.rs +++ b/platforms/winit/examples/util/fill.rs @@ -35,18 +35,20 @@ mod platform { /// The graphics context used to draw to a window. struct GraphicsContext { /// The global softbuffer context. - context: RefCell>, + context: RefCell>, /// The hash map of window IDs to surfaces. - surfaces: HashMap>, + surfaces: HashMap>, } impl GraphicsContext { - fn new(w: &Window) -> Self { + fn new(w: &dyn Window) -> Self { Self { context: RefCell::new( - Context::new(unsafe { mem::transmute::<&'_ Window, &'static Window>(w) }) - .expect("Failed to create a softbuffer context"), + Context::new(unsafe { + mem::transmute::<&'_ dyn Window, &'static dyn Window>(w) + }) + .expect("Failed to create a softbuffer context"), ), surfaces: HashMap::new(), } @@ -54,24 +56,24 @@ mod platform { fn create_surface( &mut self, - window: &Window, - ) -> &mut Surface<&'static Window, &'static Window> { + window: &dyn Window, + ) -> &mut Surface<&'static dyn Window, &'static dyn Window> { self.surfaces.entry(window.id()).or_insert_with(|| { Surface::new(&self.context.borrow(), unsafe { - mem::transmute::<&'_ Window, &'static Window>(window) + mem::transmute::<&'_ dyn Window, &'static dyn Window>(window) }) .expect("Failed to create a softbuffer surface") }) } - fn destroy_surface(&mut self, window: &Window) { + fn destroy_surface(&mut self, window: &dyn Window) { self.surfaces.remove(&window.id()); } } - pub fn fill_window(window: &Window) { + pub fn fill_window(window: &dyn Window) { GC.with(|gc| { - let size = window.inner_size(); + let size = window.surface_size(); let (Some(width), Some(height)) = (NonZeroU32::new(size.width), NonZeroU32::new(size.height)) else { @@ -101,7 +103,7 @@ mod platform { }) } - pub fn cleanup_window(window: &Window) { + pub fn cleanup_window(window: &dyn Window) { GC.with(|gc| { let mut gc = gc.borrow_mut(); if let Some(context) = gc.as_mut() { diff --git a/platforms/winit/src/lib.rs b/platforms/winit/src/lib.rs index 29ee4f392..fcbe9053e 100644 --- a/platforms/winit/src/lib.rs +++ b/platforms/winit/src/lib.rs @@ -5,7 +5,7 @@ use accesskit::{ ActionHandler, ActionRequest, ActivationHandler, DeactivationHandler, Rect, TreeUpdate, }; -use accesskit_adapter::{Adapter, WindowEvent}; +use accesskit_adapter::Adapter; use raw_window_handle::HasWindowHandle as _; use std::sync::Arc; use winit_core::event_loop::ActiveEventLoop; @@ -14,6 +14,8 @@ use winit_core::{ window::{Window, WindowId}, }; +pub use accesskit_adapter::WindowEvent; + #[cfg(target_os = "android")] use winit_android::EventLoopExtAndroid as _; @@ -68,7 +70,7 @@ impl WinitAdapter { /// # Panics /// /// Panics if the window is already visible. - pub fn with_event_loop_proxy + Send + 'static>( + pub fn new( event_loop: &dyn ActiveEventLoop, window: &dyn Window, callback: impl Fn(WindowId, WindowEvent) + Send + Sync + 'static,