├── .cargo └── config.toml ├── .github └── workflows │ ├── nightly_deps_check.yml │ └── testing.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── changelog.md ├── examples ├── example.rs └── simple.rs ├── license.txt ├── readme.md ├── run-wasm ├── Cargo.toml └── src │ └── main.rs ├── rust-toolchain.toml ├── rustfmt.toml └── src ├── current_input.rs ├── lib.rs └── winit_input_helper.rs /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | run-wasm = ["run", "--release", "--package", "run-wasm", "--"] 3 | -------------------------------------------------------------------------------- /.github/workflows/nightly_deps_check.yml: -------------------------------------------------------------------------------- 1 | # Runs `cargo update` and then reports build failures in a GitHub issue titled "Nightly deps check failed" 2 | # If an open issue with the same title already exists then another issue is not created. 3 | 4 | name: Nightly Deps Check 5 | 6 | on: 7 | # Allows the workflow to be manually triggered from the github UI. 8 | workflow_dispatch: {} 9 | # Run once per day at 00:00 UTC 10 | schedule: 11 | - cron: '0 0 * * *' 12 | 13 | env: 14 | CARGO_TERM_COLOR: always 15 | 16 | jobs: 17 | build: 18 | strategy: 19 | matrix: 20 | include: 21 | - name: Release 22 | cargo_profile: --release 23 | - name: Debug 24 | cargo_profile: 25 | name: ${{ matrix.name }} 26 | runs-on: ubuntu-latest 27 | steps: 28 | - uses: actions/checkout@v4 29 | - uses: Swatinem/rust-cache@v2 30 | with: 31 | # rust-cache already handles all the sane defaults for caching rust builds. 32 | # However because we are running seperate debug/release builds in parallel, 33 | # we also need to add Debug or Release to the key so that a seperate cache is used. 34 | # Otherwise only the last build to finish would get saved to the cache. 35 | key: ${{ matrix.name }} 36 | - name: Install cargo-hack 37 | run: cargo install cargo-hack --version 0.6.22 38 | - name: cargo update` 39 | run: cargo update 40 | - name: Check `cargo fmt` was run 41 | run: cargo fmt --all -- --check 42 | # If your library does not support running under every possible combination of features, 43 | # consider using cargo `hack --each-feature` or some other combination of arguments as described at https://github.com/taiki-e/cargo-hack 44 | - name: Ensure that the library and all examples compile and have no warnings under every possible combination of features in {{ matrix.cargo_profile }} profile 45 | # some things to explicitly point out: 46 | # * clippy also reports rustc warnings and errors 47 | # * clippy --all-targets causes clippy to run against tests and examples which it doesnt do by default. 48 | run: cargo hack --feature-powerset clippy --all-targets --locked ${{ matrix.cargo_profile }} -- -D warnings 49 | - name: Ensure that tests pass under every possible combination of features in ${{ matrix.cargo_profile }} profile 50 | run: cargo test ${{ matrix.cargo_profile }} 51 | - uses: JasonEtco/create-an-issue@v2 52 | if: ${{ failure() }} 53 | env: 54 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 55 | NIGHTLY_DEPS_WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} 56 | with: 57 | update_existing: true 58 | filename: .github/NIGHTLY_DEPS_ISSUE_TEMPLATE.md 59 | -------------------------------------------------------------------------------- /.github/workflows/testing.yml: -------------------------------------------------------------------------------- 1 | name: Testing 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | # Cancel already running jobs 10 | concurrency: 11 | group: testing_${{ github.head_ref }} 12 | cancel-in-progress: true 13 | 14 | env: 15 | CARGO_TERM_COLOR: always 16 | 17 | jobs: 18 | build: 19 | strategy: 20 | matrix: 21 | include: 22 | - name: Release 23 | cargo_profile: --release 24 | - name: Debug 25 | cargo_profile: 26 | name: ${{ matrix.name }} 27 | runs-on: ubuntu-latest 28 | steps: 29 | - uses: actions/checkout@v4 30 | - uses: Swatinem/rust-cache@v2 31 | with: 32 | # rust-cache already handles all the sane defaults for caching rust builds. 33 | # However because we are running seperate debug/release builds in parallel, 34 | # we also need to add Debug or Release to the key so that a seperate cache is used. 35 | # Otherwise only the last build to finish would get saved to the cache. 36 | key: ${{ matrix.name }} 37 | - name: Install cargo-hack 38 | run: cargo install cargo-hack --version 0.6.22 39 | - name: Check `cargo fmt` was run 40 | run: cargo fmt --all -- --check 41 | # If your library does not support running under every possible combination of features, 42 | # consider using cargo `hack --each-feature` or some other combination of arguments as described at https://github.com/taiki-e/cargo-hack 43 | - name: Ensure that the library and all examples compile and have no warnings under every possible combination of features 44 | # some things to explicitly point out: 45 | # * clippy also reports rustc warnings and errors 46 | # * clippy --all-targets causes clippy to run against tests and examples which it doesnt do by default. 47 | run: cargo hack --feature-powerset clippy --all-targets --locked ${{ matrix.cargo_profile }} -- -D warnings 48 | - name: Ensure that tests pass under every possible combination of features 49 | run: cargo hack --feature-powerset test ${{ matrix.cargo_profile }} 50 | - name: Ensure that tests did not create or modify any files that arent .gitignore'd 51 | # This is important because we are checking in the Cargo.lock file. 52 | # We want to fail CI if the Cargo.toml changed without including the corresponding Cargo.lock changes. 53 | # Its also just generally nice to ensure your tests dont leave around unexpected files. 54 | shell: bash 55 | run: | 56 | if [ -n "$(git status --porcelain)" ]; then 57 | git status 58 | exit 1 59 | fi 60 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "ab_glyph" 7 | version = "0.2.23" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "80179d7dd5d7e8c285d67c4a1e652972a92de7475beddfb92028c76463b13225" 10 | dependencies = [ 11 | "ab_glyph_rasterizer", 12 | "owned_ttf_parser", 13 | ] 14 | 15 | [[package]] 16 | name = "ab_glyph_rasterizer" 17 | version = "0.1.8" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" 20 | 21 | [[package]] 22 | name = "ahash" 23 | version = "0.8.6" 24 | source = "registry+https://github.com/rust-lang/crates.io-index" 25 | checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" 26 | dependencies = [ 27 | "cfg-if", 28 | "getrandom", 29 | "once_cell", 30 | "version_check", 31 | "zerocopy", 32 | ] 33 | 34 | [[package]] 35 | name = "aho-corasick" 36 | version = "1.1.2" 37 | source = "registry+https://github.com/rust-lang/crates.io-index" 38 | checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" 39 | dependencies = [ 40 | "memchr", 41 | ] 42 | 43 | [[package]] 44 | name = "android-activity" 45 | version = "0.5.1" 46 | source = "registry+https://github.com/rust-lang/crates.io-index" 47 | checksum = "39b801912a977c3fd52d80511fe1c0c8480c6f957f21ae2ce1b92ffe970cf4b9" 48 | dependencies = [ 49 | "android-properties", 50 | "bitflags 2.4.1", 51 | "cc", 52 | "cesu8", 53 | "jni", 54 | "jni-sys", 55 | "libc", 56 | "log", 57 | "ndk", 58 | "ndk-context", 59 | "ndk-sys", 60 | "num_enum", 61 | "thiserror", 62 | ] 63 | 64 | [[package]] 65 | name = "android-properties" 66 | version = "0.2.2" 67 | source = "registry+https://github.com/rust-lang/crates.io-index" 68 | checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" 69 | 70 | [[package]] 71 | name = "anstream" 72 | version = "0.6.11" 73 | source = "registry+https://github.com/rust-lang/crates.io-index" 74 | checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" 75 | dependencies = [ 76 | "anstyle", 77 | "anstyle-parse", 78 | "anstyle-query", 79 | "anstyle-wincon", 80 | "colorchoice", 81 | "utf8parse", 82 | ] 83 | 84 | [[package]] 85 | name = "anstyle" 86 | version = "1.0.4" 87 | source = "registry+https://github.com/rust-lang/crates.io-index" 88 | checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" 89 | 90 | [[package]] 91 | name = "anstyle-parse" 92 | version = "0.2.3" 93 | source = "registry+https://github.com/rust-lang/crates.io-index" 94 | checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" 95 | dependencies = [ 96 | "utf8parse", 97 | ] 98 | 99 | [[package]] 100 | name = "anstyle-query" 101 | version = "1.0.2" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" 104 | dependencies = [ 105 | "windows-sys 0.52.0", 106 | ] 107 | 108 | [[package]] 109 | name = "anstyle-wincon" 110 | version = "3.0.2" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" 113 | dependencies = [ 114 | "anstyle", 115 | "windows-sys 0.52.0", 116 | ] 117 | 118 | [[package]] 119 | name = "anyhow" 120 | version = "1.0.79" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" 123 | 124 | [[package]] 125 | name = "arrayref" 126 | version = "0.3.7" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" 129 | 130 | [[package]] 131 | name = "arrayvec" 132 | version = "0.7.4" 133 | source = "registry+https://github.com/rust-lang/crates.io-index" 134 | checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" 135 | 136 | [[package]] 137 | name = "as-raw-xcb-connection" 138 | version = "1.0.1" 139 | source = "registry+https://github.com/rust-lang/crates.io-index" 140 | checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" 141 | 142 | [[package]] 143 | name = "atomic-waker" 144 | version = "1.1.2" 145 | source = "registry+https://github.com/rust-lang/crates.io-index" 146 | checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" 147 | 148 | [[package]] 149 | name = "autocfg" 150 | version = "1.1.0" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 153 | 154 | [[package]] 155 | name = "base64" 156 | version = "0.9.3" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" 159 | dependencies = [ 160 | "byteorder", 161 | "safemem", 162 | ] 163 | 164 | [[package]] 165 | name = "bitflags" 166 | version = "1.3.2" 167 | source = "registry+https://github.com/rust-lang/crates.io-index" 168 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 169 | 170 | [[package]] 171 | name = "bitflags" 172 | version = "2.4.1" 173 | source = "registry+https://github.com/rust-lang/crates.io-index" 174 | checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" 175 | 176 | [[package]] 177 | name = "block-sys" 178 | version = "0.2.0" 179 | source = "registry+https://github.com/rust-lang/crates.io-index" 180 | checksum = "2dd7cf50912cddc06dc5ea7c08c5e81c1b2c842a70d19def1848d54c586fed92" 181 | dependencies = [ 182 | "objc-sys", 183 | ] 184 | 185 | [[package]] 186 | name = "block2" 187 | version = "0.3.0" 188 | source = "registry+https://github.com/rust-lang/crates.io-index" 189 | checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" 190 | dependencies = [ 191 | "block-sys", 192 | "objc2", 193 | ] 194 | 195 | [[package]] 196 | name = "bumpalo" 197 | version = "3.14.0" 198 | source = "registry+https://github.com/rust-lang/crates.io-index" 199 | checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" 200 | 201 | [[package]] 202 | name = "bytemuck" 203 | version = "1.14.0" 204 | source = "registry+https://github.com/rust-lang/crates.io-index" 205 | checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" 206 | 207 | [[package]] 208 | name = "byteorder" 209 | version = "1.5.0" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 212 | 213 | [[package]] 214 | name = "bytes" 215 | version = "1.5.0" 216 | source = "registry+https://github.com/rust-lang/crates.io-index" 217 | checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" 218 | 219 | [[package]] 220 | name = "calloop" 221 | version = "0.12.3" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "7b50b5a44d59a98c55a9eeb518f39bf7499ba19fd98ee7d22618687f3f10adbf" 224 | dependencies = [ 225 | "bitflags 2.4.1", 226 | "log", 227 | "polling", 228 | "rustix", 229 | "slab", 230 | "thiserror", 231 | ] 232 | 233 | [[package]] 234 | name = "calloop-wayland-source" 235 | version = "0.2.0" 236 | source = "registry+https://github.com/rust-lang/crates.io-index" 237 | checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" 238 | dependencies = [ 239 | "calloop", 240 | "rustix", 241 | "wayland-backend", 242 | "wayland-client", 243 | ] 244 | 245 | [[package]] 246 | name = "cargo-run-wasm" 247 | version = "0.3.2" 248 | source = "registry+https://github.com/rust-lang/crates.io-index" 249 | checksum = "cc1e37cf14ef470ed74ec2a8b95e51b8623bcf6f76d24f233ebaeb209f766230" 250 | dependencies = [ 251 | "devserver_lib", 252 | "pico-args", 253 | "serde_json", 254 | "wasm-bindgen-cli-support", 255 | ] 256 | 257 | [[package]] 258 | name = "cc" 259 | version = "1.0.83" 260 | source = "registry+https://github.com/rust-lang/crates.io-index" 261 | checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" 262 | dependencies = [ 263 | "jobserver", 264 | "libc", 265 | ] 266 | 267 | [[package]] 268 | name = "cesu8" 269 | version = "1.1.0" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" 272 | 273 | [[package]] 274 | name = "cfg-if" 275 | version = "1.0.0" 276 | source = "registry+https://github.com/rust-lang/crates.io-index" 277 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 278 | 279 | [[package]] 280 | name = "cfg_aliases" 281 | version = "0.1.1" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" 284 | 285 | [[package]] 286 | name = "colorchoice" 287 | version = "1.0.0" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" 290 | 291 | [[package]] 292 | name = "combine" 293 | version = "4.6.6" 294 | source = "registry+https://github.com/rust-lang/crates.io-index" 295 | checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" 296 | dependencies = [ 297 | "bytes", 298 | "memchr", 299 | ] 300 | 301 | [[package]] 302 | name = "concurrent-queue" 303 | version = "2.4.0" 304 | source = "registry+https://github.com/rust-lang/crates.io-index" 305 | checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" 306 | dependencies = [ 307 | "crossbeam-utils", 308 | ] 309 | 310 | [[package]] 311 | name = "console_error_panic_hook" 312 | version = "0.1.7" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" 315 | dependencies = [ 316 | "cfg-if", 317 | "wasm-bindgen", 318 | ] 319 | 320 | [[package]] 321 | name = "console_log" 322 | version = "1.0.0" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | checksum = "be8aed40e4edbf4d3b4431ab260b63fdc40f5780a4766824329ea0f1eefe3c0f" 325 | dependencies = [ 326 | "log", 327 | "web-sys", 328 | ] 329 | 330 | [[package]] 331 | name = "core-foundation" 332 | version = "0.9.4" 333 | source = "registry+https://github.com/rust-lang/crates.io-index" 334 | checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" 335 | dependencies = [ 336 | "core-foundation-sys", 337 | "libc", 338 | ] 339 | 340 | [[package]] 341 | name = "core-foundation-sys" 342 | version = "0.8.6" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" 345 | 346 | [[package]] 347 | name = "core-graphics" 348 | version = "0.23.1" 349 | source = "registry+https://github.com/rust-lang/crates.io-index" 350 | checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212" 351 | dependencies = [ 352 | "bitflags 1.3.2", 353 | "core-foundation", 354 | "core-graphics-types", 355 | "foreign-types", 356 | "libc", 357 | ] 358 | 359 | [[package]] 360 | name = "core-graphics-types" 361 | version = "0.1.3" 362 | source = "registry+https://github.com/rust-lang/crates.io-index" 363 | checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" 364 | dependencies = [ 365 | "bitflags 1.3.2", 366 | "core-foundation", 367 | "libc", 368 | ] 369 | 370 | [[package]] 371 | name = "crossbeam-utils" 372 | version = "0.8.18" 373 | source = "registry+https://github.com/rust-lang/crates.io-index" 374 | checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" 375 | dependencies = [ 376 | "cfg-if", 377 | ] 378 | 379 | [[package]] 380 | name = "cursor-icon" 381 | version = "1.1.0" 382 | source = "registry+https://github.com/rust-lang/crates.io-index" 383 | checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" 384 | 385 | [[package]] 386 | name = "devserver_lib" 387 | version = "0.4.2" 388 | source = "registry+https://github.com/rust-lang/crates.io-index" 389 | checksum = "edf215dbb8cb1409cca7645aaed35f9e39fb0a21855bba1ac48bc0334903bf66" 390 | 391 | [[package]] 392 | name = "dispatch" 393 | version = "0.2.0" 394 | source = "registry+https://github.com/rust-lang/crates.io-index" 395 | checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" 396 | 397 | [[package]] 398 | name = "dlib" 399 | version = "0.5.2" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" 402 | dependencies = [ 403 | "libloading", 404 | ] 405 | 406 | [[package]] 407 | name = "downcast-rs" 408 | version = "1.2.0" 409 | source = "registry+https://github.com/rust-lang/crates.io-index" 410 | checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" 411 | 412 | [[package]] 413 | name = "env_filter" 414 | version = "0.1.0" 415 | source = "registry+https://github.com/rust-lang/crates.io-index" 416 | checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" 417 | dependencies = [ 418 | "log", 419 | "regex", 420 | ] 421 | 422 | [[package]] 423 | name = "env_logger" 424 | version = "0.11.0" 425 | source = "registry+https://github.com/rust-lang/crates.io-index" 426 | checksum = "9eeb342678d785662fd2514be38c459bb925f02b68dd2a3e0f21d7ef82d979dd" 427 | dependencies = [ 428 | "anstream", 429 | "anstyle", 430 | "env_filter", 431 | "humantime", 432 | "log", 433 | ] 434 | 435 | [[package]] 436 | name = "equivalent" 437 | version = "1.0.1" 438 | source = "registry+https://github.com/rust-lang/crates.io-index" 439 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 440 | 441 | [[package]] 442 | name = "errno" 443 | version = "0.3.8" 444 | source = "registry+https://github.com/rust-lang/crates.io-index" 445 | checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" 446 | dependencies = [ 447 | "libc", 448 | "windows-sys 0.52.0", 449 | ] 450 | 451 | [[package]] 452 | name = "fallible-iterator" 453 | version = "0.2.0" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" 456 | 457 | [[package]] 458 | name = "fastrand" 459 | version = "2.0.1" 460 | source = "registry+https://github.com/rust-lang/crates.io-index" 461 | checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" 462 | 463 | [[package]] 464 | name = "foreign-types" 465 | version = "0.5.0" 466 | source = "registry+https://github.com/rust-lang/crates.io-index" 467 | checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" 468 | dependencies = [ 469 | "foreign-types-macros", 470 | "foreign-types-shared", 471 | ] 472 | 473 | [[package]] 474 | name = "foreign-types-macros" 475 | version = "0.2.3" 476 | source = "registry+https://github.com/rust-lang/crates.io-index" 477 | checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" 478 | dependencies = [ 479 | "proc-macro2", 480 | "quote", 481 | "syn 2.0.43", 482 | ] 483 | 484 | [[package]] 485 | name = "foreign-types-shared" 486 | version = "0.3.1" 487 | source = "registry+https://github.com/rust-lang/crates.io-index" 488 | checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" 489 | 490 | [[package]] 491 | name = "gethostname" 492 | version = "0.4.3" 493 | source = "registry+https://github.com/rust-lang/crates.io-index" 494 | checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" 495 | dependencies = [ 496 | "libc", 497 | "windows-targets 0.48.5", 498 | ] 499 | 500 | [[package]] 501 | name = "getrandom" 502 | version = "0.2.11" 503 | source = "registry+https://github.com/rust-lang/crates.io-index" 504 | checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" 505 | dependencies = [ 506 | "cfg-if", 507 | "libc", 508 | "wasi", 509 | ] 510 | 511 | [[package]] 512 | name = "gimli" 513 | version = "0.26.2" 514 | source = "registry+https://github.com/rust-lang/crates.io-index" 515 | checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" 516 | dependencies = [ 517 | "fallible-iterator", 518 | "indexmap 1.9.3", 519 | "stable_deref_trait", 520 | ] 521 | 522 | [[package]] 523 | name = "hashbrown" 524 | version = "0.12.3" 525 | source = "registry+https://github.com/rust-lang/crates.io-index" 526 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 527 | 528 | [[package]] 529 | name = "hashbrown" 530 | version = "0.14.3" 531 | source = "registry+https://github.com/rust-lang/crates.io-index" 532 | checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" 533 | 534 | [[package]] 535 | name = "heck" 536 | version = "0.3.3" 537 | source = "registry+https://github.com/rust-lang/crates.io-index" 538 | checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" 539 | dependencies = [ 540 | "unicode-segmentation", 541 | ] 542 | 543 | [[package]] 544 | name = "humantime" 545 | version = "2.1.0" 546 | source = "registry+https://github.com/rust-lang/crates.io-index" 547 | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" 548 | 549 | [[package]] 550 | name = "icrate" 551 | version = "0.0.4" 552 | source = "registry+https://github.com/rust-lang/crates.io-index" 553 | checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319" 554 | dependencies = [ 555 | "block2", 556 | "dispatch", 557 | "objc2", 558 | ] 559 | 560 | [[package]] 561 | name = "id-arena" 562 | version = "2.2.1" 563 | source = "registry+https://github.com/rust-lang/crates.io-index" 564 | checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" 565 | 566 | [[package]] 567 | name = "indexmap" 568 | version = "1.9.3" 569 | source = "registry+https://github.com/rust-lang/crates.io-index" 570 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 571 | dependencies = [ 572 | "autocfg", 573 | "hashbrown 0.12.3", 574 | ] 575 | 576 | [[package]] 577 | name = "indexmap" 578 | version = "2.1.0" 579 | source = "registry+https://github.com/rust-lang/crates.io-index" 580 | checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" 581 | dependencies = [ 582 | "equivalent", 583 | "hashbrown 0.14.3", 584 | ] 585 | 586 | [[package]] 587 | name = "itoa" 588 | version = "1.0.10" 589 | source = "registry+https://github.com/rust-lang/crates.io-index" 590 | checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" 591 | 592 | [[package]] 593 | name = "jni" 594 | version = "0.21.1" 595 | source = "registry+https://github.com/rust-lang/crates.io-index" 596 | checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" 597 | dependencies = [ 598 | "cesu8", 599 | "cfg-if", 600 | "combine", 601 | "jni-sys", 602 | "log", 603 | "thiserror", 604 | "walkdir", 605 | "windows-sys 0.45.0", 606 | ] 607 | 608 | [[package]] 609 | name = "jni-sys" 610 | version = "0.3.0" 611 | source = "registry+https://github.com/rust-lang/crates.io-index" 612 | checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" 613 | 614 | [[package]] 615 | name = "jobserver" 616 | version = "0.1.27" 617 | source = "registry+https://github.com/rust-lang/crates.io-index" 618 | checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" 619 | dependencies = [ 620 | "libc", 621 | ] 622 | 623 | [[package]] 624 | name = "js-sys" 625 | version = "0.3.66" 626 | source = "registry+https://github.com/rust-lang/crates.io-index" 627 | checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" 628 | dependencies = [ 629 | "wasm-bindgen", 630 | ] 631 | 632 | [[package]] 633 | name = "leb128" 634 | version = "0.2.5" 635 | source = "registry+https://github.com/rust-lang/crates.io-index" 636 | checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" 637 | 638 | [[package]] 639 | name = "libc" 640 | version = "0.2.151" 641 | source = "registry+https://github.com/rust-lang/crates.io-index" 642 | checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" 643 | 644 | [[package]] 645 | name = "libloading" 646 | version = "0.8.1" 647 | source = "registry+https://github.com/rust-lang/crates.io-index" 648 | checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" 649 | dependencies = [ 650 | "cfg-if", 651 | "windows-sys 0.48.0", 652 | ] 653 | 654 | [[package]] 655 | name = "libredox" 656 | version = "0.0.2" 657 | source = "registry+https://github.com/rust-lang/crates.io-index" 658 | checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" 659 | dependencies = [ 660 | "bitflags 2.4.1", 661 | "libc", 662 | "redox_syscall 0.4.1", 663 | ] 664 | 665 | [[package]] 666 | name = "linux-raw-sys" 667 | version = "0.4.12" 668 | source = "registry+https://github.com/rust-lang/crates.io-index" 669 | checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" 670 | 671 | [[package]] 672 | name = "log" 673 | version = "0.4.20" 674 | source = "registry+https://github.com/rust-lang/crates.io-index" 675 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" 676 | 677 | [[package]] 678 | name = "memchr" 679 | version = "2.6.4" 680 | source = "registry+https://github.com/rust-lang/crates.io-index" 681 | checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" 682 | 683 | [[package]] 684 | name = "memmap2" 685 | version = "0.9.3" 686 | source = "registry+https://github.com/rust-lang/crates.io-index" 687 | checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92" 688 | dependencies = [ 689 | "libc", 690 | ] 691 | 692 | [[package]] 693 | name = "memoffset" 694 | version = "0.7.1" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" 697 | dependencies = [ 698 | "autocfg", 699 | ] 700 | 701 | [[package]] 702 | name = "ndk" 703 | version = "0.8.0" 704 | source = "registry+https://github.com/rust-lang/crates.io-index" 705 | checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" 706 | dependencies = [ 707 | "bitflags 2.4.1", 708 | "jni-sys", 709 | "log", 710 | "ndk-sys", 711 | "num_enum", 712 | "raw-window-handle", 713 | "thiserror", 714 | ] 715 | 716 | [[package]] 717 | name = "ndk-context" 718 | version = "0.1.1" 719 | source = "registry+https://github.com/rust-lang/crates.io-index" 720 | checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" 721 | 722 | [[package]] 723 | name = "ndk-sys" 724 | version = "0.5.0+25.2.9519653" 725 | source = "registry+https://github.com/rust-lang/crates.io-index" 726 | checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" 727 | dependencies = [ 728 | "jni-sys", 729 | ] 730 | 731 | [[package]] 732 | name = "nix" 733 | version = "0.26.4" 734 | source = "registry+https://github.com/rust-lang/crates.io-index" 735 | checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" 736 | dependencies = [ 737 | "bitflags 1.3.2", 738 | "cfg-if", 739 | "libc", 740 | "memoffset", 741 | ] 742 | 743 | [[package]] 744 | name = "num_enum" 745 | version = "0.7.1" 746 | source = "registry+https://github.com/rust-lang/crates.io-index" 747 | checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0" 748 | dependencies = [ 749 | "num_enum_derive", 750 | ] 751 | 752 | [[package]] 753 | name = "num_enum_derive" 754 | version = "0.7.1" 755 | source = "registry+https://github.com/rust-lang/crates.io-index" 756 | checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" 757 | dependencies = [ 758 | "proc-macro-crate", 759 | "proc-macro2", 760 | "quote", 761 | "syn 2.0.43", 762 | ] 763 | 764 | [[package]] 765 | name = "objc-sys" 766 | version = "0.3.2" 767 | source = "registry+https://github.com/rust-lang/crates.io-index" 768 | checksum = "c7c71324e4180d0899963fc83d9d241ac39e699609fc1025a850aadac8257459" 769 | 770 | [[package]] 771 | name = "objc2" 772 | version = "0.4.1" 773 | source = "registry+https://github.com/rust-lang/crates.io-index" 774 | checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d" 775 | dependencies = [ 776 | "objc-sys", 777 | "objc2-encode", 778 | ] 779 | 780 | [[package]] 781 | name = "objc2-encode" 782 | version = "3.0.0" 783 | source = "registry+https://github.com/rust-lang/crates.io-index" 784 | checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666" 785 | 786 | [[package]] 787 | name = "once_cell" 788 | version = "1.19.0" 789 | source = "registry+https://github.com/rust-lang/crates.io-index" 790 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" 791 | 792 | [[package]] 793 | name = "orbclient" 794 | version = "0.3.47" 795 | source = "registry+https://github.com/rust-lang/crates.io-index" 796 | checksum = "52f0d54bde9774d3a51dcf281a5def240c71996bc6ca05d2c847ec8b2b216166" 797 | dependencies = [ 798 | "libredox", 799 | ] 800 | 801 | [[package]] 802 | name = "owned_ttf_parser" 803 | version = "0.20.0" 804 | source = "registry+https://github.com/rust-lang/crates.io-index" 805 | checksum = "d4586edfe4c648c71797a74c84bacb32b52b212eff5dfe2bb9f2c599844023e7" 806 | dependencies = [ 807 | "ttf-parser", 808 | ] 809 | 810 | [[package]] 811 | name = "percent-encoding" 812 | version = "2.3.1" 813 | source = "registry+https://github.com/rust-lang/crates.io-index" 814 | checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" 815 | 816 | [[package]] 817 | name = "pico-args" 818 | version = "0.5.0" 819 | source = "registry+https://github.com/rust-lang/crates.io-index" 820 | checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" 821 | 822 | [[package]] 823 | name = "pin-project-lite" 824 | version = "0.2.13" 825 | source = "registry+https://github.com/rust-lang/crates.io-index" 826 | checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" 827 | 828 | [[package]] 829 | name = "pkg-config" 830 | version = "0.3.28" 831 | source = "registry+https://github.com/rust-lang/crates.io-index" 832 | checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" 833 | 834 | [[package]] 835 | name = "polling" 836 | version = "3.3.1" 837 | source = "registry+https://github.com/rust-lang/crates.io-index" 838 | checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e" 839 | dependencies = [ 840 | "cfg-if", 841 | "concurrent-queue", 842 | "pin-project-lite", 843 | "rustix", 844 | "tracing", 845 | "windows-sys 0.52.0", 846 | ] 847 | 848 | [[package]] 849 | name = "proc-macro-crate" 850 | version = "2.0.1" 851 | source = "registry+https://github.com/rust-lang/crates.io-index" 852 | checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a" 853 | dependencies = [ 854 | "toml_datetime", 855 | "toml_edit", 856 | ] 857 | 858 | [[package]] 859 | name = "proc-macro2" 860 | version = "1.0.71" 861 | source = "registry+https://github.com/rust-lang/crates.io-index" 862 | checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" 863 | dependencies = [ 864 | "unicode-ident", 865 | ] 866 | 867 | [[package]] 868 | name = "quick-xml" 869 | version = "0.30.0" 870 | source = "registry+https://github.com/rust-lang/crates.io-index" 871 | checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" 872 | dependencies = [ 873 | "memchr", 874 | ] 875 | 876 | [[package]] 877 | name = "quote" 878 | version = "1.0.33" 879 | source = "registry+https://github.com/rust-lang/crates.io-index" 880 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" 881 | dependencies = [ 882 | "proc-macro2", 883 | ] 884 | 885 | [[package]] 886 | name = "raw-window-handle" 887 | version = "0.6.0" 888 | source = "registry+https://github.com/rust-lang/crates.io-index" 889 | checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" 890 | 891 | [[package]] 892 | name = "redox_syscall" 893 | version = "0.3.5" 894 | source = "registry+https://github.com/rust-lang/crates.io-index" 895 | checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" 896 | dependencies = [ 897 | "bitflags 1.3.2", 898 | ] 899 | 900 | [[package]] 901 | name = "redox_syscall" 902 | version = "0.4.1" 903 | source = "registry+https://github.com/rust-lang/crates.io-index" 904 | checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" 905 | dependencies = [ 906 | "bitflags 1.3.2", 907 | ] 908 | 909 | [[package]] 910 | name = "regex" 911 | version = "1.10.2" 912 | source = "registry+https://github.com/rust-lang/crates.io-index" 913 | checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" 914 | dependencies = [ 915 | "aho-corasick", 916 | "memchr", 917 | "regex-automata", 918 | "regex-syntax", 919 | ] 920 | 921 | [[package]] 922 | name = "regex-automata" 923 | version = "0.4.3" 924 | source = "registry+https://github.com/rust-lang/crates.io-index" 925 | checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" 926 | dependencies = [ 927 | "aho-corasick", 928 | "memchr", 929 | "regex-syntax", 930 | ] 931 | 932 | [[package]] 933 | name = "regex-syntax" 934 | version = "0.8.2" 935 | source = "registry+https://github.com/rust-lang/crates.io-index" 936 | checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" 937 | 938 | [[package]] 939 | name = "run-wasm" 940 | version = "0.1.0" 941 | dependencies = [ 942 | "cargo-run-wasm", 943 | ] 944 | 945 | [[package]] 946 | name = "rustc-demangle" 947 | version = "0.1.23" 948 | source = "registry+https://github.com/rust-lang/crates.io-index" 949 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" 950 | 951 | [[package]] 952 | name = "rustix" 953 | version = "0.38.28" 954 | source = "registry+https://github.com/rust-lang/crates.io-index" 955 | checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" 956 | dependencies = [ 957 | "bitflags 2.4.1", 958 | "errno", 959 | "libc", 960 | "linux-raw-sys", 961 | "windows-sys 0.52.0", 962 | ] 963 | 964 | [[package]] 965 | name = "ryu" 966 | version = "1.0.16" 967 | source = "registry+https://github.com/rust-lang/crates.io-index" 968 | checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" 969 | 970 | [[package]] 971 | name = "safemem" 972 | version = "0.3.3" 973 | source = "registry+https://github.com/rust-lang/crates.io-index" 974 | checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" 975 | 976 | [[package]] 977 | name = "same-file" 978 | version = "1.0.6" 979 | source = "registry+https://github.com/rust-lang/crates.io-index" 980 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 981 | dependencies = [ 982 | "winapi-util", 983 | ] 984 | 985 | [[package]] 986 | name = "scoped-tls" 987 | version = "1.0.1" 988 | source = "registry+https://github.com/rust-lang/crates.io-index" 989 | checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" 990 | 991 | [[package]] 992 | name = "sctk-adwaita" 993 | version = "0.8.1" 994 | source = "registry+https://github.com/rust-lang/crates.io-index" 995 | checksum = "82b2eaf3a5b264a521b988b2e73042e742df700c4f962cde845d1541adb46550" 996 | dependencies = [ 997 | "ab_glyph", 998 | "log", 999 | "memmap2", 1000 | "smithay-client-toolkit", 1001 | "tiny-skia", 1002 | ] 1003 | 1004 | [[package]] 1005 | name = "serde" 1006 | version = "1.0.193" 1007 | source = "registry+https://github.com/rust-lang/crates.io-index" 1008 | checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" 1009 | dependencies = [ 1010 | "serde_derive", 1011 | ] 1012 | 1013 | [[package]] 1014 | name = "serde_derive" 1015 | version = "1.0.193" 1016 | source = "registry+https://github.com/rust-lang/crates.io-index" 1017 | checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" 1018 | dependencies = [ 1019 | "proc-macro2", 1020 | "quote", 1021 | "syn 2.0.43", 1022 | ] 1023 | 1024 | [[package]] 1025 | name = "serde_json" 1026 | version = "1.0.109" 1027 | source = "registry+https://github.com/rust-lang/crates.io-index" 1028 | checksum = "cb0652c533506ad7a2e353cce269330d6afd8bdfb6d75e0ace5b35aacbd7b9e9" 1029 | dependencies = [ 1030 | "itoa", 1031 | "ryu", 1032 | "serde", 1033 | ] 1034 | 1035 | [[package]] 1036 | name = "slab" 1037 | version = "0.4.9" 1038 | source = "registry+https://github.com/rust-lang/crates.io-index" 1039 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 1040 | dependencies = [ 1041 | "autocfg", 1042 | ] 1043 | 1044 | [[package]] 1045 | name = "smallvec" 1046 | version = "1.11.2" 1047 | source = "registry+https://github.com/rust-lang/crates.io-index" 1048 | checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" 1049 | 1050 | [[package]] 1051 | name = "smithay-client-toolkit" 1052 | version = "0.18.0" 1053 | source = "registry+https://github.com/rust-lang/crates.io-index" 1054 | checksum = "60e3d9941fa3bacf7c2bf4b065304faa14164151254cd16ce1b1bc8fc381600f" 1055 | dependencies = [ 1056 | "bitflags 2.4.1", 1057 | "calloop", 1058 | "calloop-wayland-source", 1059 | "cursor-icon", 1060 | "libc", 1061 | "log", 1062 | "memmap2", 1063 | "rustix", 1064 | "thiserror", 1065 | "wayland-backend", 1066 | "wayland-client", 1067 | "wayland-csd-frame", 1068 | "wayland-cursor", 1069 | "wayland-protocols", 1070 | "wayland-protocols-wlr", 1071 | "wayland-scanner", 1072 | "xkeysym", 1073 | ] 1074 | 1075 | [[package]] 1076 | name = "smol_str" 1077 | version = "0.2.0" 1078 | source = "registry+https://github.com/rust-lang/crates.io-index" 1079 | checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" 1080 | dependencies = [ 1081 | "serde", 1082 | ] 1083 | 1084 | [[package]] 1085 | name = "stable_deref_trait" 1086 | version = "1.2.0" 1087 | source = "registry+https://github.com/rust-lang/crates.io-index" 1088 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 1089 | 1090 | [[package]] 1091 | name = "strict-num" 1092 | version = "0.1.1" 1093 | source = "registry+https://github.com/rust-lang/crates.io-index" 1094 | checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" 1095 | 1096 | [[package]] 1097 | name = "syn" 1098 | version = "1.0.109" 1099 | source = "registry+https://github.com/rust-lang/crates.io-index" 1100 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1101 | dependencies = [ 1102 | "proc-macro2", 1103 | "quote", 1104 | "unicode-ident", 1105 | ] 1106 | 1107 | [[package]] 1108 | name = "syn" 1109 | version = "2.0.43" 1110 | source = "registry+https://github.com/rust-lang/crates.io-index" 1111 | checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" 1112 | dependencies = [ 1113 | "proc-macro2", 1114 | "quote", 1115 | "unicode-ident", 1116 | ] 1117 | 1118 | [[package]] 1119 | name = "tempfile" 1120 | version = "3.9.0" 1121 | source = "registry+https://github.com/rust-lang/crates.io-index" 1122 | checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" 1123 | dependencies = [ 1124 | "cfg-if", 1125 | "fastrand", 1126 | "redox_syscall 0.4.1", 1127 | "rustix", 1128 | "windows-sys 0.52.0", 1129 | ] 1130 | 1131 | [[package]] 1132 | name = "thiserror" 1133 | version = "1.0.52" 1134 | source = "registry+https://github.com/rust-lang/crates.io-index" 1135 | checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d" 1136 | dependencies = [ 1137 | "thiserror-impl", 1138 | ] 1139 | 1140 | [[package]] 1141 | name = "thiserror-impl" 1142 | version = "1.0.52" 1143 | source = "registry+https://github.com/rust-lang/crates.io-index" 1144 | checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3" 1145 | dependencies = [ 1146 | "proc-macro2", 1147 | "quote", 1148 | "syn 2.0.43", 1149 | ] 1150 | 1151 | [[package]] 1152 | name = "tiny-skia" 1153 | version = "0.11.3" 1154 | source = "registry+https://github.com/rust-lang/crates.io-index" 1155 | checksum = "b6a067b809476893fce6a254cf285850ff69c847e6cfbade6a20b655b6c7e80d" 1156 | dependencies = [ 1157 | "arrayref", 1158 | "arrayvec", 1159 | "bytemuck", 1160 | "cfg-if", 1161 | "log", 1162 | "tiny-skia-path", 1163 | ] 1164 | 1165 | [[package]] 1166 | name = "tiny-skia-path" 1167 | version = "0.11.3" 1168 | source = "registry+https://github.com/rust-lang/crates.io-index" 1169 | checksum = "5de35e8a90052baaaf61f171680ac2f8e925a1e43ea9d2e3a00514772250e541" 1170 | dependencies = [ 1171 | "arrayref", 1172 | "bytemuck", 1173 | "strict-num", 1174 | ] 1175 | 1176 | [[package]] 1177 | name = "toml_datetime" 1178 | version = "0.6.3" 1179 | source = "registry+https://github.com/rust-lang/crates.io-index" 1180 | checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" 1181 | 1182 | [[package]] 1183 | name = "toml_edit" 1184 | version = "0.20.2" 1185 | source = "registry+https://github.com/rust-lang/crates.io-index" 1186 | checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" 1187 | dependencies = [ 1188 | "indexmap 2.1.0", 1189 | "toml_datetime", 1190 | "winnow", 1191 | ] 1192 | 1193 | [[package]] 1194 | name = "tracing" 1195 | version = "0.1.40" 1196 | source = "registry+https://github.com/rust-lang/crates.io-index" 1197 | checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" 1198 | dependencies = [ 1199 | "pin-project-lite", 1200 | "tracing-core", 1201 | ] 1202 | 1203 | [[package]] 1204 | name = "tracing-core" 1205 | version = "0.1.32" 1206 | source = "registry+https://github.com/rust-lang/crates.io-index" 1207 | checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" 1208 | 1209 | [[package]] 1210 | name = "ttf-parser" 1211 | version = "0.20.0" 1212 | source = "registry+https://github.com/rust-lang/crates.io-index" 1213 | checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" 1214 | 1215 | [[package]] 1216 | name = "unicode-ident" 1217 | version = "1.0.12" 1218 | source = "registry+https://github.com/rust-lang/crates.io-index" 1219 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 1220 | 1221 | [[package]] 1222 | name = "unicode-segmentation" 1223 | version = "1.10.1" 1224 | source = "registry+https://github.com/rust-lang/crates.io-index" 1225 | checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" 1226 | 1227 | [[package]] 1228 | name = "utf8parse" 1229 | version = "0.2.1" 1230 | source = "registry+https://github.com/rust-lang/crates.io-index" 1231 | checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" 1232 | 1233 | [[package]] 1234 | name = "version_check" 1235 | version = "0.9.4" 1236 | source = "registry+https://github.com/rust-lang/crates.io-index" 1237 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1238 | 1239 | [[package]] 1240 | name = "walkdir" 1241 | version = "2.4.0" 1242 | source = "registry+https://github.com/rust-lang/crates.io-index" 1243 | checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" 1244 | dependencies = [ 1245 | "same-file", 1246 | "winapi-util", 1247 | ] 1248 | 1249 | [[package]] 1250 | name = "walrus" 1251 | version = "0.20.3" 1252 | source = "registry+https://github.com/rust-lang/crates.io-index" 1253 | checksum = "2c03529cd0c4400a2449f640d2f27cd1b48c3065226d15e26d98e4429ab0adb7" 1254 | dependencies = [ 1255 | "anyhow", 1256 | "gimli", 1257 | "id-arena", 1258 | "leb128", 1259 | "log", 1260 | "walrus-macro", 1261 | "wasm-encoder", 1262 | "wasmparser", 1263 | ] 1264 | 1265 | [[package]] 1266 | name = "walrus-macro" 1267 | version = "0.19.0" 1268 | source = "registry+https://github.com/rust-lang/crates.io-index" 1269 | checksum = "0a6e5bd22c71e77d60140b0bd5be56155a37e5bd14e24f5f87298040d0cc40d7" 1270 | dependencies = [ 1271 | "heck", 1272 | "proc-macro2", 1273 | "quote", 1274 | "syn 1.0.109", 1275 | ] 1276 | 1277 | [[package]] 1278 | name = "wasi" 1279 | version = "0.11.0+wasi-snapshot-preview1" 1280 | source = "registry+https://github.com/rust-lang/crates.io-index" 1281 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1282 | 1283 | [[package]] 1284 | name = "wasm-bindgen" 1285 | version = "0.2.89" 1286 | source = "registry+https://github.com/rust-lang/crates.io-index" 1287 | checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" 1288 | dependencies = [ 1289 | "cfg-if", 1290 | "wasm-bindgen-macro", 1291 | ] 1292 | 1293 | [[package]] 1294 | name = "wasm-bindgen-backend" 1295 | version = "0.2.89" 1296 | source = "registry+https://github.com/rust-lang/crates.io-index" 1297 | checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" 1298 | dependencies = [ 1299 | "bumpalo", 1300 | "log", 1301 | "once_cell", 1302 | "proc-macro2", 1303 | "quote", 1304 | "syn 2.0.43", 1305 | "wasm-bindgen-shared", 1306 | ] 1307 | 1308 | [[package]] 1309 | name = "wasm-bindgen-cli-support" 1310 | version = "0.2.89" 1311 | source = "registry+https://github.com/rust-lang/crates.io-index" 1312 | checksum = "cf8226e223e2dfbe8f921b7f20b82d1b5d86a6b143e9d6286cca8edd16695583" 1313 | dependencies = [ 1314 | "anyhow", 1315 | "base64", 1316 | "log", 1317 | "rustc-demangle", 1318 | "serde_json", 1319 | "tempfile", 1320 | "unicode-ident", 1321 | "walrus", 1322 | "wasm-bindgen-externref-xform", 1323 | "wasm-bindgen-multi-value-xform", 1324 | "wasm-bindgen-shared", 1325 | "wasm-bindgen-threads-xform", 1326 | "wasm-bindgen-wasm-conventions", 1327 | "wasm-bindgen-wasm-interpreter", 1328 | ] 1329 | 1330 | [[package]] 1331 | name = "wasm-bindgen-externref-xform" 1332 | version = "0.2.89" 1333 | source = "registry+https://github.com/rust-lang/crates.io-index" 1334 | checksum = "b8a719be856d8b0802c7195ca26ee6eb02cb9639a12b80be32db960ce9640cb8" 1335 | dependencies = [ 1336 | "anyhow", 1337 | "walrus", 1338 | ] 1339 | 1340 | [[package]] 1341 | name = "wasm-bindgen-futures" 1342 | version = "0.4.39" 1343 | source = "registry+https://github.com/rust-lang/crates.io-index" 1344 | checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" 1345 | dependencies = [ 1346 | "cfg-if", 1347 | "js-sys", 1348 | "wasm-bindgen", 1349 | "web-sys", 1350 | ] 1351 | 1352 | [[package]] 1353 | name = "wasm-bindgen-macro" 1354 | version = "0.2.89" 1355 | source = "registry+https://github.com/rust-lang/crates.io-index" 1356 | checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" 1357 | dependencies = [ 1358 | "quote", 1359 | "wasm-bindgen-macro-support", 1360 | ] 1361 | 1362 | [[package]] 1363 | name = "wasm-bindgen-macro-support" 1364 | version = "0.2.89" 1365 | source = "registry+https://github.com/rust-lang/crates.io-index" 1366 | checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" 1367 | dependencies = [ 1368 | "proc-macro2", 1369 | "quote", 1370 | "syn 2.0.43", 1371 | "wasm-bindgen-backend", 1372 | "wasm-bindgen-shared", 1373 | ] 1374 | 1375 | [[package]] 1376 | name = "wasm-bindgen-multi-value-xform" 1377 | version = "0.2.89" 1378 | source = "registry+https://github.com/rust-lang/crates.io-index" 1379 | checksum = "a12766255d4b9026700376cc81894eeb62903e4414cbc94675f6f9babd9cfb76" 1380 | dependencies = [ 1381 | "anyhow", 1382 | "walrus", 1383 | ] 1384 | 1385 | [[package]] 1386 | name = "wasm-bindgen-shared" 1387 | version = "0.2.89" 1388 | source = "registry+https://github.com/rust-lang/crates.io-index" 1389 | checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" 1390 | 1391 | [[package]] 1392 | name = "wasm-bindgen-threads-xform" 1393 | version = "0.2.89" 1394 | source = "registry+https://github.com/rust-lang/crates.io-index" 1395 | checksum = "13c2b14c5b9c2c7aa9dd1eb7161857de9783f40e98582e7f41f2d7c04ffdc155" 1396 | dependencies = [ 1397 | "anyhow", 1398 | "walrus", 1399 | "wasm-bindgen-wasm-conventions", 1400 | ] 1401 | 1402 | [[package]] 1403 | name = "wasm-bindgen-wasm-conventions" 1404 | version = "0.2.89" 1405 | source = "registry+https://github.com/rust-lang/crates.io-index" 1406 | checksum = "aaedf88769cb23c6fd2e3bfed65bcbff6c5d92c8336afbd80d2dfcc8eb5cf047" 1407 | dependencies = [ 1408 | "anyhow", 1409 | "walrus", 1410 | ] 1411 | 1412 | [[package]] 1413 | name = "wasm-bindgen-wasm-interpreter" 1414 | version = "0.2.89" 1415 | source = "registry+https://github.com/rust-lang/crates.io-index" 1416 | checksum = "a8a79039df1e0822e6d66508ec86052993deac201e26060f62abcd85e1daf951" 1417 | dependencies = [ 1418 | "anyhow", 1419 | "log", 1420 | "walrus", 1421 | "wasm-bindgen-wasm-conventions", 1422 | ] 1423 | 1424 | [[package]] 1425 | name = "wasm-encoder" 1426 | version = "0.29.0" 1427 | source = "registry+https://github.com/rust-lang/crates.io-index" 1428 | checksum = "18c41dbd92eaebf3612a39be316540b8377c871cb9bde6b064af962984912881" 1429 | dependencies = [ 1430 | "leb128", 1431 | ] 1432 | 1433 | [[package]] 1434 | name = "wasmparser" 1435 | version = "0.80.2" 1436 | source = "registry+https://github.com/rust-lang/crates.io-index" 1437 | checksum = "449167e2832691a1bff24cde28d2804e90e09586a448c8e76984792c44334a6b" 1438 | 1439 | [[package]] 1440 | name = "wayland-backend" 1441 | version = "0.3.2" 1442 | source = "registry+https://github.com/rust-lang/crates.io-index" 1443 | checksum = "19152ddd73f45f024ed4534d9ca2594e0ef252c1847695255dae47f34df9fbe4" 1444 | dependencies = [ 1445 | "cc", 1446 | "downcast-rs", 1447 | "nix", 1448 | "scoped-tls", 1449 | "smallvec", 1450 | "wayland-sys", 1451 | ] 1452 | 1453 | [[package]] 1454 | name = "wayland-client" 1455 | version = "0.31.1" 1456 | source = "registry+https://github.com/rust-lang/crates.io-index" 1457 | checksum = "1ca7d52347346f5473bf2f56705f360e8440873052e575e55890c4fa57843ed3" 1458 | dependencies = [ 1459 | "bitflags 2.4.1", 1460 | "nix", 1461 | "wayland-backend", 1462 | "wayland-scanner", 1463 | ] 1464 | 1465 | [[package]] 1466 | name = "wayland-csd-frame" 1467 | version = "0.3.0" 1468 | source = "registry+https://github.com/rust-lang/crates.io-index" 1469 | checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" 1470 | dependencies = [ 1471 | "bitflags 2.4.1", 1472 | "cursor-icon", 1473 | "wayland-backend", 1474 | ] 1475 | 1476 | [[package]] 1477 | name = "wayland-cursor" 1478 | version = "0.31.0" 1479 | source = "registry+https://github.com/rust-lang/crates.io-index" 1480 | checksum = "a44aa20ae986659d6c77d64d808a046996a932aa763913864dc40c359ef7ad5b" 1481 | dependencies = [ 1482 | "nix", 1483 | "wayland-client", 1484 | "xcursor", 1485 | ] 1486 | 1487 | [[package]] 1488 | name = "wayland-protocols" 1489 | version = "0.31.0" 1490 | source = "registry+https://github.com/rust-lang/crates.io-index" 1491 | checksum = "e253d7107ba913923dc253967f35e8561a3c65f914543e46843c88ddd729e21c" 1492 | dependencies = [ 1493 | "bitflags 2.4.1", 1494 | "wayland-backend", 1495 | "wayland-client", 1496 | "wayland-scanner", 1497 | ] 1498 | 1499 | [[package]] 1500 | name = "wayland-protocols-plasma" 1501 | version = "0.2.0" 1502 | source = "registry+https://github.com/rust-lang/crates.io-index" 1503 | checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" 1504 | dependencies = [ 1505 | "bitflags 2.4.1", 1506 | "wayland-backend", 1507 | "wayland-client", 1508 | "wayland-protocols", 1509 | "wayland-scanner", 1510 | ] 1511 | 1512 | [[package]] 1513 | name = "wayland-protocols-wlr" 1514 | version = "0.2.0" 1515 | source = "registry+https://github.com/rust-lang/crates.io-index" 1516 | checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" 1517 | dependencies = [ 1518 | "bitflags 2.4.1", 1519 | "wayland-backend", 1520 | "wayland-client", 1521 | "wayland-protocols", 1522 | "wayland-scanner", 1523 | ] 1524 | 1525 | [[package]] 1526 | name = "wayland-scanner" 1527 | version = "0.31.0" 1528 | source = "registry+https://github.com/rust-lang/crates.io-index" 1529 | checksum = "fb8e28403665c9f9513202b7e1ed71ec56fde5c107816843fb14057910b2c09c" 1530 | dependencies = [ 1531 | "proc-macro2", 1532 | "quick-xml", 1533 | "quote", 1534 | ] 1535 | 1536 | [[package]] 1537 | name = "wayland-sys" 1538 | version = "0.31.1" 1539 | source = "registry+https://github.com/rust-lang/crates.io-index" 1540 | checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af" 1541 | dependencies = [ 1542 | "dlib", 1543 | "log", 1544 | "once_cell", 1545 | "pkg-config", 1546 | ] 1547 | 1548 | [[package]] 1549 | name = "web-sys" 1550 | version = "0.3.66" 1551 | source = "registry+https://github.com/rust-lang/crates.io-index" 1552 | checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" 1553 | dependencies = [ 1554 | "js-sys", 1555 | "wasm-bindgen", 1556 | ] 1557 | 1558 | [[package]] 1559 | name = "web-time" 1560 | version = "0.2.4" 1561 | source = "registry+https://github.com/rust-lang/crates.io-index" 1562 | checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" 1563 | dependencies = [ 1564 | "js-sys", 1565 | "wasm-bindgen", 1566 | ] 1567 | 1568 | [[package]] 1569 | name = "web-time" 1570 | version = "1.0.0" 1571 | source = "registry+https://github.com/rust-lang/crates.io-index" 1572 | checksum = "2ee269d72cc29bf77a2c4bc689cc750fb39f5cbd493d2205bbb3f5c7779cf7b0" 1573 | dependencies = [ 1574 | "js-sys", 1575 | "wasm-bindgen", 1576 | ] 1577 | 1578 | [[package]] 1579 | name = "winapi" 1580 | version = "0.3.9" 1581 | source = "registry+https://github.com/rust-lang/crates.io-index" 1582 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1583 | dependencies = [ 1584 | "winapi-i686-pc-windows-gnu", 1585 | "winapi-x86_64-pc-windows-gnu", 1586 | ] 1587 | 1588 | [[package]] 1589 | name = "winapi-i686-pc-windows-gnu" 1590 | version = "0.4.0" 1591 | source = "registry+https://github.com/rust-lang/crates.io-index" 1592 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1593 | 1594 | [[package]] 1595 | name = "winapi-util" 1596 | version = "0.1.6" 1597 | source = "registry+https://github.com/rust-lang/crates.io-index" 1598 | checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" 1599 | dependencies = [ 1600 | "winapi", 1601 | ] 1602 | 1603 | [[package]] 1604 | name = "winapi-x86_64-pc-windows-gnu" 1605 | version = "0.4.0" 1606 | source = "registry+https://github.com/rust-lang/crates.io-index" 1607 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1608 | 1609 | [[package]] 1610 | name = "windows-sys" 1611 | version = "0.45.0" 1612 | source = "registry+https://github.com/rust-lang/crates.io-index" 1613 | checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" 1614 | dependencies = [ 1615 | "windows-targets 0.42.2", 1616 | ] 1617 | 1618 | [[package]] 1619 | name = "windows-sys" 1620 | version = "0.48.0" 1621 | source = "registry+https://github.com/rust-lang/crates.io-index" 1622 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1623 | dependencies = [ 1624 | "windows-targets 0.48.5", 1625 | ] 1626 | 1627 | [[package]] 1628 | name = "windows-sys" 1629 | version = "0.52.0" 1630 | source = "registry+https://github.com/rust-lang/crates.io-index" 1631 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 1632 | dependencies = [ 1633 | "windows-targets 0.52.0", 1634 | ] 1635 | 1636 | [[package]] 1637 | name = "windows-targets" 1638 | version = "0.42.2" 1639 | source = "registry+https://github.com/rust-lang/crates.io-index" 1640 | checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" 1641 | dependencies = [ 1642 | "windows_aarch64_gnullvm 0.42.2", 1643 | "windows_aarch64_msvc 0.42.2", 1644 | "windows_i686_gnu 0.42.2", 1645 | "windows_i686_msvc 0.42.2", 1646 | "windows_x86_64_gnu 0.42.2", 1647 | "windows_x86_64_gnullvm 0.42.2", 1648 | "windows_x86_64_msvc 0.42.2", 1649 | ] 1650 | 1651 | [[package]] 1652 | name = "windows-targets" 1653 | version = "0.48.5" 1654 | source = "registry+https://github.com/rust-lang/crates.io-index" 1655 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 1656 | dependencies = [ 1657 | "windows_aarch64_gnullvm 0.48.5", 1658 | "windows_aarch64_msvc 0.48.5", 1659 | "windows_i686_gnu 0.48.5", 1660 | "windows_i686_msvc 0.48.5", 1661 | "windows_x86_64_gnu 0.48.5", 1662 | "windows_x86_64_gnullvm 0.48.5", 1663 | "windows_x86_64_msvc 0.48.5", 1664 | ] 1665 | 1666 | [[package]] 1667 | name = "windows-targets" 1668 | version = "0.52.0" 1669 | source = "registry+https://github.com/rust-lang/crates.io-index" 1670 | checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" 1671 | dependencies = [ 1672 | "windows_aarch64_gnullvm 0.52.0", 1673 | "windows_aarch64_msvc 0.52.0", 1674 | "windows_i686_gnu 0.52.0", 1675 | "windows_i686_msvc 0.52.0", 1676 | "windows_x86_64_gnu 0.52.0", 1677 | "windows_x86_64_gnullvm 0.52.0", 1678 | "windows_x86_64_msvc 0.52.0", 1679 | ] 1680 | 1681 | [[package]] 1682 | name = "windows_aarch64_gnullvm" 1683 | version = "0.42.2" 1684 | source = "registry+https://github.com/rust-lang/crates.io-index" 1685 | checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" 1686 | 1687 | [[package]] 1688 | name = "windows_aarch64_gnullvm" 1689 | version = "0.48.5" 1690 | source = "registry+https://github.com/rust-lang/crates.io-index" 1691 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 1692 | 1693 | [[package]] 1694 | name = "windows_aarch64_gnullvm" 1695 | version = "0.52.0" 1696 | source = "registry+https://github.com/rust-lang/crates.io-index" 1697 | checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" 1698 | 1699 | [[package]] 1700 | name = "windows_aarch64_msvc" 1701 | version = "0.42.2" 1702 | source = "registry+https://github.com/rust-lang/crates.io-index" 1703 | checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" 1704 | 1705 | [[package]] 1706 | name = "windows_aarch64_msvc" 1707 | version = "0.48.5" 1708 | source = "registry+https://github.com/rust-lang/crates.io-index" 1709 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 1710 | 1711 | [[package]] 1712 | name = "windows_aarch64_msvc" 1713 | version = "0.52.0" 1714 | source = "registry+https://github.com/rust-lang/crates.io-index" 1715 | checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" 1716 | 1717 | [[package]] 1718 | name = "windows_i686_gnu" 1719 | version = "0.42.2" 1720 | source = "registry+https://github.com/rust-lang/crates.io-index" 1721 | checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" 1722 | 1723 | [[package]] 1724 | name = "windows_i686_gnu" 1725 | version = "0.48.5" 1726 | source = "registry+https://github.com/rust-lang/crates.io-index" 1727 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 1728 | 1729 | [[package]] 1730 | name = "windows_i686_gnu" 1731 | version = "0.52.0" 1732 | source = "registry+https://github.com/rust-lang/crates.io-index" 1733 | checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" 1734 | 1735 | [[package]] 1736 | name = "windows_i686_msvc" 1737 | version = "0.42.2" 1738 | source = "registry+https://github.com/rust-lang/crates.io-index" 1739 | checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" 1740 | 1741 | [[package]] 1742 | name = "windows_i686_msvc" 1743 | version = "0.48.5" 1744 | source = "registry+https://github.com/rust-lang/crates.io-index" 1745 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 1746 | 1747 | [[package]] 1748 | name = "windows_i686_msvc" 1749 | version = "0.52.0" 1750 | source = "registry+https://github.com/rust-lang/crates.io-index" 1751 | checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" 1752 | 1753 | [[package]] 1754 | name = "windows_x86_64_gnu" 1755 | version = "0.42.2" 1756 | source = "registry+https://github.com/rust-lang/crates.io-index" 1757 | checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" 1758 | 1759 | [[package]] 1760 | name = "windows_x86_64_gnu" 1761 | version = "0.48.5" 1762 | source = "registry+https://github.com/rust-lang/crates.io-index" 1763 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 1764 | 1765 | [[package]] 1766 | name = "windows_x86_64_gnu" 1767 | version = "0.52.0" 1768 | source = "registry+https://github.com/rust-lang/crates.io-index" 1769 | checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" 1770 | 1771 | [[package]] 1772 | name = "windows_x86_64_gnullvm" 1773 | version = "0.42.2" 1774 | source = "registry+https://github.com/rust-lang/crates.io-index" 1775 | checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" 1776 | 1777 | [[package]] 1778 | name = "windows_x86_64_gnullvm" 1779 | version = "0.48.5" 1780 | source = "registry+https://github.com/rust-lang/crates.io-index" 1781 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 1782 | 1783 | [[package]] 1784 | name = "windows_x86_64_gnullvm" 1785 | version = "0.52.0" 1786 | source = "registry+https://github.com/rust-lang/crates.io-index" 1787 | checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" 1788 | 1789 | [[package]] 1790 | name = "windows_x86_64_msvc" 1791 | version = "0.42.2" 1792 | source = "registry+https://github.com/rust-lang/crates.io-index" 1793 | checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" 1794 | 1795 | [[package]] 1796 | name = "windows_x86_64_msvc" 1797 | version = "0.48.5" 1798 | source = "registry+https://github.com/rust-lang/crates.io-index" 1799 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 1800 | 1801 | [[package]] 1802 | name = "windows_x86_64_msvc" 1803 | version = "0.52.0" 1804 | source = "registry+https://github.com/rust-lang/crates.io-index" 1805 | checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" 1806 | 1807 | [[package]] 1808 | name = "winit" 1809 | version = "0.29.7" 1810 | source = "registry+https://github.com/rust-lang/crates.io-index" 1811 | checksum = "7fd430cd4560ee9c48885a4ef473b609a56796e37b1e18222abee146143f7457" 1812 | dependencies = [ 1813 | "ahash", 1814 | "android-activity", 1815 | "atomic-waker", 1816 | "bitflags 2.4.1", 1817 | "bytemuck", 1818 | "calloop", 1819 | "cfg_aliases", 1820 | "core-foundation", 1821 | "core-graphics", 1822 | "cursor-icon", 1823 | "icrate", 1824 | "js-sys", 1825 | "libc", 1826 | "log", 1827 | "memmap2", 1828 | "ndk", 1829 | "ndk-sys", 1830 | "objc2", 1831 | "once_cell", 1832 | "orbclient", 1833 | "percent-encoding", 1834 | "raw-window-handle", 1835 | "redox_syscall 0.3.5", 1836 | "rustix", 1837 | "sctk-adwaita", 1838 | "smithay-client-toolkit", 1839 | "smol_str", 1840 | "unicode-segmentation", 1841 | "wasm-bindgen", 1842 | "wasm-bindgen-futures", 1843 | "wayland-backend", 1844 | "wayland-client", 1845 | "wayland-protocols", 1846 | "wayland-protocols-plasma", 1847 | "web-sys", 1848 | "web-time 0.2.4", 1849 | "windows-sys 0.48.0", 1850 | "x11-dl", 1851 | "x11rb", 1852 | "xkbcommon-dl", 1853 | ] 1854 | 1855 | [[package]] 1856 | name = "winit_input_helper" 1857 | version = "0.16.0" 1858 | dependencies = [ 1859 | "console_error_panic_hook", 1860 | "console_log", 1861 | "env_logger", 1862 | "log", 1863 | "web-time 1.0.0", 1864 | "winit", 1865 | ] 1866 | 1867 | [[package]] 1868 | name = "winnow" 1869 | version = "0.5.31" 1870 | source = "registry+https://github.com/rust-lang/crates.io-index" 1871 | checksum = "97a4882e6b134d6c28953a387571f1acdd3496830d5e36c5e3a1075580ea641c" 1872 | dependencies = [ 1873 | "memchr", 1874 | ] 1875 | 1876 | [[package]] 1877 | name = "x11-dl" 1878 | version = "2.21.0" 1879 | source = "registry+https://github.com/rust-lang/crates.io-index" 1880 | checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" 1881 | dependencies = [ 1882 | "libc", 1883 | "once_cell", 1884 | "pkg-config", 1885 | ] 1886 | 1887 | [[package]] 1888 | name = "x11rb" 1889 | version = "0.13.0" 1890 | source = "registry+https://github.com/rust-lang/crates.io-index" 1891 | checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a" 1892 | dependencies = [ 1893 | "as-raw-xcb-connection", 1894 | "gethostname", 1895 | "libc", 1896 | "libloading", 1897 | "once_cell", 1898 | "rustix", 1899 | "x11rb-protocol", 1900 | ] 1901 | 1902 | [[package]] 1903 | name = "x11rb-protocol" 1904 | version = "0.13.0" 1905 | source = "registry+https://github.com/rust-lang/crates.io-index" 1906 | checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34" 1907 | 1908 | [[package]] 1909 | name = "xcursor" 1910 | version = "0.3.5" 1911 | source = "registry+https://github.com/rust-lang/crates.io-index" 1912 | checksum = "6a0ccd7b4a5345edfcd0c3535718a4e9ff7798ffc536bb5b5a0e26ff84732911" 1913 | 1914 | [[package]] 1915 | name = "xkbcommon-dl" 1916 | version = "0.4.1" 1917 | source = "registry+https://github.com/rust-lang/crates.io-index" 1918 | checksum = "6924668544c48c0133152e7eec86d644a056ca3d09275eb8d5cdb9855f9d8699" 1919 | dependencies = [ 1920 | "bitflags 2.4.1", 1921 | "dlib", 1922 | "log", 1923 | "once_cell", 1924 | "xkeysym", 1925 | ] 1926 | 1927 | [[package]] 1928 | name = "xkeysym" 1929 | version = "0.2.0" 1930 | source = "registry+https://github.com/rust-lang/crates.io-index" 1931 | checksum = "054a8e68b76250b253f671d1268cb7f1ae089ec35e195b2efb2a4e9a836d0621" 1932 | 1933 | [[package]] 1934 | name = "zerocopy" 1935 | version = "0.7.32" 1936 | source = "registry+https://github.com/rust-lang/crates.io-index" 1937 | checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" 1938 | dependencies = [ 1939 | "zerocopy-derive", 1940 | ] 1941 | 1942 | [[package]] 1943 | name = "zerocopy-derive" 1944 | version = "0.7.32" 1945 | source = "registry+https://github.com/rust-lang/crates.io-index" 1946 | checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" 1947 | dependencies = [ 1948 | "proc-macro2", 1949 | "quote", 1950 | "syn 2.0.43", 1951 | ] 1952 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "winit_input_helper" 3 | repository = "https://github.com/rukai/winit_input_helper" 4 | version = "0.16.0" 5 | edition = "2021" 6 | authors = ["Rukai "] 7 | license = "MIT" 8 | description = "Processes winit events, allowing input state to be queried at any time." 9 | keywords = ["winit", "input", "helper", "state", "cache"] 10 | categories = ["game-engines", "os", "gui"] 11 | 12 | [dependencies] 13 | winit = { version = "0.29", default-features = false } 14 | web-time = "1.0" 15 | 16 | [dev-dependencies] 17 | winit = { version = "0.29" } 18 | log = "0.4" 19 | console_log = "1.0" 20 | console_error_panic_hook = "0.1" 21 | env_logger = "0.11" 22 | 23 | [package.metadata.docs.rs] 24 | features = ["winit/default"] 25 | 26 | [workspace] 27 | members = [ 28 | "run-wasm", 29 | ] 30 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | This changelog is written with the goal of helping you through breaking changes rather than being a complete documentation of every change in the release. 4 | 5 | ## 0.16 6 | 7 | * `WinitInputHelper::quit` is removed, instead use `input.close_requested() || input.destroyed()` for an equivalent check 8 | * Mouse APIs now use instead of a usize 9 | * `WinitInputHeler::text` now returns instead of the now deleted `TextChar` type 10 | 11 | ## 0.15 12 | 13 | Upgraded to winit 0.29. 14 | Winit 0.29 completely overhauled its keyboard API, which meant that I had to also overhaul our keyboard API. 15 | 16 | Previously winit_input_helper favored logical keys over physical keys (previously called scancodes). 17 | But this was a mistake, driven by winit's poor support for physical keys and mistaken simplification of logical keys. 18 | Winit has now fixed these mistakes and as a result winit_input_helper is now swapping to favor physical keys. 19 | 20 | A direct translation of the previous API to the new API: 21 | 22 | ```rust 23 | 24 | // old 25 | input.key_pressed_scancode(17); // US scan code for W 26 | // new 27 | input.key_presed(winit::keyboard::KeyCode::KeyW); 28 | 29 | // old 30 | input.key_pressed(winit::event::VirtualKeyCode::KeyW); 31 | // new 32 | input.key_presed_logical(winit::keyboard::Key::Character("w")); // WARNING: this likely wont actually do what you want, this will never return true while shift is held since that is considered as `W` instead of `w` 33 | 34 | // ... other keyboard methods follow the same pattern 35 | ``` 36 | 37 | However, I actually suggest you move to physical keys: 38 | 39 | ```rust 40 | // old 41 | input.key_pressed_scancode(17); // US scan code for W 42 | // new 43 | input.key_presed(winit::keyboard::KeyCode::KeyW); 44 | 45 | // old 46 | input.key_pressed(winit::event::VirtualKeyCode::W); 47 | // new 48 | input.key_presed(winit::keyboard::KeyCode::KeyW); 49 | ``` 50 | -------------------------------------------------------------------------------- /examples/example.rs: -------------------------------------------------------------------------------- 1 | //! A complex example demonstrating use of every API feature, runs on both desktop and web. 2 | //! To run on desktop: `cargo run --example example` 3 | //! To run on web: `cargo run-wasm --example example` 4 | use winit::event::MouseButton; 5 | use winit::event_loop::EventLoop; 6 | use winit::keyboard::{Key, KeyCode}; 7 | use winit_input_helper::WinitInputHelper; 8 | 9 | fn main() { 10 | platform::init(); 11 | 12 | let mut input = WinitInputHelper::new(); 13 | 14 | let event_loop = EventLoop::new().unwrap(); 15 | 16 | let _window = platform::create_window(&event_loop); 17 | 18 | event_loop 19 | .run(move |event, elwt| { 20 | // Pass every event to the WinitInputHelper. 21 | // It will return true when the last event has been processed and it is time to run your application logic. 22 | if input.update(&event) { 23 | if input.key_released(KeyCode::KeyQ) || input.close_requested() || input.destroyed() 24 | { 25 | log::info!("The application was requsted to close or the 'Q' key was pressed, quiting the application"); 26 | elwt.exit(); 27 | return; 28 | } 29 | 30 | // If you are taking input for a game or similar you should use physical keys. 31 | 32 | if input.key_pressed(KeyCode::KeyW) { 33 | log::info!("The 'W' key (US layout) was pressed on the keyboard"); 34 | } 35 | 36 | if input.key_pressed_os(KeyCode::KeyE) { 37 | log::info!( 38 | "The 'E' key (US layout) was pressed on the keyboard (Os Repeating)" 39 | ); 40 | } 41 | 42 | if input.key_held(KeyCode::KeyR) { 43 | log::info!("The 'R' key (US layout) is held"); 44 | } 45 | 46 | // Logical keys are usually used for text input and rarely make sense in the way they are presented in this API. 47 | 48 | if input.key_pressed_logical(Key::Character("a")) { 49 | log::info!("'a' was input by the keyboard"); 50 | } 51 | 52 | if input.key_pressed_logical(Key::Character("A")) { 53 | log::info!("'A' was input by the keyboard (detected seperately to 'a')"); 54 | } 55 | 56 | if input.key_pressed_os_logical(Key::Character("s")) { 57 | log::info!("'s' was input by the keyboard (OS repeating)"); 58 | } 59 | 60 | if input.key_held_logical(Key::Character("d")) { 61 | log::info!("`d` input is held on the keyboard"); 62 | } 63 | 64 | // query the change in cursor this update 65 | let cursor_diff = input.cursor_diff(); 66 | if cursor_diff != (0.0, 0.0) { 67 | log::info!("The cursor diff is: {:?}", cursor_diff); 68 | log::info!("The cursor position is: {:?}", input.cursor()); 69 | } 70 | 71 | // query the change in mouse this update (useful for first person camera controls) 72 | let mouse_diff = input.mouse_diff(); 73 | if mouse_diff != (0.0, 0.0) { 74 | log::info!("The mouse diff is: {:?}", mouse_diff); 75 | } 76 | 77 | let scroll_diff = input.scroll_diff(); 78 | if scroll_diff != (0.0, 0.0) { 79 | log::info!("The scroll diff is: {:?}", scroll_diff); 80 | } 81 | 82 | 83 | for button in [MouseButton::Left, MouseButton::Right, MouseButton::Middle] { 84 | if input.mouse_pressed(button) { 85 | log::info!("The {:?} mouse button was pressed", button); 86 | } 87 | 88 | if input.mouse_held(button) { 89 | log::info!("The {:?} mouse button is being held", button); 90 | } 91 | 92 | if input.mouse_released(button) { 93 | log::info!("The {:?} mouse button was released", button); 94 | } 95 | } 96 | 97 | 98 | // You are expected to control your own timing within this block. 99 | // Usually via rendering with vsync. 100 | // render(); 101 | } 102 | }) 103 | .unwrap(); 104 | } 105 | 106 | #[cfg(target_arch = "wasm32")] 107 | mod platform { 108 | use winit::event_loop::EventLoop; 109 | use winit::platform::web::WindowBuilderExtWebSys; 110 | use winit::platform::web::WindowExtWebSys; 111 | use winit::window::{Window, WindowBuilder}; 112 | 113 | pub fn create_window(event_loop: &EventLoop<()>) -> Window { 114 | let window = WindowBuilder::new() 115 | .with_append(true) 116 | .build(event_loop) 117 | .unwrap(); 118 | 119 | // Set a background color for the canvas to make it easier to tell the where the canvas is for debugging purposes. 120 | let canvas = window.canvas().unwrap(); 121 | canvas.style().set_css_text( 122 | "display: block; background-color: crimson; margin: auto; width: 50%; aspect-ratio: 4 / 2;", 123 | ); 124 | window 125 | } 126 | 127 | pub fn init() { 128 | std::panic::set_hook(Box::new(console_error_panic_hook::hook)); 129 | console_log::init_with_level(log::Level::Info).expect("could not initialize logger"); 130 | } 131 | } 132 | 133 | #[cfg(not(target_arch = "wasm32"))] 134 | mod platform { 135 | use winit::event_loop::EventLoop; 136 | use winit::window::{Window, WindowBuilder}; 137 | 138 | pub fn create_window(event_loop: &EventLoop<()>) -> Window { 139 | WindowBuilder::new().build(event_loop).unwrap() 140 | } 141 | 142 | pub fn init() { 143 | env_logger::init_from_env(env_logger::Env::default().filter_or("RUST_LOG", "info")); 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /examples/simple.rs: -------------------------------------------------------------------------------- 1 | //! The simplest example, supporting only desktop applications. 2 | 3 | use winit::event_loop::EventLoop; 4 | use winit::keyboard::KeyCode; 5 | use winit::window::WindowBuilder; 6 | use winit_input_helper::WinitInputHelper; 7 | 8 | fn main() { 9 | let mut input = WinitInputHelper::new(); 10 | 11 | let event_loop = EventLoop::new().unwrap(); 12 | let _window = WindowBuilder::new().build(&event_loop).unwrap(); 13 | 14 | event_loop 15 | .run(move |event, elwt| { 16 | // Pass every event to the WinitInputHelper. 17 | // It will return true when the last event has been processed and it is time to run your application logic. 18 | if input.update(&event) { 19 | if input.key_released(KeyCode::KeyQ) || input.close_requested() || input.destroyed() 20 | { 21 | println!("The application was requsted to close or the 'Q' key was pressed, quiting the application"); 22 | elwt.exit(); 23 | return; 24 | } 25 | 26 | if input.key_pressed(KeyCode::KeyW) { 27 | println!("The 'W' key (US layout) was pressed on the keyboard"); 28 | } 29 | 30 | 31 | // You are expected to control your own timing within this block. 32 | // Usually via rendering with vsync. 33 | // render(); 34 | } 35 | }) 36 | .unwrap(); 37 | } 38 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Lucas Kent 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | 12 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Winit Input Helper 2 | 3 | [![Crates.io](https://img.shields.io/crates/v/winit_input_helper.svg)](https://crates.io/crates/winit_input_helper) 4 | [![Docs](https://docs.rs/winit_input_helper/badge.svg)](https://docs.rs/winit_input_helper) 5 | 6 | Processes and stores winit events, allowing input state to be queried at any time. 7 | 8 | ## How to use 9 | 10 | Each event is passed to the `WinitInputHelper` via the `update` method. 11 | 12 | The current input state can then be accessed via methods such as `key_pressed`, `key_released`, `key_held`, `mouse`, `mouse_diff` etc. 13 | 14 | To see all available methods look at [docs.rs](https://docs.rs/winit_input_helper) 15 | 16 | ```rust 17 | use winit::event_loop::EventLoop; 18 | use winit::keyboard::{Key, KeyCode}; 19 | use winit::window::WindowBuilder; 20 | use winit_input_helper::WinitInputHelper; 21 | 22 | fn main() { 23 | let mut input = WinitInputHelper::new(); 24 | 25 | let event_loop = EventLoop::new().unwrap(); 26 | let _window = WindowBuilder::new().build(&event_loop).unwrap(); 27 | 28 | event_loop 29 | .run(move |event, elwt| { 30 | // Pass every event to the WinitInputHelper. 31 | // It will return true when the last event has been processed and it is time to run your application logic. 32 | if input.update(&event) { 33 | if input.key_released(KeyCode::KeyQ) || input.close_requested() || input.destroyed() 34 | { 35 | elwt.exit(); 36 | return; 37 | } 38 | 39 | if input.key_pressed(KeyCode::KeyW) { 40 | println!("The 'W' key (US layout) was pressed on the keyboard"); 41 | } 42 | 43 | if input.key_held(KeyCode::KeyR) { 44 | println!("The 'R' key (US layout) key is held"); 45 | } 46 | 47 | // query the change in cursor this update 48 | let cursor_diff = input.cursor_diff(); 49 | if cursor_diff != (0.0, 0.0) { 50 | println!("The cursor diff is: {:?}", cursor_diff); 51 | println!("The cursor position is: {:?}", input.cursor()); 52 | } 53 | 54 | // You are expected to control your own timing within this block. 55 | // Usually via rendering with vsync. 56 | // render(); 57 | } 58 | }) 59 | .unwrap(); 60 | } 61 | ``` 62 | 63 | ## Publishing a new version 64 | 65 | In order to avoid forcing the user to enable the default winit backends, winit_input_helper sets its winit dependency to `default-features = false`. 66 | This complicates the publishing procedure a little because winit cannot compile without any backends enabled. 67 | 68 | So to publish we run: `cargo publish --features winit/default` 69 | -------------------------------------------------------------------------------- /run-wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run-wasm" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | cargo-run-wasm = "0.3.0" 10 | -------------------------------------------------------------------------------- /run-wasm/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | cargo_run_wasm::run_wasm_with_css("body { margin: 0px; }"); 3 | } 4 | -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "1.75" 3 | components = [ "rustfmt", "clippy" ] 4 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rukai/winit_input_helper/317154aa5e5bb79eae4b549f1de2758cbbd0acc7/rustfmt.toml -------------------------------------------------------------------------------- /src/current_input.rs: -------------------------------------------------------------------------------- 1 | use winit::event::{DeviceEvent, ElementState, MouseButton, MouseScrollDelta, WindowEvent}; 2 | use winit::keyboard::{Key, PhysicalKey}; 3 | 4 | #[derive(Clone)] 5 | pub struct CurrentInput { 6 | pub mouse_actions: Vec, 7 | pub key_actions: Vec, 8 | pub scancode_actions: Vec, 9 | pub key_held: Vec, 10 | pub scancode_held: Vec, // some scan codes are higher than 255 so using an array may be dangerous 11 | pub mouse_held: [bool; 255], 12 | pub cursor_point: Option<(f32, f32)>, 13 | pub cursor_point_prev: Option<(f32, f32)>, 14 | pub mouse_diff: Option<(f32, f32)>, 15 | pub y_scroll_diff: f32, 16 | pub x_scroll_diff: f32, 17 | pub text: Vec, 18 | } 19 | 20 | impl CurrentInput { 21 | pub fn new() -> CurrentInput { 22 | CurrentInput { 23 | mouse_actions: vec![], 24 | key_actions: vec![], 25 | scancode_actions: vec![], 26 | key_held: vec![], 27 | scancode_held: vec![], 28 | mouse_held: [false; 255], 29 | cursor_point: None, 30 | cursor_point_prev: None, 31 | mouse_diff: None, 32 | y_scroll_diff: 0.0, 33 | x_scroll_diff: 0.0, 34 | text: vec![], 35 | } 36 | } 37 | 38 | pub fn step(&mut self) { 39 | self.mouse_actions.clear(); 40 | self.key_actions.clear(); 41 | self.scancode_actions.clear(); 42 | self.cursor_point_prev = self.cursor_point; 43 | self.mouse_diff = None; 44 | self.y_scroll_diff = 0.0; 45 | self.x_scroll_diff = 0.0; 46 | self.text.clear(); 47 | } 48 | 49 | pub fn handle_event(&mut self, event: &WindowEvent) { 50 | match event { 51 | WindowEvent::KeyboardInput { event, .. } => match event.state { 52 | ElementState::Pressed => { 53 | let logical_key = &event.logical_key; 54 | if !self.key_held.contains(logical_key) { 55 | self.key_actions 56 | .push(KeyAction::Pressed(logical_key.clone())); 57 | } 58 | 59 | self.key_held.push(logical_key.clone()); 60 | self.key_actions 61 | .push(KeyAction::PressedOs(logical_key.clone())); 62 | self.text.push(logical_key.clone()); 63 | 64 | let physical_key = &event.physical_key; 65 | if !self.scancode_held.contains(physical_key) { 66 | self.scancode_actions 67 | .push(ScanCodeAction::Pressed(*physical_key)); 68 | self.scancode_held.push(*physical_key); 69 | } 70 | 71 | self.scancode_actions 72 | .push(ScanCodeAction::PressedOs(*physical_key)); 73 | } 74 | ElementState::Released => { 75 | let logical_key = &event.logical_key; 76 | self.key_held.retain(|x| x != logical_key); 77 | self.key_actions 78 | .push(KeyAction::Released(logical_key.clone())); 79 | 80 | let physical_key = &event.physical_key; 81 | self.scancode_held.retain(|x| x != physical_key); 82 | self.scancode_actions 83 | .push(ScanCodeAction::Released(*physical_key)); 84 | } 85 | }, 86 | WindowEvent::CursorMoved { position, .. } => { 87 | self.cursor_point = Some((position.x as f32, position.y as f32)); 88 | } 89 | WindowEvent::MouseInput { 90 | state: ElementState::Pressed, 91 | button, 92 | .. 93 | } => { 94 | let button_usize = mouse_button_to_int(button); 95 | self.mouse_held[button_usize] = true; 96 | self.mouse_actions.push(MouseAction::Pressed(*button)); 97 | } 98 | WindowEvent::MouseInput { 99 | state: ElementState::Released, 100 | button, 101 | .. 102 | } => { 103 | let button_usize = mouse_button_to_int(button); 104 | self.mouse_held[button_usize] = false; 105 | self.mouse_actions.push(MouseAction::Released(*button)); 106 | } 107 | WindowEvent::MouseWheel { delta, .. } => { 108 | // I just took this from three-rs, no idea why this magic number was chosen ¯\_(ツ)_/¯ 109 | const PIXELS_PER_LINE: f64 = 38.0; 110 | 111 | match delta { 112 | MouseScrollDelta::LineDelta(x, y) => { 113 | self.x_scroll_diff += x; 114 | self.y_scroll_diff += y; 115 | } 116 | MouseScrollDelta::PixelDelta(delta) => { 117 | self.y_scroll_diff += (delta.y / PIXELS_PER_LINE) as f32; 118 | self.x_scroll_diff += (delta.x / PIXELS_PER_LINE) as f32; 119 | } 120 | } 121 | } 122 | _ => {} 123 | } 124 | } 125 | 126 | pub fn handle_device_event(&mut self, event: &DeviceEvent) { 127 | if let DeviceEvent::MouseMotion { delta, .. } = event { 128 | match self.mouse_diff { 129 | Some((x, y)) => self.mouse_diff = Some((x + delta.0 as f32, y + delta.1 as f32)), 130 | None => self.mouse_diff = Some((delta.0 as f32, delta.1 as f32)), 131 | } 132 | } 133 | } 134 | } 135 | 136 | #[derive(Clone)] 137 | pub enum KeyAction { 138 | Pressed(Key), 139 | PressedOs(Key), 140 | Released(Key), 141 | } 142 | 143 | #[derive(Clone, PartialEq)] 144 | pub enum ScanCodeAction { 145 | Pressed(PhysicalKey), 146 | PressedOs(PhysicalKey), 147 | Released(PhysicalKey), 148 | } 149 | 150 | #[derive(Clone)] 151 | pub enum MouseAction { 152 | Pressed(MouseButton), 153 | Released(MouseButton), 154 | } 155 | 156 | pub fn mouse_button_to_int(button: &MouseButton) -> usize { 157 | match button { 158 | MouseButton::Left => 0, 159 | MouseButton::Right => 1, 160 | MouseButton::Middle => 2, 161 | MouseButton::Back => 3, 162 | MouseButton::Forward => 4, 163 | MouseButton::Other(byte) => 5 + *byte as usize, 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | mod current_input; 2 | mod winit_input_helper; 3 | 4 | pub use crate::winit_input_helper::WinitInputHelper; 5 | -------------------------------------------------------------------------------- /src/winit_input_helper.rs: -------------------------------------------------------------------------------- 1 | use winit::dpi::PhysicalSize; 2 | use winit::event::{DeviceEvent, Event, MouseButton, WindowEvent}; 3 | use winit::keyboard::{Key, KeyCode, PhysicalKey}; 4 | 5 | use crate::current_input::{ 6 | mouse_button_to_int, CurrentInput, KeyAction, MouseAction, ScanCodeAction, 7 | }; 8 | use std::{path::PathBuf, time::Duration}; 9 | use web_time::Instant; 10 | /// The main struct of the API. 11 | /// 12 | /// Create with `WinitInputHelper::new`. 13 | /// Call `WinitInputHelper::update` for every `winit::event::Event` you receive from winit. 14 | /// `WinitInputHelper::update` returning true indicates a step has occured. 15 | /// You should now run your application logic, calling any of the accessor methods you need. 16 | /// 17 | /// An alternative API is provided via `WinitInputHelper::step_with_window_events`, 18 | /// call this method instead of `WinitInputHelper::update` if you need to manually control when a new step begins. 19 | /// A step occurs every time this method is called. 20 | /// 21 | /// Do not mix usages of `WinitInputHelper::update` and `WinitInputHelper::step_with_window_events`. 22 | /// You should stick to one or the other. 23 | #[derive(Clone)] 24 | pub struct WinitInputHelper { 25 | current: Option, 26 | dropped_file: Option, 27 | window_resized: Option>, 28 | window_size: Option<(u32, u32)>, 29 | scale_factor_changed: Option, 30 | scale_factor: Option, 31 | destroyed: bool, 32 | close_requested: bool, 33 | step_start: Option, 34 | step_duration: Option, 35 | } 36 | 37 | impl Default for WinitInputHelper { 38 | fn default() -> Self { 39 | Self::new() 40 | } 41 | } 42 | 43 | impl WinitInputHelper { 44 | pub fn new() -> WinitInputHelper { 45 | WinitInputHelper { 46 | current: Some(CurrentInput::new()), 47 | dropped_file: None, 48 | window_resized: None, 49 | window_size: None, 50 | scale_factor_changed: None, 51 | scale_factor: None, 52 | destroyed: false, 53 | close_requested: false, 54 | step_start: None, 55 | step_duration: None, 56 | } 57 | } 58 | 59 | /// Pass every winit event to this function and run your application logic when it returns true. 60 | /// 61 | /// The following winit events are handled: 62 | /// * `Event::NewEvents` clears all internal state. 63 | /// * `Event::MainEventsCleared` causes this function to return true, signifying a "step" has completed. 64 | /// * `Event::WindowEvent` updates internal state, this will affect the result of accessor methods immediately. 65 | /// * `Event::DeviceEvent` updates value of `mouse_diff()` 66 | pub fn update(&mut self, event: &Event) -> bool { 67 | match &event { 68 | Event::NewEvents(_) => { 69 | self.step(); 70 | false 71 | } 72 | Event::WindowEvent { event, .. } => { 73 | self.process_window_event(event); 74 | false 75 | } 76 | Event::DeviceEvent { event, .. } => { 77 | self.process_device_event(event); 78 | false 79 | } 80 | Event::AboutToWait => { 81 | self.end_step(); 82 | true 83 | } 84 | _ => false, 85 | } 86 | } 87 | 88 | /// Pass a slice containing every winit event that occured within the step to this function. 89 | /// Ensure this method is only called once per application main loop. 90 | /// Ensure every event since the last `WinitInputHelper::step_with_window_events` call is included in the `events` argument. 91 | /// 92 | /// `WinitInputHelper::Update` is easier to use. 93 | /// But this method is useful when your application logic steps dont line up with winit's event loop. 94 | /// e.g. you have a seperate thread for application logic using WinitInputHelper that constantly 95 | /// runs regardless of winit's event loop and you need to send events to it directly. 96 | pub fn step_with_window_events(&mut self, events: &[WindowEvent]) { 97 | self.step(); 98 | for event in events { 99 | self.process_window_event(event); 100 | } 101 | self.end_step(); 102 | } 103 | 104 | fn step(&mut self) { 105 | self.dropped_file = None; 106 | self.window_resized = None; 107 | self.scale_factor_changed = None; 108 | self.close_requested = false; 109 | // Set the start time on the first event to avoid the first step appearing too long 110 | self.step_start.get_or_insert(Instant::now()); 111 | self.step_duration = None; 112 | if let Some(current) = &mut self.current { 113 | current.step(); 114 | } 115 | } 116 | 117 | fn process_window_event(&mut self, event: &WindowEvent) { 118 | match event { 119 | WindowEvent::CloseRequested => self.close_requested = true, 120 | WindowEvent::Destroyed => self.destroyed = true, 121 | WindowEvent::Focused(false) => self.current = None, 122 | WindowEvent::Focused(true) => { 123 | if self.current.is_none() { 124 | self.current = Some(CurrentInput::new()) 125 | } 126 | } 127 | WindowEvent::DroppedFile(path) => self.dropped_file = Some(path.clone()), 128 | WindowEvent::Resized(size) => { 129 | self.window_resized = Some(*size); 130 | self.window_size = Some((*size).into()); 131 | } 132 | WindowEvent::ScaleFactorChanged { scale_factor, .. } => { 133 | self.scale_factor_changed = Some(*scale_factor); 134 | self.scale_factor = Some(*scale_factor); 135 | } 136 | _ => {} 137 | } 138 | if let Some(current) = &mut self.current { 139 | current.handle_event(event); 140 | } 141 | } 142 | 143 | fn process_device_event(&mut self, event: &DeviceEvent) { 144 | if let Some(ref mut current) = self.current { 145 | current.handle_device_event(event); 146 | } 147 | } 148 | 149 | fn end_step(&mut self) { 150 | self.step_duration = self.step_start.map(|start| start.elapsed()); 151 | self.step_start = Some(Instant::now()); 152 | } 153 | 154 | /// Returns true when the key with the specified keycode goes from "not pressed" to "pressed". 155 | /// Otherwise returns false. 156 | /// 157 | /// Uses physical keys in the US layout, so for example the `W` key will be in the same physical key on both US and french keyboards. 158 | /// 159 | /// This is suitable for game controls. 160 | pub fn key_pressed(&self, keycode: KeyCode) -> bool { 161 | let key = PhysicalKey::Code(keycode); 162 | if let Some(current) = &self.current { 163 | let searched_action = ScanCodeAction::Pressed(key); 164 | if current.scancode_actions.contains(&searched_action) { 165 | return true; 166 | } 167 | } 168 | false 169 | } 170 | 171 | /// Returns true when the key with the specified keycode goes from "not pressed" to "pressed". 172 | /// Otherwise returns false. 173 | /// 174 | /// Uses physical keys in the US layout, so for example the `W` key will be in the same physical key on both US and french keyboards. 175 | /// 176 | /// Will repeat key presses while held down according to the OS's key repeat configuration 177 | /// This is suitable for UI. 178 | pub fn key_pressed_os(&self, keycode: KeyCode) -> bool { 179 | let key = PhysicalKey::Code(keycode); 180 | if let Some(current) = &self.current { 181 | let searched_action = ScanCodeAction::PressedOs(key); 182 | if current.scancode_actions.contains(&searched_action) { 183 | return true; 184 | } 185 | } 186 | false 187 | } 188 | 189 | /// Returns true when the key with the specified KeyCode goes from "pressed" to "not pressed". 190 | /// Otherwise returns false. 191 | /// 192 | /// Uses physical keys in the US layout, so for example the `W` key will be in the same physical key on both US and french keyboards. 193 | pub fn key_released(&self, keycode: KeyCode) -> bool { 194 | let key = PhysicalKey::Code(keycode); 195 | if let Some(current) = &self.current { 196 | let searched_action = ScanCodeAction::Released(key); 197 | if current.scancode_actions.contains(&searched_action) { 198 | return true; 199 | } 200 | } 201 | false 202 | } 203 | 204 | /// Returns true when the key with the specified keycode remains "pressed". 205 | /// Otherwise returns false. 206 | /// 207 | /// Uses physical keys in the US layout, so for example the `W` key will be in the same physical key on both US and french keyboards. 208 | pub fn key_held(&self, keycode: KeyCode) -> bool { 209 | let key = PhysicalKey::Code(keycode); 210 | if let Some(current) = &self.current { 211 | return current.scancode_held.contains(&key); 212 | } 213 | false 214 | } 215 | 216 | /// Returns true while any shift key is held on the keyboard. 217 | /// Otherwise returns false. 218 | /// 219 | /// Uses physical keys. 220 | pub fn held_shift(&self) -> bool { 221 | self.key_held(KeyCode::ShiftLeft) || self.key_held(KeyCode::ShiftRight) 222 | } 223 | 224 | /// Returns true while any control key is held on the keyboard. 225 | /// Otherwise returns false. 226 | /// 227 | /// Uses physical keys. 228 | pub fn held_control(&self) -> bool { 229 | self.key_held(KeyCode::ControlLeft) || self.key_held(KeyCode::ControlRight) 230 | } 231 | 232 | /// Returns true while any alt key is held on the keyboard. 233 | /// Otherwise returns false. 234 | /// 235 | /// Uses physical keys. 236 | pub fn held_alt(&self) -> bool { 237 | self.key_held(KeyCode::AltLeft) || self.key_held(KeyCode::AltRight) 238 | } 239 | 240 | /// Returns true when the specified keyboard key goes from "not pressed" to "pressed". 241 | /// Otherwise returns false. 242 | /// 243 | /// Uses logical keypresses, so for example `W` is changed between a US and french keyboard. 244 | /// Will never repeat keypresses while held. 245 | pub fn key_pressed_logical(&self, check_key: Key<&str>) -> bool { 246 | if let Some(current) = &self.current { 247 | for action in ¤t.key_actions { 248 | if let KeyAction::Pressed(key) = action { 249 | if key.as_ref() == check_key { 250 | return true; 251 | } 252 | } 253 | } 254 | } 255 | false 256 | } 257 | 258 | /// Returns true when the specified keyboard key goes from "not pressed" to "pressed". 259 | /// Otherwise returns false. 260 | /// 261 | /// Uses logical keypresses, so for example `W` is changed between a US and french keyboard. 262 | /// 263 | /// Will repeat key presses while held down according to the OS's key repeat configuration 264 | /// This is suitable for UI. 265 | pub fn key_pressed_os_logical(&self, check_key: Key<&str>) -> bool { 266 | if let Some(current) = &self.current { 267 | for action in ¤t.key_actions { 268 | if let KeyAction::PressedOs(key_code) = action { 269 | if key_code.as_ref() == check_key { 270 | return true; 271 | } 272 | } 273 | } 274 | } 275 | false 276 | } 277 | 278 | /// Returns true when the specified keyboard key goes from "pressed" to "not pressed". 279 | /// Otherwise returns false. 280 | /// 281 | /// Uses logical keypresses, so for example `W` is changed between a US and french keyboard. 282 | pub fn key_released_logical(&self, check_key: Key<&str>) -> bool { 283 | if let Some(current) = &self.current { 284 | for action in ¤t.key_actions { 285 | if let KeyAction::Released(key_code) = action { 286 | if key_code.as_ref() == check_key { 287 | return true; 288 | } 289 | } 290 | } 291 | } 292 | false 293 | } 294 | 295 | /// Returns true while the specified keyboard key remains "pressed". 296 | /// Otherwise returns false. 297 | /// 298 | /// Uses logical keypresses, so for example `W` is changed between a US and french keyboard. 299 | pub fn key_held_logical(&self, check_key: Key<&str>) -> bool { 300 | match &self.current { 301 | Some(current) => current.key_held.iter().any(|x| x.as_ref() == check_key), 302 | None => false, 303 | } 304 | } 305 | 306 | /// Returns true when the specified mouse button goes from "not pressed" to "pressed". 307 | /// Otherwise returns false. 308 | pub fn mouse_pressed(&self, mouse_button: MouseButton) -> bool { 309 | if let Some(current) = &self.current { 310 | for action in ¤t.mouse_actions { 311 | if let MouseAction::Pressed(key_code) = *action { 312 | if key_code == mouse_button { 313 | return true; 314 | } 315 | } 316 | } 317 | } 318 | false 319 | } 320 | 321 | /// Returns true when the specified mouse button goes from "pressed" to "not pressed". 322 | /// Otherwise returns false. 323 | pub fn mouse_released(&self, mouse_button: MouseButton) -> bool { 324 | if let Some(current) = &self.current { 325 | for action in ¤t.mouse_actions { 326 | if let MouseAction::Released(key_code) = *action { 327 | if key_code == mouse_button { 328 | return true; 329 | } 330 | } 331 | } 332 | } 333 | false 334 | } 335 | 336 | /// Returns true while the specified mouse button remains "pressed". 337 | /// Otherwise returns false. 338 | pub fn mouse_held(&self, mouse_button: MouseButton) -> bool { 339 | match &self.current { 340 | Some(current) => current.mouse_held[mouse_button_to_int(&mouse_button)], 341 | None => false, 342 | } 343 | } 344 | 345 | /// Returns `(0.0, 0.0)` when the window is not focused. 346 | /// Otherwise returns the amount scrolled by the mouse during the last step. 347 | /// Returns (horizontally, vertically) 348 | pub fn scroll_diff(&self) -> (f32, f32) { 349 | match &self.current { 350 | Some(current) => (current.x_scroll_diff, current.y_scroll_diff), 351 | None => (0.0, 0.0), 352 | } 353 | } 354 | 355 | /// Returns the cursor coordinates in pixels, when window is focused AND (cursor is on window OR any mouse button remains held while cursor moved off window) 356 | /// Otherwise returns `None` 357 | pub fn cursor(&self) -> Option<(f32, f32)> { 358 | match &self.current { 359 | Some(current) => current.cursor_point, 360 | None => None, 361 | } 362 | } 363 | 364 | /// Returns the change in cursor coordinates that occured during the last step, when window is focused AND (cursor is on window OR any mouse button remains held while cursor moved off window) 365 | /// Otherwise returns `(0.0, 0.0)`. 366 | pub fn cursor_diff(&self) -> (f32, f32) { 367 | if let Some(current_input) = &self.current { 368 | if let Some(cur) = current_input.cursor_point { 369 | if let Some(prev) = current_input.cursor_point_prev { 370 | return (cur.0 - prev.0, cur.1 - prev.1); 371 | } 372 | } 373 | } 374 | (0.0, 0.0) 375 | } 376 | 377 | /// Returns the change in mouse coordinates that occured during the last step. 378 | /// 379 | /// This is useful when implementing first person controls with a captured mouse. 380 | /// 381 | /// Because this uses `DeviceEvent`s, the `step_with_windows_events` 382 | /// function won't update this as it is not a `WindowEvent`. 383 | pub fn mouse_diff(&self) -> (f32, f32) { 384 | if let Some(current_input) = &self.current { 385 | if let Some(diff) = current_input.mouse_diff { 386 | return diff; 387 | } 388 | } 389 | (0.0, 0.0) 390 | } 391 | 392 | /// Returns the characters pressed during the last step. 393 | /// The characters are in the order they were pressed. 394 | pub fn text(&self) -> &[Key] { 395 | match &self.current { 396 | Some(current) => ¤t.text, 397 | None => &[], 398 | } 399 | } 400 | 401 | /// Returns the path to a file that has been drag-and-dropped onto the window. 402 | pub fn dropped_file(&self) -> Option { 403 | self.dropped_file.clone() 404 | } 405 | 406 | /// Returns the current window size if it was resized during the last step. 407 | /// Otherwise returns `None`. 408 | pub fn window_resized(&self) -> Option> { 409 | self.window_resized 410 | } 411 | 412 | /// Returns `None` when no `WindowEvent::Resized` have been received yet. 413 | /// After one has been received it returns the current resolution of the window. 414 | pub fn resolution(&self) -> Option<(u32, u32)> { 415 | self.window_size 416 | } 417 | 418 | /// Returns the current scale factor if it was changed during the last step. 419 | /// Otherwise returns `None`. 420 | pub fn scale_factor_changed(&self) -> Option { 421 | self.scale_factor_changed 422 | } 423 | 424 | /// Returns `None` when no `WindowEvent::ScaleFactorChanged` have been received yet. 425 | /// After one has been received it returns the current scale_factor of the window. 426 | pub fn scale_factor(&self) -> Option { 427 | self.scale_factor 428 | } 429 | 430 | /// Returns true if the window has been destroyed 431 | /// Otherwise returns false. 432 | /// Once this method has returned true once all following calls to this method will also return true. 433 | pub fn destroyed(&self) -> bool { 434 | self.destroyed 435 | } 436 | 437 | /// Returns true if the OS has requested the application to close during this step. 438 | /// Otherwise returns false. 439 | pub fn close_requested(&self) -> bool { 440 | self.close_requested 441 | } 442 | 443 | /// Returns the `std::time::Duration` elapsed since the last step. 444 | /// Returns `None` if the step is still in progress. 445 | pub fn delta_time(&self) -> Option { 446 | self.step_duration 447 | } 448 | } 449 | --------------------------------------------------------------------------------