Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

View File

@@ -0,0 +1 @@
{"files":{"CHANGELOG.md":"77234283e3c4d17a477b0b4fc38cbd70510dac428f85e6caf306625a1a614352","Cargo.lock":"4b03840434ab5d299db2bacd749017d746fd3e95dbf519ff66c9e83d05f804a2","Cargo.toml":"0e12e6d29c4325bb28190a2f413c3d3e1179d5b0984b3bbeb34949e65701842c","README.md":"94659613e5f5b01f3e6e6823ad4355191172884a04c35b460816c347eb90a15b","examples/mixed_handlers.rs":"38c08816a898f72998ad1d54997d0cd707c87072e5238519983b3341781df075","examples/simple.rs":"0f18cc7c52db0dae613cc2490f87ae75f6daf133a433c3e337156229224fc4c3","src/lib.rs":"e0b0188b5117f5a58688ec6886167698600266a2f60657db57f21d8ca3e0dbd1","src/platform_impl/android.rs":"060bbccd16d492ed58d75e47a24d77bf04b9cf497864145de6de93edce9759dc","src/platform_impl/macos.rs":"9bb36fff123be11afadc7a7f8c09d2b8d04d3f091ad3f6bf23bec55ff933ebf1","src/platform_impl/mod.rs":"7bd9ce32dbdd50903add37e53af398d876d6d570f8b563aaeb57f2b728031aa7","src/platform_impl/null.rs":"0bad7fd53d810d9076ef1cc6feef3e1e68930c26a0677a4fdb38ce36c8658c96","src/platform_impl/unix.rs":"116c505a50fc7ba3c6eb9bc17d6c6dd6065082a8bc246e8889199d4153d1ece3","src/platform_impl/windows.rs":"7222ee5c2c519e5f1a195d9724f720ebf84fa6b6ac11547370f2fb66ec98417b"},"package":"34d941bb8c414caba6e206de669c7dc0dbeb305640ea890772ee422a40e6b89f"}

767
vendor/accesskit_winit/CHANGELOG.md vendored Normal file
View File

@@ -0,0 +1,767 @@
# 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.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

2652
vendor/accesskit_winit/Cargo.lock generated vendored Normal file

File diff suppressed because it is too large Load Diff

110
vendor/accesskit_winit/Cargo.toml vendored Normal file
View File

@@ -0,0 +1,110 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2021"
rust-version = "1.77.2"
name = "accesskit_winit"
version = "0.25.0"
authors = ["The AccessKit contributors"]
build = false
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "AccessKit UI accessibility infrastructure: winit adapter"
readme = "README.md"
keywords = [
"gui",
"ui",
"accessibility",
"winit",
]
categories = ["gui"]
license = "Apache-2.0"
repository = "https://github.com/AccessKit/accesskit"
[features]
async-io = ["accesskit_unix/async-io"]
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",
]
tokio = ["accesskit_unix/tokio"]
[lib]
name = "accesskit_winit"
path = "src/lib.rs"
[[example]]
name = "mixed_handlers"
path = "examples/mixed_handlers.rs"
[[example]]
name = "simple"
path = "examples/simple.rs"
[dependencies.accesskit]
version = "0.18.0"
[dependencies.rwh_05]
version = "0.5"
features = ["std"]
optional = true
package = "raw-window-handle"
[dependencies.rwh_06]
version = "0.6.2"
features = ["std"]
optional = true
package = "raw-window-handle"
[dependencies.winit]
version = "0.30.5"
default-features = false
[dev-dependencies.winit]
version = "0.30.5"
features = [
"x11",
"wayland",
"wayland-dlopen",
"wayland-csd-adwaita",
]
default-features = false
[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd"))'.dependencies.accesskit_unix]
version = "0.14.0"
optional = true
default-features = false
[target.'cfg(target_os = "android")'.dependencies.accesskit_android]
version = "0.1.0"
features = ["embedded-dex"]
optional = true
[target.'cfg(target_os = "macos")'.dependencies.accesskit_macos]
version = "0.19.0"
[target.'cfg(target_os = "windows")'.dependencies.accesskit_windows]
version = "0.25.0"

16
vendor/accesskit_winit/README.md vendored Normal file
View File

@@ -0,0 +1,16 @@
# AccessKit winit adapter
This is the winit adapter for [AccessKit](https://accesskit.dev/). It exposes an AccessKit accessibility tree through the platform-native accessibility API on any platform supported by AccessKit. On platforms not supported by AccessKit, this adapter does nothing, but still compiles.
## 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.
## Android activity compatibility
The Android implementation of this adapter currently only works with [GameActivity](https://developer.android.com/games/agdk/game-activity), which is one of the two activity implementations that winit currently supports.

View File

@@ -0,0 +1,300 @@
use accesskit::{
Action, ActionRequest, ActivationHandler, Live, Node, NodeId, Rect, Role, Tree, TreeUpdate,
};
use accesskit_winit::{Adapter, Event as AccessKitEvent, WindowEvent as AccessKitWindowEvent};
use std::{
error::Error,
sync::{Arc, Mutex},
};
use winit::{
application::ApplicationHandler,
event::{ElementState, KeyEvent, WindowEvent},
event_loop::{ActiveEventLoop, EventLoop, EventLoopProxy},
keyboard::Key,
window::{Window, WindowId},
};
const WINDOW_TITLE: &str = "Hello world";
const WINDOW_ID: NodeId = NodeId(0);
const BUTTON_1_ID: NodeId = NodeId(1);
const BUTTON_2_ID: NodeId = NodeId(2);
const ANNOUNCEMENT_ID: NodeId = NodeId(3);
const INITIAL_FOCUS: NodeId = BUTTON_1_ID;
const BUTTON_1_RECT: Rect = Rect {
x0: 20.0,
y0: 20.0,
x1: 100.0,
y1: 60.0,
};
const BUTTON_2_RECT: Rect = Rect {
x0: 20.0,
y0: 60.0,
x1: 100.0,
y1: 100.0,
};
fn build_button(id: NodeId, label: &str) -> Node {
let rect = match id {
BUTTON_1_ID => BUTTON_1_RECT,
BUTTON_2_ID => BUTTON_2_RECT,
_ => unreachable!(),
};
let mut node = Node::new(Role::Button);
node.set_bounds(rect);
node.set_label(label);
node.add_action(Action::Focus);
node.add_action(Action::Click);
node
}
fn build_announcement(text: &str) -> Node {
let mut node = Node::new(Role::Label);
node.set_value(text);
node.set_live(Live::Polite);
node
}
struct UiState {
focus: NodeId,
announcement: Option<String>,
}
impl UiState {
fn new() -> Arc<Mutex<Self>> {
Arc::new(Mutex::new(Self {
focus: INITIAL_FOCUS,
announcement: None,
}))
}
fn build_root(&mut self) -> Node {
let mut node = Node::new(Role::Window);
node.set_children(vec![BUTTON_1_ID, BUTTON_2_ID]);
if self.announcement.is_some() {
node.push_child(ANNOUNCEMENT_ID);
}
node.set_label(WINDOW_TITLE);
node
}
fn build_initial_tree(&mut self) -> TreeUpdate {
let root = self.build_root();
let button_1 = build_button(BUTTON_1_ID, "Button 1");
let button_2 = build_button(BUTTON_2_ID, "Button 2");
let tree = Tree::new(WINDOW_ID);
let mut result = TreeUpdate {
nodes: vec![
(WINDOW_ID, root),
(BUTTON_1_ID, button_1),
(BUTTON_2_ID, button_2),
],
tree: Some(tree),
focus: self.focus,
};
if let Some(announcement) = &self.announcement {
result
.nodes
.push((ANNOUNCEMENT_ID, build_announcement(announcement)));
}
result
}
fn set_focus(&mut self, adapter: &mut Adapter, focus: NodeId) {
self.focus = focus;
adapter.update_if_active(|| TreeUpdate {
nodes: vec![],
tree: None,
focus,
});
}
fn press_button(&mut self, adapter: &mut Adapter, id: NodeId) {
let text = if id == BUTTON_1_ID {
"You pressed button 1"
} else {
"You pressed button 2"
};
self.announcement = Some(text.into());
adapter.update_if_active(|| {
let announcement = build_announcement(text);
let root = self.build_root();
TreeUpdate {
nodes: vec![(ANNOUNCEMENT_ID, announcement), (WINDOW_ID, root)],
tree: None,
focus: self.focus,
}
});
}
}
struct TearoffActivationHandler {
state: Arc<Mutex<UiState>>,
}
impl ActivationHandler for TearoffActivationHandler {
fn request_initial_tree(&mut self) -> Option<TreeUpdate> {
Some(self.state.lock().unwrap().build_initial_tree())
}
}
struct WindowState {
window: Window,
adapter: Adapter,
ui: Arc<Mutex<UiState>>,
}
impl WindowState {
fn new(window: Window, adapter: Adapter, ui: Arc<Mutex<UiState>>) -> Self {
Self {
window,
adapter,
ui,
}
}
}
struct Application {
event_loop_proxy: EventLoopProxy<AccessKitEvent>,
window: Option<WindowState>,
}
impl Application {
fn new(event_loop_proxy: EventLoopProxy<AccessKitEvent>) -> Self {
Self {
event_loop_proxy,
window: None,
}
}
fn create_window(&mut self, event_loop: &ActiveEventLoop) -> Result<(), Box<dyn Error>> {
let window_attributes = Window::default_attributes()
.with_title(WINDOW_TITLE)
.with_visible(false);
let window = event_loop.create_window(window_attributes)?;
let ui = UiState::new();
let activation_handler = TearoffActivationHandler {
state: Arc::clone(&ui),
};
let adapter = Adapter::with_mixed_handlers(
event_loop,
&window,
activation_handler,
self.event_loop_proxy.clone(),
);
window.set_visible(true);
self.window = Some(WindowState::new(window, adapter, ui));
Ok(())
}
}
impl ApplicationHandler<AccessKitEvent> for Application {
fn window_event(&mut self, _: &ActiveEventLoop, _: WindowId, event: WindowEvent) {
let window = match &mut self.window {
Some(window) => window,
None => return,
};
let adapter = &mut window.adapter;
let state = &mut window.ui;
adapter.process_event(&window.window, &event);
match event {
WindowEvent::CloseRequested => {
self.window = None;
}
WindowEvent::KeyboardInput {
event:
KeyEvent {
logical_key: virtual_code,
state: ElementState::Pressed,
..
},
..
} => match virtual_code {
Key::Named(winit::keyboard::NamedKey::Tab) => {
let mut state = state.lock().unwrap();
let new_focus = if state.focus == BUTTON_1_ID {
BUTTON_2_ID
} else {
BUTTON_1_ID
};
state.set_focus(adapter, new_focus);
}
Key::Named(winit::keyboard::NamedKey::Space) => {
let mut state = state.lock().unwrap();
let id = state.focus;
state.press_button(adapter, id);
}
_ => (),
},
_ => (),
}
}
fn user_event(&mut self, _: &ActiveEventLoop, user_event: AccessKitEvent) {
let window = match &mut self.window {
Some(window) => window,
None => return,
};
let adapter = &mut window.adapter;
let state = &mut window.ui;
match user_event.window_event {
AccessKitWindowEvent::InitialTreeRequested => unreachable!(),
AccessKitWindowEvent::ActionRequested(ActionRequest { action, target, .. }) => {
if target == BUTTON_1_ID || target == BUTTON_2_ID {
let mut state = state.lock().unwrap();
match action {
Action::Focus => {
state.set_focus(adapter, target);
}
Action::Click => {
state.press_button(adapter, target);
}
_ => (),
}
}
}
AccessKitWindowEvent::AccessibilityDeactivated => (),
}
}
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
self.create_window(event_loop)
.expect("failed to create initial window");
}
fn about_to_wait(&mut self, event_loop: &ActiveEventLoop) {
if self.window.is_none() {
event_loop.exit();
}
}
}
fn main() -> Result<(), Box<dyn Error>> {
println!("This example has no visible GUI, and a keyboard interface:");
println!("- [Tab] switches focus between two logical buttons.");
println!("- [Space] 'presses' the button, adding static text in a live region announcing that it was pressed.");
#[cfg(target_os = "windows")]
println!("Enable Narrator with [Win]+[Ctrl]+[Enter] (or [Win]+[Enter] on older versions of Windows).");
#[cfg(all(
feature = "accesskit_unix",
any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
)
))]
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)
}

View File

@@ -0,0 +1,276 @@
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 winit::{
application::ApplicationHandler,
event::{ElementState, KeyEvent, WindowEvent},
event_loop::{ActiveEventLoop, EventLoop, EventLoopProxy},
keyboard::Key,
window::{Window, WindowId},
};
const WINDOW_TITLE: &str = "Hello world";
const WINDOW_ID: NodeId = NodeId(0);
const BUTTON_1_ID: NodeId = NodeId(1);
const BUTTON_2_ID: NodeId = NodeId(2);
const ANNOUNCEMENT_ID: NodeId = NodeId(3);
const INITIAL_FOCUS: NodeId = BUTTON_1_ID;
const BUTTON_1_RECT: Rect = Rect {
x0: 20.0,
y0: 20.0,
x1: 100.0,
y1: 60.0,
};
const BUTTON_2_RECT: Rect = Rect {
x0: 20.0,
y0: 60.0,
x1: 100.0,
y1: 100.0,
};
fn build_button(id: NodeId, label: &str) -> Node {
let rect = match id {
BUTTON_1_ID => BUTTON_1_RECT,
BUTTON_2_ID => BUTTON_2_RECT,
_ => unreachable!(),
};
let mut node = Node::new(Role::Button);
node.set_bounds(rect);
node.set_label(label);
node.add_action(Action::Focus);
node.add_action(Action::Click);
node
}
fn build_announcement(text: &str) -> Node {
let mut node = Node::new(Role::Label);
node.set_value(text);
node.set_live(Live::Polite);
node
}
struct UiState {
focus: NodeId,
announcement: Option<String>,
}
impl UiState {
fn new() -> Self {
Self {
focus: INITIAL_FOCUS,
announcement: None,
}
}
fn build_root(&mut self) -> Node {
let mut node = Node::new(Role::Window);
node.set_children(vec![BUTTON_1_ID, BUTTON_2_ID]);
if self.announcement.is_some() {
node.push_child(ANNOUNCEMENT_ID);
}
node.set_label(WINDOW_TITLE);
node
}
fn build_initial_tree(&mut self) -> TreeUpdate {
let root = self.build_root();
let button_1 = build_button(BUTTON_1_ID, "Button 1");
let button_2 = build_button(BUTTON_2_ID, "Button 2");
let tree = Tree::new(WINDOW_ID);
let mut result = TreeUpdate {
nodes: vec![
(WINDOW_ID, root),
(BUTTON_1_ID, button_1),
(BUTTON_2_ID, button_2),
],
tree: Some(tree),
focus: self.focus,
};
if let Some(announcement) = &self.announcement {
result
.nodes
.push((ANNOUNCEMENT_ID, build_announcement(announcement)));
}
result
}
fn set_focus(&mut self, adapter: &mut Adapter, focus: NodeId) {
self.focus = focus;
adapter.update_if_active(|| TreeUpdate {
nodes: vec![],
tree: None,
focus,
});
}
fn press_button(&mut self, adapter: &mut Adapter, id: NodeId) {
let text = if id == BUTTON_1_ID {
"You pressed button 1"
} else {
"You pressed button 2"
};
self.announcement = Some(text.into());
adapter.update_if_active(|| {
let announcement = build_announcement(text);
let root = self.build_root();
TreeUpdate {
nodes: vec![(ANNOUNCEMENT_ID, announcement), (WINDOW_ID, root)],
tree: None,
focus: self.focus,
}
});
}
}
struct WindowState {
window: Window,
adapter: Adapter,
ui: UiState,
}
impl WindowState {
fn new(window: Window, adapter: Adapter, ui: UiState) -> Self {
Self {
window,
adapter,
ui,
}
}
}
struct Application {
event_loop_proxy: EventLoopProxy<AccessKitEvent>,
window: Option<WindowState>,
}
impl Application {
fn new(event_loop_proxy: EventLoopProxy<AccessKitEvent>) -> Self {
Self {
event_loop_proxy,
window: None,
}
}
fn create_window(&mut self, event_loop: &ActiveEventLoop) -> Result<(), Box<dyn Error>> {
let window_attributes = Window::default_attributes()
.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());
window.set_visible(true);
self.window = Some(WindowState::new(window, adapter, UiState::new()));
Ok(())
}
}
impl ApplicationHandler<AccessKitEvent> for Application {
fn window_event(&mut self, _: &ActiveEventLoop, _: WindowId, event: WindowEvent) {
let window = match &mut self.window {
Some(window) => window,
None => return,
};
let adapter = &mut window.adapter;
let state = &mut window.ui;
adapter.process_event(&window.window, &event);
match event {
WindowEvent::CloseRequested => {
self.window = None;
}
WindowEvent::KeyboardInput {
event:
KeyEvent {
logical_key: virtual_code,
state: ElementState::Pressed,
..
},
..
} => match virtual_code {
Key::Named(winit::keyboard::NamedKey::Tab) => {
let new_focus = if state.focus == BUTTON_1_ID {
BUTTON_2_ID
} else {
BUTTON_1_ID
};
state.set_focus(adapter, new_focus);
}
Key::Named(winit::keyboard::NamedKey::Space) => {
let id = state.focus;
state.press_button(adapter, id);
}
_ => (),
},
_ => (),
}
}
fn user_event(&mut self, _: &ActiveEventLoop, user_event: AccessKitEvent) {
let window = match &mut self.window {
Some(window) => window,
None => return,
};
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);
}
_ => (),
}
}
}
AccessKitWindowEvent::AccessibilityDeactivated => (),
}
}
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
self.create_window(event_loop)
.expect("failed to create initial window");
}
fn about_to_wait(&mut self, event_loop: &ActiveEventLoop) {
if self.window.is_none() {
event_loop.exit();
}
}
}
fn main() -> Result<(), Box<dyn Error>> {
println!("This example has no visible GUI, and a keyboard interface:");
println!("- [Tab] switches focus between two logical buttons.");
println!("- [Space] 'presses' the button, adding static text in a live region announcing that it was pressed.");
#[cfg(target_os = "windows")]
println!("Enable Narrator with [Win]+[Ctrl]+[Enter] (or [Win]+[Enter] on older versions of Windows).");
#[cfg(all(
feature = "accesskit_unix",
any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
)
))]
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)
}

249
vendor/accesskit_winit/src/lib.rs vendored Normal file
View File

@@ -0,0 +1,249 @@
// 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."
);
#[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::{
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(Debug)]
pub enum WindowEvent {
InitialTreeRequested,
ActionRequested(ActionRequest),
AccessibilityDeactivated,
}
struct WinitActivationHandler<T: From<Event> + Send + 'static> {
window_id: WindowId,
proxy: EventLoopProxy<T>,
}
impl<T: From<Event> + Send + 'static> ActivationHandler for WinitActivationHandler<T> {
fn request_initial_tree(&mut self) -> Option<TreeUpdate> {
let event = Event {
window_id: self.window_id,
window_event: WindowEvent::InitialTreeRequested,
};
self.proxy.send_event(event.into()).ok();
None
}
}
struct WinitActionHandler<T: From<Event> + Send + 'static> {
window_id: WindowId,
proxy: EventLoopProxy<T>,
}
impl<T: From<Event> + Send + 'static> ActionHandler for WinitActionHandler<T> {
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();
}
}
struct WinitDeactivationHandler<T: From<Event> + Send + 'static> {
window_id: WindowId,
proxy: EventLoopProxy<T>,
}
impl<T: From<Event> + Send + 'static> DeactivationHandler for WinitDeactivationHandler<T> {
fn deactivate_accessibility(&mut self) {
let event = Event {
window_id: self.window_id,
window_event: WindowEvent::AccessibilityDeactivated,
};
self.proxy.send_event(event.into()).ok();
}
}
pub struct Adapter {
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.
///
/// This constructor uses a winit event loop proxy to deliver AccessKit
/// events to the main event loop. The primary disadvantage of this approach
/// is that it's not possible to synchronously return an initial tree
/// in response to the [`WindowEvent::InitialTreeRequested`] event,
/// so some platform adapters will have to use a temporary placeholder tree
/// until you send the first update. For an optimal implementation,
/// consider using [`Adapter::with_direct_handlers`] or
/// [`Adapter::with_mixed_handlers`] instead.
pub fn with_event_loop_proxy<T: From<Event> + Send + 'static>(
event_loop: &ActiveEventLoop,
window: &Window,
proxy: EventLoopProxy<T>,
) -> Self {
let window_id = window.id();
let activation_handler = WinitActivationHandler {
window_id,
proxy: proxy.clone(),
};
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,
)
}
/// 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.
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 {
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.
pub fn with_mixed_handlers<T: From<Event> + Send + 'static>(
event_loop: &ActiveEventLoop,
window: &Window,
activation_handler: impl 'static + ActivationHandler + Send,
proxy: EventLoopProxy<T>,
) -> 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);
}
/// 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);
}
}

View File

@@ -0,0 +1,50 @@
// Copyright 2025 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, TreeUpdate};
use accesskit_android::{
jni::{objects::JObject, JavaVM},
InjectingAdapter,
};
use winit::{
event::WindowEvent, event_loop::ActiveEventLoop, platform::android::ActiveEventLoopExtAndroid,
window::Window,
};
pub struct Adapter {
adapter: InjectingAdapter,
}
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,
) -> Self {
let app = event_loop.android_app();
let vm = unsafe { JavaVM::from_raw(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 view = env
.get_field(
&activity,
"mSurfaceView",
"Lcom/google/androidgamesdk/GameActivity$InputEnabledSurfaceView;",
)
.unwrap()
.l()
.unwrap();
let adapter =
InjectingAdapter::new(&mut env, &view, activation_handler, action_handler).unwrap();
Self { adapter }
}
pub fn update_if_active(&mut self, updater: impl FnOnce() -> TreeUpdate) {
self.adapter.update_if_active(updater);
}
pub fn process_event(&mut self, _window: &Window, _event: &WindowEvent) {}
}

View File

@@ -0,0 +1,55 @@
// 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_macos::SubclassingAdapter;
use winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window};
pub struct Adapter {
adapter: SubclassingAdapter,
}
impl Adapter {
pub fn new(
_event_loop: &ActiveEventLoop,
window: &Window,
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() {
RawWindowHandle::AppKit(handle) => handle.ns_view.as_ptr(),
RawWindowHandle::UiKit(_) => unimplemented!(),
_ => unreachable!(),
};
let adapter = unsafe { SubclassingAdapter::new(view, activation_handler, action_handler) };
Self { adapter }
}
pub fn update_if_active(&mut self, updater: impl FnOnce() -> TreeUpdate) {
if let Some(events) = self.adapter.update_if_active(updater) {
events.raise();
}
}
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();
}
}
}
}

View File

@@ -0,0 +1,50 @@
// Copyright 2022 The AccessKit Authors. All rights reserved.
// Licensed under the Apache License, Version 2.0 (found in
// the LICENSE-APACHE file).
// Based loosely on winit's src/platform_impl/mod.rs.
pub use self::platform::*;
#[cfg(target_os = "windows")]
#[path = "windows.rs"]
mod platform;
#[cfg(target_os = "macos")]
#[path = "macos.rs"]
mod platform;
#[cfg(all(
feature = "accesskit_unix",
any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
)
))]
#[path = "unix.rs"]
mod platform;
#[cfg(all(feature = "accesskit_android", target_os = "android"))]
#[path = "android.rs"]
mod platform;
#[cfg(not(any(
target_os = "windows",
target_os = "macos",
all(
feature = "accesskit_unix",
any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
)
),
all(feature = "accesskit_android", target_os = "android")
)))]
#[path = "null.rs"]
mod platform;

View File

@@ -0,0 +1,24 @@
// 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, TreeUpdate};
use winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window};
pub struct Adapter;
impl Adapter {
pub fn new(
_event_loop: &ActiveEventLoop,
_window: &Window,
_activation_handler: impl 'static + ActivationHandler,
_action_handler: impl 'static + ActionHandler,
_deactivation_handler: impl 'static + DeactivationHandler,
) -> Self {
Self {}
}
pub fn update_if_active(&mut self, _updater: impl FnOnce() -> TreeUpdate) {}
pub fn process_event(&mut self, _window: &Window, _event: &WindowEvent) {}
}

View File

@@ -0,0 +1,77 @@
// 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::<f64>().into();
let outer_size: (_, _) = window.outer_size().cast::<f64>().into();
let inner_position: (_, _) = window
.inner_position()
.unwrap_or_default()
.cast::<f64>()
.into();
let inner_size: (_, _) = window.inner_size().cast::<f64>().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::<f64>()
.into();
let outer_size: (_, _) = window.outer_size().cast::<f64>().into();
let inner_position: (_, _) = window
.inner_position()
.unwrap_or_default()
.cast::<f64>()
.into();
let inner_size: (_, _) = inner_size.cast::<f64>().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);
}
_ => (),
}
}
}

View File

@@ -0,0 +1,49 @@
// 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 winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window};
pub struct Adapter {
adapter: SubclassingAdapter,
}
impl Adapter {
pub fn new(
_event_loop: &ActiveEventLoop,
window: &Window,
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() {
RawWindowHandle::Win32(handle) => handle.hwnd.get() as *mut _,
RawWindowHandle::WinRt(_) => unimplemented!(),
_ => unreachable!(),
};
let adapter = SubclassingAdapter::new(HWND(hwnd), activation_handler, action_handler);
Self { adapter }
}
pub fn update_if_active(&mut self, updater: impl FnOnce() -> TreeUpdate) {
if let Some(events) = self.adapter.update_if_active(updater) {
events.raise();
}
}
pub fn process_event(&mut self, _window: &Window, _event: &WindowEvent) {}
}