From 79c8201aa41d98282939d70d844f0cf6e337eb25 Mon Sep 17 00:00:00 2001 From: Jinlei Li Date: Thu, 2 Jan 2025 13:23:34 +0800 Subject: [PATCH] Simplify `canvas_view` code --- Cargo.lock | 1120 ++++++++++++++++++++++--- Cargo.toml | 9 +- README.MD | 2 +- public/bevy_in_main_thread.js | 180 ++-- src/bevy_app.rs | 1 + src/canvas_view/canvas.rs | 203 ----- src/canvas_view/canvas_view_plugin.rs | 6 +- src/canvas_view/canvas_views.rs | 2 +- src/canvas_view/mod.rs | 24 +- src/web_ffi.rs | 4 +- zh.md | 2 +- 11 files changed, 1151 insertions(+), 402 deletions(-) delete mode 100644 src/canvas_view/canvas.rs diff --git a/Cargo.lock b/Cargo.lock index aef3451..bdaf1da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,22 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ab_glyph" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3672c180e71eeaaac3a541fbbc5f5ad4def8b747c595ad30d674e43049f7b0" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" + [[package]] name = "accesskit" version = "0.17.1" @@ -70,6 +86,17 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ecc8056bf6ab9892dcd53216c83d1597487d7dacac16c8df6b877d127df9937" +[[package]] +name = "android_logger" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b07e8e73d720a1f2e4b6014766e6039fd2e96a4fa44e2a78d0e1fa2ff49826" +dependencies = [ + "android_log-sys", + "env_filter", + "log", +] + [[package]] name = "android_system_properties" version = "0.1.5" @@ -79,6 +106,80 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" + +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +dependencies = [ + "anstyle", + "windows-sys 0.59.0", +] + +[[package]] +name = "app-surface" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f34ede222602af83d13177578242085e294ae74ad14f3cf27e99f32423d2ff" +dependencies = [ + "android_logger", + "cfg-if", + "core-graphics 0.24.0", + "env_logger", + "glam", + "jni", + "libc", + "log", + "ndk-sys 0.6.0+11769913", + "objc", + "pollster", + "raw-window-handle", + "wasm-bindgen", + "web-sys", + "web-time", + "wgpu", + "winit", +] + [[package]] name = "arrayref" version = "0.3.7" @@ -91,6 +192,12 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + [[package]] name = "ash" version = "0.38.0+1.3.281" @@ -211,6 +318,7 @@ dependencies = [ name = "bevy-in-web-worker" version = "0.2.0" dependencies = [ + "app-surface", "bevy", "console_error_panic_hook", "console_log", @@ -973,6 +1081,15 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2", +] + [[package]] name = "blocking" version = "1.6.0" @@ -1031,6 +1148,32 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +[[package]] +name = "calloop" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +dependencies = [ + "bitflags 2.6.0", + "log", + "polling", + "rustix", + "slab", + "thiserror", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +dependencies = [ + "calloop", + "rustix", + "wayland-backend", + "wayland-client", +] + [[package]] name = "cc" version = "1.0.97" @@ -1096,6 +1239,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" + [[package]] name = "combine" version = "4.6.7" @@ -1198,11 +1347,47 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "core-graphics-types 0.1.3", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", + "core-graphics-types 0.2.0", + "foreign-types", + "libc", +] [[package]] name = "core-graphics-types" @@ -1211,7 +1396,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", "libc", ] @@ -1246,6 +1442,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "cursor-icon" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" + [[package]] name = "data-encoding" version = "2.6.0" @@ -1273,12 +1475,27 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + [[package]] name = "disqualified" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9c272297e804878a2a4b707cfcfc6d2328b5bb936944613b4fdf2b9269afdfd" +[[package]] +name = "dlib" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" +dependencies = [ + "libloading", +] + [[package]] name = "document-features" version = "0.2.10" @@ -1294,6 +1511,12 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" +[[package]] +name = "dpi" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53" + [[package]] name = "either" version = "1.13.0" @@ -1332,6 +1555,29 @@ dependencies = [ "syn", ] +[[package]] +name = "env_filter" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -1347,6 +1593,16 @@ dependencies = [ "serde", ] +[[package]] +name = "errno" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "euclid" version = "0.22.9" @@ -1483,6 +1739,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "gethostname" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" +dependencies = [ + "libc", + "windows-targets 0.48.5", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -1573,7 +1839,7 @@ dependencies = [ "log", "presser", "thiserror", - "windows 0.54.0", + "windows", ] [[package]] @@ -1617,6 +1883,12 @@ dependencies = [ "serde", ] +[[package]] +name = "hermit-abi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" + [[package]] name = "hexasphere" version = "15.0.0" @@ -1633,6 +1905,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "image" version = "0.25.5" @@ -1654,6 +1932,12 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.13.0" @@ -1696,9 +1980,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.74" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ "once_cell", "wasm-bindgen", @@ -1758,6 +2042,23 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.6.0", + "libc", + "redox_syscall 0.5.1", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + [[package]] name = "litrs" version = "0.4.1" @@ -1804,6 +2105,15 @@ version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +[[package]] +name = "memmap2" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3f7eed9d3848f8b98834af67102b720745c4ec028fcd0aa0239277e7de374f" +dependencies = [ + "libc", +] + [[package]] name = "metal" version = "0.29.0" @@ -1812,7 +2122,7 @@ checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" dependencies = [ "bitflags 2.6.0", "block", - "core-graphics-types", + "core-graphics-types 0.1.3", "foreign-types", "log", "objc", @@ -1878,6 +2188,7 @@ dependencies = [ "log", "ndk-sys 0.6.0+11769913", "num_enum", + "raw-window-handle", "thiserror", ] @@ -1984,75 +2295,302 @@ dependencies = [ ] [[package]] -name = "offset-allocator" -version = "0.2.0" +name = "objc-sys" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e234d535da3521eb95106f40f0b73483d80bfb3aacf27c40d7e2b72f1a3e00a2" -dependencies = [ - "log", - "nonmax", -] +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" [[package]] -name = "once_cell" -version = "1.20.2" +name = "objc2" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" +dependencies = [ + "objc-sys", + "objc2-encode", +] [[package]] -name = "overload" -version = "0.1.1" +name = "objc2-app-kit" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.6.0", + "block2", + "libc", + "objc2", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation", + "objc2-quartz-core", +] [[package]] -name = "parking" -version = "2.2.0" +name = "objc2-cloud-kit" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-core-location", + "objc2-foundation", +] [[package]] -name = "parking_lot" -version = "0.12.2" +name = "objc2-contacts" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" dependencies = [ - "lock_api", - "parking_lot_core", + "block2", + "objc2", + "objc2-foundation", ] [[package]] -name = "parking_lot_core" -version = "0.9.10" +name = "objc2-core-data" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.52.6", + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-foundation", ] [[package]] -name = "paste" -version = "1.0.15" +name = "objc2-core-image" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2", + "objc2", + "objc2-foundation", + "objc2-metal", +] [[package]] -name = "petgraph" -version = "0.6.5" +name = "objc2-core-location" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" dependencies = [ - "fixedbitset 0.4.2", - "indexmap", + "block2", + "objc2", + "objc2-contacts", + "objc2-foundation", ] [[package]] -name = "pin-project" -version = "1.1.5" +name = "objc2-encode" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7891e71393cd1f227313c9379a26a584ff3d7e6e7159e988851f0934c993f0f8" + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.6.0", + "block2", + "dispatch", + "libc", + "objc2", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2", + "objc2", + "objc2-app-kit", + "objc2-foundation", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-foundation", + "objc2-metal", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation", + "objc2-link-presentation", + "objc2-quartz-core", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-core-location", + "objc2-foundation", +] + +[[package]] +name = "offset-allocator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e234d535da3521eb95106f40f0b73483d80bfb3aacf27c40d7e2b72f1a3e00a2" +dependencies = [ + "log", + "nonmax", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "orbclient" +version = "0.3.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba0b26cec2e24f08ed8bb31519a9333140a6599b867dac464bb150bdb796fd43" +dependencies = [ + "libredox", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "owned_ttf_parser" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec719bbf3b2a81c109a4e20b1f129b5566b7dce654bc3872f6a05abf82b2c4" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + +[[package]] +name = "parking_lot" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.1", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset 0.4.2", + "indexmap", +] + +[[package]] +name = "pin-project" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ @@ -2093,6 +2631,27 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +[[package]] +name = "polling" +version = "3.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "pollster" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2" + [[package]] name = "pp-rs" version = "0.2.1" @@ -2148,6 +2707,15 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" +[[package]] +name = "quick-xml" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" +dependencies = [ + "memchr", +] + [[package]] name = "quote" version = "1.0.36" @@ -2221,6 +2789,15 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0d463f2884048e7153449a55166f91028d5b0ea53c79377099ce4e8cf0cf9bb" +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_syscall" version = "0.5.1" @@ -2298,6 +2875,19 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustix" +version = "0.38.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "ruzstd" version = "0.7.0" @@ -2317,12 +2907,31 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sctk-adwaita" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" +dependencies = [ + "ab_glyph", + "log", + "memmap2", + "smithay-client-toolkit", + "tiny-skia", +] + [[package]] name = "send_wrapper" version = "0.6.0" @@ -2388,6 +2997,31 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "smithay-client-toolkit" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +dependencies = [ + "bitflags 2.6.0", + "calloop", + "calloop-wayland-source", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix", + "thiserror", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + [[package]] name = "smol_str" version = "0.2.1" @@ -2418,6 +3052,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" + [[package]] name = "svg_fmt" version = "0.4.2" @@ -2483,6 +3123,31 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + [[package]] name = "toml_datetime" version = "0.6.6" @@ -2598,6 +3263,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" + [[package]] name = "twox-hash" version = "1.6.3" @@ -2614,6 +3285,12 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + [[package]] name = "unicode-width" version = "0.1.12" @@ -2626,6 +3303,12 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "uuid" version = "1.8.0" @@ -2666,9 +3349,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -2677,13 +3360,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn", @@ -2692,9 +3374,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.47" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", @@ -2705,9 +3387,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2715,9 +3397,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", @@ -2728,15 +3410,124 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.97" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" + +[[package]] +name = "wayland-backend" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6" +dependencies = [ + "cc", + "downcast-rs", + "rustix", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280" +dependencies = [ + "bitflags 2.6.0", + "rustix", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.6.0", + "cursor-icon", + "wayland-backend", +] + +[[package]] +name = "wayland-cursor" +version = "0.31.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" +checksum = "32b08bc3aafdb0035e7fe0fdf17ba0c09c268732707dca4ae098f60cb28c9e4c" +dependencies = [ + "rustix", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd0ade57c4e6e9a8952741325c30bf82f4246885dca8bf561898b86d0c1f58e" +dependencies = [ + "bitflags 2.6.0", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-plasma" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b31cab548ee68c7eb155517f2212049dc151f7cd7910c2b66abfd31c3ee12bd" +dependencies = [ + "bitflags 2.6.0", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "782e12f6cd923c3c316130d56205ebab53f55d6666b7faddfad36cecaeeb4022" +dependencies = [ + "bitflags 2.6.0", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597f2001b2e5fc1121e3d5b9791d3e78f05ba6bfa4641053846248e3a13661c3" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efa8ac0d8e8ed3e3b5c9fc92c7881406a268e11555abe36493efabe649a29e09" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] [[package]] name = "web-sys" -version = "0.3.74" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" dependencies = [ "js-sys", "wasm-bindgen", @@ -2816,7 +3607,7 @@ dependencies = [ "block", "bytemuck", "cfg_aliases 0.1.1", - "core-graphics-types", + "core-graphics-types 0.1.3", "glow", "glutin_wgl_sys", "gpu-alloc", @@ -2843,8 +3634,8 @@ dependencies = [ "wasm-bindgen", "web-sys", "wgpu-types", - "windows 0.58.0", - "windows-core 0.58.0", + "windows", + "windows-core", ] [[package]] @@ -2889,33 +3680,13 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.54.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" -dependencies = [ - "windows-core 0.54.0", - "windows-targets 0.52.6", -] - [[package]] name = "windows" version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" dependencies = [ - "windows-core 0.58.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-core" -version = "0.54.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" -dependencies = [ - "windows-result 0.1.2", + "windows-core", "windows-targets 0.52.6", ] @@ -2927,7 +3698,7 @@ checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" dependencies = [ "windows-implement", "windows-interface", - "windows-result 0.2.0", + "windows-result", "windows-strings", "windows-targets 0.52.6", ] @@ -2954,15 +3725,6 @@ dependencies = [ "syn", ] -[[package]] -name = "windows-result" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-result" version = "0.2.0" @@ -2978,7 +3740,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" dependencies = [ - "windows-result 0.2.0", + "windows-result", "windows-targets 0.52.6", ] @@ -3024,6 +3786,21 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -3046,6 +3823,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -3058,6 +3841,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" @@ -3070,6 +3859,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -3088,6 +3883,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" @@ -3100,6 +3901,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" @@ -3112,6 +3919,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" @@ -3124,12 +3937,70 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winit" +version = "0.30.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0be9e76a1f1077e04a411f0b989cbd3c93339e1771cb41e71ac4aee95bfd2c67" +dependencies = [ + "ahash", + "android-activity", + "atomic-waker", + "bitflags 2.6.0", + "block2", + "bytemuck", + "calloop", + "cfg_aliases 0.2.1", + "concurrent-queue", + "core-foundation 0.9.4", + "core-graphics 0.23.2", + "cursor-icon", + "dpi", + "js-sys", + "libc", + "memmap2", + "ndk", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", + "orbclient", + "percent-encoding", + "pin-project", + "raw-window-handle", + "redox_syscall 0.4.1", + "rustix", + "sctk-adwaita", + "smithay-client-toolkit", + "smol_str", + "tracing", + "unicode-segmentation", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", + "web-sys", + "web-time", + "windows-sys 0.52.0", + "x11-dl", + "x11rb", + "xkbcommon-dl", +] + [[package]] name = "winnow" version = "0.5.40" @@ -3148,6 +4019,63 @@ dependencies = [ "memchr", ] +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12" +dependencies = [ + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading", + "once_cell", + "rustix", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" + +[[package]] +name = "xcursor" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef33da6b1660b4ddbfb3aef0ade110c8b8a781a3b6382fa5f2b5b040fd55f61" + +[[package]] +name = "xkbcommon-dl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +dependencies = [ + "bitflags 2.6.0", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + [[package]] name = "xml-rs" version = "0.8.20" diff --git a/Cargo.toml b/Cargo.toml index 11c6009..56afdb9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ rust-version = "1.78" crate-type = ["cdylib"] [dependencies] +app-surface = { version = "1.3.3", features = ["web_rwh"] } raw-window-handle = "0.6" wgpu = "23" bevy = { version = "0.15", features = [ @@ -22,11 +23,11 @@ bevy = { version = "0.15", features = [ uuid = { version = "1.7.0", features = ["v4"] } rand = "0.8" # Web only -wasm-bindgen = "0.2.97" -wasm-bindgen-futures = "0.4.47" +wasm-bindgen = "0.2.99" +wasm-bindgen-futures = "0.4.49" console_error_panic_hook = "0.1.7" console_log = "1" -web-sys = { version = "0.3.74", features = [ +web-sys = { version = "0.3.76", features = [ "Window", "Document", "Element", @@ -41,7 +42,7 @@ web-sys = { version = "0.3.74", features = [ "BlobPropertyBag", "Url", ] } -js-sys = "0.3.74" +js-sys = "0.3.76" [profile.wasm-release] inherits = "release" diff --git a/README.MD b/README.MD index 4d9b926..0e5fe13 100644 --- a/README.MD +++ b/README.MD @@ -36,7 +36,7 @@ Implemented `CanvasViewPlugin` to replace `bevy_winit`, allowing the Bevy engine # Add Rust WebAssembly target rustup target add wasm32-unknown-unknown # Install wasm-bindgen command line tool -cargo install -f wasm-bindgen-cli --version 0.2.97 +cargo install -f wasm-bindgen-cli --version 0.2.99 # Run: # First install the http server diff --git a/public/bevy_in_main_thread.js b/public/bevy_in_main_thread.js index df207bf..8966c5c 100644 --- a/public/bevy_in_main_thread.js +++ b/public/bevy_in_main_thread.js @@ -327,11 +327,11 @@ export function release_app(ptr) { } function __wbg_adapter_34(arg0, arg1, arg2) { - wasm.closure34253_externref_shim(arg0, arg1, arg2); + wasm.closure34283_externref_shim(arg0, arg1, arg2); } function __wbg_adapter_37(arg0, arg1, arg2) { - wasm.closure39044_externref_shim(arg0, arg1, arg2); + wasm.closure39064_externref_shim(arg0, arg1, arg2); } const __wbindgen_enum_GpuCompilationMessageType = ["error", "warning", "info"]; @@ -378,7 +378,7 @@ async function __wbg_load(module, imports) { function __wbg_get_imports() { const imports = {}; imports.wbg = {}; - imports.wbg.__wbg_BigInt_e5b8164e6f744e20 = function() { return handleError(function (arg0) { + imports.wbg.__wbg_BigInt_d43f00cc86af8147 = function() { return handleError(function (arg0) { const ret = BigInt(arg0); return ret; }, arguments) }; @@ -398,7 +398,7 @@ function __wbg_get_imports() { const ret = arg0.WorkerGlobalScope; return ret; }; - imports.wbg.__wbg_arrayBuffer_d004045654bdb712 = function() { return handleError(function (arg0) { + imports.wbg.__wbg_arrayBuffer_d0ca2ad8bda0039b = function() { return handleError(function (arg0) { const ret = arg0.arrayBuffer(); return ret; }, arguments) }; @@ -410,25 +410,25 @@ function __wbg_get_imports() { const ret = arg0.beginRenderPass(arg1); return ret; }; - imports.wbg.__wbg_blockfromrust_139cf3d4a6aba044 = function() { + imports.wbg.__wbg_blockfromrust_6d544cc692aa8a68 = function() { block_from_rust(); }; - imports.wbg.__wbg_blockfromworker_57a4cf274d1c85e8 = function() { + imports.wbg.__wbg_blockfromworker_1743be61bd5c6be3 = function() { self.block_from_worker(); }; - imports.wbg.__wbg_buffer_6e1d53ff183194fc = function(arg0) { + imports.wbg.__wbg_buffer_61b7ce01341d7f88 = function(arg0) { const ret = arg0.buffer; return ret; }; - imports.wbg.__wbg_buffer_ffdeb2ee67420f9e = function(arg0) { + imports.wbg.__wbg_buffer_dc5dbfa8d5fb28cf = function(arg0) { const ret = arg0.buffer; return ret; }; - imports.wbg.__wbg_call_0411c0c3c424db9a = function() { return handleError(function (arg0, arg1, arg2) { + imports.wbg.__wbg_call_500db948e69c7330 = function() { return handleError(function (arg0, arg1, arg2) { const ret = arg0.call(arg1, arg2); return ret; }, arguments) }; - imports.wbg.__wbg_call_3114932863209ca6 = function() { return handleError(function (arg0, arg1) { + imports.wbg.__wbg_call_b0d8e36992d9900d = function() { return handleError(function (arg0, arg1) { const ret = arg0.call(arg1); return ret; }, arguments) }; @@ -521,7 +521,7 @@ function __wbg_get_imports() { imports.wbg.__wbg_destroy_c6af4226dda95dbd = function(arg0) { arg0.destroy(); }; - imports.wbg.__wbg_devicePixelRatio_f4eb7cbe3a812de0 = function(arg0) { + imports.wbg.__wbg_devicePixelRatio_973abafaa5e8254b = function(arg0) { const ret = arg0.devicePixelRatio; return ret; }; @@ -531,7 +531,7 @@ function __wbg_get_imports() { imports.wbg.__wbg_dispatchWorkgroups_c102fa81b955935d = function(arg0, arg1, arg2, arg3) { arg0.dispatchWorkgroups(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0); }; - imports.wbg.__wbg_document_c488ca7509cc6938 = function(arg0) { + imports.wbg.__wbg_document_f11bc4f7c03e1745 = function(arg0) { const ret = arg0.document; return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }; @@ -591,11 +591,11 @@ function __wbg_get_imports() { const ret = arg0.features; return ret; }; - imports.wbg.__wbg_fetch_22f6188f309225ff = function(arg0, arg1, arg2) { + imports.wbg.__wbg_fetch_58cc163d77b34fb1 = function(arg0, arg1, arg2) { const ret = arg0.fetch(getStringFromWasm0(arg1, arg2)); return ret; }; - imports.wbg.__wbg_fetch_588e3e884fcdc8c8 = function(arg0, arg1, arg2) { + imports.wbg.__wbg_fetch_6a5bc16a35f71316 = function(arg0, arg1, arg2) { const ret = arg0.fetch(getStringFromWasm0(arg1, arg2)); return ret; }; @@ -627,11 +627,11 @@ function __wbg_get_imports() { const ret = arg0.getCompilationInfo(); return ret; }; - imports.wbg.__wbg_getContext_02d86c7d9cfa709e = function() { return handleError(function (arg0, arg1, arg2) { + imports.wbg.__wbg_getContext_5eaf5645cd6acb46 = function() { return handleError(function (arg0, arg1, arg2) { const ret = arg0.getContext(getStringFromWasm0(arg1, arg2)); return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }, arguments) }; - imports.wbg.__wbg_getContext_24d4414b979c1bbd = function() { return handleError(function (arg0, arg1, arg2) { + imports.wbg.__wbg_getContext_76b028baa6dafdeb = function() { return handleError(function (arg0, arg1, arg2) { const ret = arg0.getContext(getStringFromWasm0(arg1, arg2)); return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }, arguments) }; @@ -639,7 +639,7 @@ function __wbg_get_imports() { const ret = arg0.getCurrentTexture(); return ret; }; - imports.wbg.__wbg_getElementById_7b2db24a9b54f077 = function(arg0, arg1, arg2) { + imports.wbg.__wbg_getElementById_dcc9f1f3cfdca0bc = function(arg0, arg1, arg2) { const ret = arg0.getElementById(getStringFromWasm0(arg1, arg2)); return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }; @@ -654,22 +654,14 @@ function __wbg_get_imports() { imports.wbg.__wbg_getRandomValues_bcb4912f16000dc4 = function() { return handleError(function (arg0, arg1) { arg0.getRandomValues(arg1); }, arguments) }; - imports.wbg.__wbg_get_68aa371864aa301a = function(arg0, arg1) { - const ret = arg0[arg1 >>> 0]; - return ret; - }; - imports.wbg.__wbg_get_6b316bfdb1b95076 = function(arg0, arg1) { + imports.wbg.__wbg_get_9901e5f7f90821fc = function(arg0, arg1) { const ret = arg0[arg1 >>> 0]; return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }; - imports.wbg.__wbg_globalThis_1e2ac1d6eee845b3 = function() { return handleError(function () { - const ret = globalThis.globalThis; - return ret; - }, arguments) }; - imports.wbg.__wbg_global_f25a574ae080367c = function() { return handleError(function () { - const ret = global.global; + imports.wbg.__wbg_get_9aa3dff3f0266054 = function(arg0, arg1) { + const ret = arg0[arg1 >>> 0]; return ret; - }, arguments) }; + }; imports.wbg.__wbg_gpu_87871e8f7ace8fee = function(arg0) { const ret = arg0.gpu; return ret; @@ -678,11 +670,11 @@ function __wbg_get_imports() { const ret = arg0.has(getStringFromWasm0(arg1, arg2)); return ret; }; - imports.wbg.__wbg_height_4065e49e5ec4c4c1 = function(arg0) { + imports.wbg.__wbg_height_6e1c5b8f51135ee0 = function(arg0) { const ret = arg0.height; return ret; }; - imports.wbg.__wbg_height_74bc8ec7548ff6b6 = function(arg0) { + imports.wbg.__wbg_height_f36c36e27347cf38 = function(arg0) { const ret = arg0.height; return ret; }; @@ -736,7 +728,7 @@ function __wbg_get_imports() { const ret = result; return ret; }; - imports.wbg.__wbg_instanceof_HtmlCanvasElement_9db0dfd54b2c5330 = function(arg0) { + imports.wbg.__wbg_instanceof_HtmlCanvasElement_f764441ef5ddb63f = function(arg0) { let result; try { result = arg0 instanceof HTMLCanvasElement; @@ -746,7 +738,7 @@ function __wbg_get_imports() { const ret = result; return ret; }; - imports.wbg.__wbg_instanceof_Object_f0f57d6eeca1b81d = function(arg0) { + imports.wbg.__wbg_instanceof_Object_0d0cec232ff037c4 = function(arg0) { let result; try { result = arg0 instanceof Object; @@ -756,7 +748,7 @@ function __wbg_get_imports() { const ret = result; return ret; }; - imports.wbg.__wbg_instanceof_Response_0ec26bd2f8a75ca2 = function(arg0) { + imports.wbg.__wbg_instanceof_Response_d3453657e10c4300 = function(arg0) { let result; try { result = arg0 instanceof Response; @@ -766,7 +758,7 @@ function __wbg_get_imports() { const ret = result; return ret; }; - imports.wbg.__wbg_instanceof_Window_a959820eb267fe22 = function(arg0) { + imports.wbg.__wbg_instanceof_Window_d2514c6a7ee7ba60 = function(arg0) { let result; try { result = arg0 instanceof Window; @@ -783,7 +775,7 @@ function __wbg_get_imports() { getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); }; - imports.wbg.__wbg_length_2e63ba34c4121df5 = function(arg0) { + imports.wbg.__wbg_length_65d1cd11729ced11 = function(arg0) { const ret = arg0.length; return ret; }; @@ -791,7 +783,7 @@ function __wbg_get_imports() { const ret = arg0.length; return ret; }; - imports.wbg.__wbg_length_e74df4881604f1d9 = function(arg0) { + imports.wbg.__wbg_length_d65cf0786bfc5739 = function(arg0) { const ret = arg0.length; return ret; }; @@ -807,6 +799,9 @@ function __wbg_get_imports() { const ret = arg0.lineNum; return ret; }; + imports.wbg.__wbg_log_01ae2fcd897002b8 = function(arg0, arg1) { + console.log(getStringFromWasm0(arg0, arg1)); + }; imports.wbg.__wbg_log_0cc1b7768397bcfe = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { let deferred0_0; let deferred0_1; @@ -818,9 +813,6 @@ function __wbg_get_imports() { wasm.__wbindgen_free(deferred0_0, deferred0_1, 1); } }; - imports.wbg.__wbg_log_bbc149fd501bc753 = function(arg0, arg1) { - console.log(getStringFromWasm0(arg0, arg1)); - }; imports.wbg.__wbg_log_cb9e190acc5753fb = function(arg0, arg1) { let deferred0_0; let deferred0_1; @@ -1004,39 +996,39 @@ function __wbg_get_imports() { const ret = arg0.msCrypto; return ret; }; - imports.wbg.__wbg_navigator_2936a93ec3c6f4c5 = function(arg0) { + imports.wbg.__wbg_navigator_0fe968937104eaa7 = function(arg0) { const ret = arg0.navigator; return ret; }; - imports.wbg.__wbg_navigator_da495c9e52e160b1 = function(arg0) { + imports.wbg.__wbg_navigator_d6db0fcbd7865e08 = function(arg0) { const ret = arg0.navigator; return ret; }; - imports.wbg.__wbg_new_076cac58bb698dd4 = function() { - const ret = new Object(); - return ret; - }; - imports.wbg.__wbg_new_0c28e72025e00594 = function() { + imports.wbg.__wbg_new_254fa9eac11932ae = function() { const ret = new Array(); return ret; }; - imports.wbg.__wbg_new_23362fa370a0a372 = function(arg0) { + imports.wbg.__wbg_new_3ff5b33b1ce712df = function(arg0) { const ret = new Uint8Array(arg0); return ret; }; + imports.wbg.__wbg_new_688846f374351c92 = function() { + const ret = new Object(); + return ret; + }; imports.wbg.__wbg_new_8a6f238a6ece86ea = function() { const ret = new Error(); return ret; }; - imports.wbg.__wbg_newnoargs_19a249f4eceaaac3 = function(arg0, arg1) { + imports.wbg.__wbg_newnoargs_fd9e4bf8be2bc16d = function(arg0, arg1) { const ret = new Function(getStringFromWasm0(arg0, arg1)); return ret; }; - imports.wbg.__wbg_newwithbyteoffsetandlength_ee8def7000b7b2be = function(arg0, arg1, arg2) { + imports.wbg.__wbg_newwithbyteoffsetandlength_ba35896968751d91 = function(arg0, arg1, arg2) { const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0); return ret; }; - imports.wbg.__wbg_newwithlength_91de49dea5643c87 = function(arg0) { + imports.wbg.__wbg_newwithlength_34ce8f1051e74449 = function(arg0) { const ret = new Uint8Array(arg0 >>> 0); return ret; }; @@ -1067,21 +1059,21 @@ function __wbg_get_imports() { imports.wbg.__wbg_pushErrorScope_b52914ff10ba6ce3 = function(arg0, arg1) { arg0.pushErrorScope(__wbindgen_enum_GpuErrorFilter[arg1]); }; - imports.wbg.__wbg_push_3e9ce81246ef1d1b = function(arg0, arg1) { + imports.wbg.__wbg_push_6edad0df4b546b2c = function(arg0, arg1) { const ret = arg0.push(arg1); return ret; }; - imports.wbg.__wbg_querySelectorAll_775f04e6f26ad643 = function() { return handleError(function (arg0, arg1, arg2) { + imports.wbg.__wbg_querySelectorAll_2d037c571f099149 = function() { return handleError(function (arg0, arg1, arg2) { const ret = arg0.querySelectorAll(getStringFromWasm0(arg1, arg2)); return ret; }, arguments) }; - imports.wbg.__wbg_queueMicrotask_3d422e1ba49c2500 = function(arg0) { + imports.wbg.__wbg_queueMicrotask_2181040e064c0dc8 = function(arg0) { + queueMicrotask(arg0); + }; + imports.wbg.__wbg_queueMicrotask_ef9ac43769cbcc4f = function(arg0) { const ret = arg0.queueMicrotask; return ret; }; - imports.wbg.__wbg_queueMicrotask_f301663ccadbb7d0 = function(arg0) { - queueMicrotask(arg0); - }; imports.wbg.__wbg_queue_bea4017efaaf9904 = function(arg0) { const ret = arg0.queue; return ret; @@ -1108,21 +1100,17 @@ function __wbg_get_imports() { imports.wbg.__wbg_resolveQuerySet_811661fb23f3b699 = function(arg0, arg1, arg2, arg3, arg4, arg5) { arg0.resolveQuerySet(arg1, arg2 >>> 0, arg3 >>> 0, arg4, arg5 >>> 0); }; - imports.wbg.__wbg_resolve_6a311e8bb26423ab = function(arg0) { + imports.wbg.__wbg_resolve_0bf7c44d641804f9 = function(arg0) { const ret = Promise.resolve(arg0); return ret; }; - imports.wbg.__wbg_self_ac4343e4047b83cc = function() { return handleError(function () { - const ret = self.self; - return ret; - }, arguments) }; - imports.wbg.__wbg_sendpickfromrust_9f8103f681b86dc1 = function(arg0) { + imports.wbg.__wbg_sendpickfromrust_751a66efdb0c05e2 = function(arg0) { send_pick_from_rust(arg0); }; - imports.wbg.__wbg_sendpickfromworker_1f9878e78c6a6f24 = function(arg0) { + imports.wbg.__wbg_sendpickfromworker_44090ebf5d272368 = function(arg0) { self.send_pick_from_worker(arg0); }; - imports.wbg.__wbg_setAttribute_e5d83ecaf7f586d5 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + imports.wbg.__wbg_setAttribute_148e0e65e20e5f27 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { arg0.setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); }, arguments) }; imports.wbg.__wbg_setBindGroup_62a3045b0921e429 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { @@ -1188,26 +1176,26 @@ function __wbg_get_imports() { imports.wbg.__wbg_setViewport_731ad30abb13f744 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { arg0.setViewport(arg1, arg2, arg3, arg4, arg5, arg6); }; - imports.wbg.__wbg_set_421385e996a16e02 = function() { return handleError(function (arg0, arg1, arg2) { + imports.wbg.__wbg_set_23d69db4e5c66a6e = function(arg0, arg1, arg2) { + arg0.set(arg1, arg2 >>> 0); + }; + imports.wbg.__wbg_set_4e647025551483bd = function() { return handleError(function (arg0, arg1, arg2) { const ret = Reflect.set(arg0, arg1, arg2); return ret; }, arguments) }; - imports.wbg.__wbg_set_7b70226104a82921 = function(arg0, arg1, arg2) { - arg0.set(arg1, arg2 >>> 0); - }; - imports.wbg.__wbg_setheight_4286b13b9186d39f = function(arg0, arg1) { + imports.wbg.__wbg_setheight_16d76e7fa9d506ea = function(arg0, arg1) { arg0.height = arg1 >>> 0; }; - imports.wbg.__wbg_setheight_7632621fed149fd9 = function(arg0, arg1) { + imports.wbg.__wbg_setheight_9805cc527c3e4d65 = function(arg0, arg1) { arg0.height = arg1 >>> 0; }; imports.wbg.__wbg_setonuncapturederror_19541466822d790b = function(arg0, arg1) { arg0.onuncapturederror = arg1; }; - imports.wbg.__wbg_setwidth_5e43e6e177d3e2ec = function(arg0, arg1) { + imports.wbg.__wbg_setwidth_4afeb01eae9784dd = function(arg0, arg1) { arg0.width = arg1 >>> 0; }; - imports.wbg.__wbg_setwidth_db46810857c0f6bd = function(arg0, arg1) { + imports.wbg.__wbg_setwidth_c588fe07a7982aca = function(arg0, arg1) { arg0.width = arg1 >>> 0; }; imports.wbg.__wbg_size_661bddb3f9898121 = function(arg0) { @@ -1221,30 +1209,46 @@ function __wbg_get_imports() { getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); }; - imports.wbg.__wbg_status_5f9868b7ed8dd175 = function(arg0) { + imports.wbg.__wbg_static_accessor_GLOBAL_0be7472e492ad3e3 = function() { + const ret = typeof global === 'undefined' ? null : global; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }; + imports.wbg.__wbg_static_accessor_GLOBAL_THIS_1a6eb482d12c9bfb = function() { + const ret = typeof globalThis === 'undefined' ? null : globalThis; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }; + imports.wbg.__wbg_static_accessor_SELF_1dc398a895c82351 = function() { + const ret = typeof self === 'undefined' ? null : self; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }; + imports.wbg.__wbg_static_accessor_WINDOW_ae1c80c7eea8d64a = function() { + const ret = typeof window === 'undefined' ? null : window; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }; + imports.wbg.__wbg_status_317f53bc4c7638df = function(arg0) { const ret = arg0.status; return ret; }; - imports.wbg.__wbg_stringify_f5476f15b5654a07 = function() { return handleError(function (arg0) { + imports.wbg.__wbg_stringify_f4f701bc34ceda61 = function() { return handleError(function (arg0) { const ret = JSON.stringify(arg0); return ret; }, arguments) }; - imports.wbg.__wbg_subarray_b4e9772c34a7f5ba = function(arg0, arg1, arg2) { + imports.wbg.__wbg_subarray_46adeb9b86949d12 = function(arg0, arg1, arg2) { const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0); return ret; }; imports.wbg.__wbg_submit_f635072bb3d05faa = function(arg0, arg1) { arg0.submit(arg1); }; - imports.wbg.__wbg_then_5c6469c1e1da9e59 = function(arg0, arg1) { + imports.wbg.__wbg_then_0438fad860fe38e1 = function(arg0, arg1) { const ret = arg0.then(arg1); return ret; }; - imports.wbg.__wbg_then_faeb8aed8c1629b7 = function(arg0, arg1, arg2) { + imports.wbg.__wbg_then_0ffafeddf0e182a4 = function(arg0, arg1, arg2) { const ret = arg0.then(arg1, arg2); return ret; }; - imports.wbg.__wbg_toString_ba037b3fb208cc26 = function() { return handleError(function (arg0, arg1) { + imports.wbg.__wbg_toString_79fda24e76e13ea6 = function() { return handleError(function (arg0, arg1) { const ret = arg0.toString(arg1); return ret; }, arguments) }; @@ -1259,7 +1263,7 @@ function __wbg_get_imports() { const ret = arg0.usage; return ret; }; - imports.wbg.__wbg_valueOf_a2728b52687d72b4 = function(arg0) { + imports.wbg.__wbg_valueOf_5b6f2438fbd02962 = function(arg0) { const ret = arg0.valueOf(); return ret; }; @@ -1267,18 +1271,14 @@ function __wbg_get_imports() { const ret = arg0.versions; return ret; }; - imports.wbg.__wbg_width_514dd9b3b0cff49c = function(arg0) { + imports.wbg.__wbg_width_7fe68601c524fd1e = function(arg0) { const ret = arg0.width; return ret; }; - imports.wbg.__wbg_width_826b25a505a0b357 = function(arg0) { + imports.wbg.__wbg_width_9927e6a7adb23d6d = function(arg0) { const ret = arg0.width; return ret; }; - imports.wbg.__wbg_window_1a23defd102c72f4 = function() { return handleError(function () { - const ret = window.window; - return ret; - }, arguments) }; imports.wbg.__wbg_writeBuffer_5ca4981365eb5ac0 = function(arg0, arg1, arg2, arg3, arg4, arg5) { arg0.writeBuffer(arg1, arg2, arg3, arg4, arg5); }; @@ -1298,12 +1298,12 @@ function __wbg_get_imports() { const ret = false; return ret; }; - imports.wbg.__wbindgen_closure_wrapper165640 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 34254, __wbg_adapter_34); + imports.wbg.__wbindgen_closure_wrapper165538 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 34284, __wbg_adapter_34); return ret; }; - imports.wbg.__wbindgen_closure_wrapper208402 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 39045, __wbg_adapter_37); + imports.wbg.__wbindgen_closure_wrapper209284 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 39065, __wbg_adapter_37); return ret; }; imports.wbg.__wbindgen_debug_string = function(arg0, arg1) { diff --git a/src/bevy_app.rs b/src/bevy_app.rs index ec23575..926f241 100644 --- a/src/bevy_app.rs +++ b/src/bevy_app.rs @@ -224,6 +224,7 @@ impl Deref for CurrentVolume { } /// 更新 aabb +#[allow(clippy::type_complexity)] fn update_aabbes( mut commands: Commands, mut config_store: ResMut, diff --git a/src/canvas_view/canvas.rs b/src/canvas_view/canvas.rs deleted file mode 100644 index 59b42c2..0000000 --- a/src/canvas_view/canvas.rs +++ /dev/null @@ -1,203 +0,0 @@ -use bevy::window::WindowWrapper; -use std::{ops::Deref, ptr::NonNull}; -use wasm_bindgen::{JsCast, JsValue}; - -// 封装 ViewObj 来同时支持 Canvas 与 Offscreen -#[derive(Debug)] -pub enum ViewObj { - Canvas(WindowWrapper), - Offscreen(WindowWrapper), -} - -impl ViewObj { - pub fn from_canvas(canvas: Canvas) -> Self { - ViewObj::Canvas(WindowWrapper::new(CanvasWrapper::new(canvas))) - } - - pub fn from_offscreen_canvas(canvas: OffscreenCanvas) -> Self { - ViewObj::Offscreen(WindowWrapper::new(OffscreenCanvasWrapper::new(canvas))) - } -} - -#[derive(Clone, Debug)] -pub(crate) struct SendSyncWrapper(pub(crate) T); - -unsafe impl Send for SendSyncWrapper {} -unsafe impl Sync for SendSyncWrapper {} - -#[derive(Debug)] -pub struct CanvasWrapper(SendSyncWrapper); -impl CanvasWrapper { - pub fn new(canvas: Canvas) -> Self { - CanvasWrapper(SendSyncWrapper(canvas)) - } -} - -impl Deref for CanvasWrapper { - type Target = Canvas; - - fn deref(&self) -> &Self::Target { - &self.0 .0 - } -} - -#[derive(Debug)] -pub struct OffscreenCanvasWrapper(SendSyncWrapper); -impl OffscreenCanvasWrapper { - pub fn new(canvas: OffscreenCanvas) -> Self { - OffscreenCanvasWrapper(SendSyncWrapper(canvas)) - } -} - -impl Deref for OffscreenCanvasWrapper { - type Target = OffscreenCanvas; - - fn deref(&self) -> &Self::Target { - &self.0 .0 - } -} - -#[derive(Debug, Clone)] -pub struct Canvas { - element: web_sys::HtmlCanvasElement, - pub scale_factor: f32, - handle: u32, -} - -#[allow(dead_code)] -impl Canvas { - pub fn new(selectors: &str, handle: u32) -> Self { - // 0 is reserved for window itself. - assert!(handle > 0); - - // 添加 `raw-window-handle` 需要的属性/值. - let (element, scale_factor) = Self::get_canvas_element(selectors); - element - .set_attribute("data-raw-handle", handle.to_string().as_str()) - .unwrap(); - - Self { - element, - scale_factor, - handle, - } - } - - pub fn get_canvas_element(element_id: &str) -> (web_sys::HtmlCanvasElement, f32) { - let window = web_sys::window().unwrap(); - let document = window.document().unwrap(); - let element = document - .get_element_by_id(element_id) - .expect("页面中找不到 canvas 元素 "); - - let canvas = element.dyn_into::().unwrap(); - let scale_factor = window.device_pixel_ratio() as f32; - - (canvas, scale_factor) - } - - #[inline] - pub fn handle(&self) -> u32 { - self.handle - } - - pub fn logical_resolution(&self) -> (f32, f32) { - let width = self.element.width(); - let height = self.element.height(); - (width as f32, height as f32) - } -} - -impl Deref for Canvas { - type Target = web_sys::HtmlCanvasElement; - - fn deref(&self) -> &Self::Target { - &self.element - } -} - -impl raw_window_handle::HasWindowHandle for CanvasWrapper { - fn window_handle( - &self, - ) -> Result, raw_window_handle::HandleError> { - use raw_window_handle::{RawWindowHandle, WebCanvasWindowHandle, WindowHandle}; - - let value: &JsValue = &self.0 .0.element; - let obj: NonNull = NonNull::from(value).cast(); - let handle = WebCanvasWindowHandle::new(obj); - let raw = RawWindowHandle::WebCanvas(handle); - unsafe { Ok(WindowHandle::borrow_raw(raw)) } - } -} - -impl raw_window_handle::HasDisplayHandle for CanvasWrapper { - fn display_handle( - &self, - ) -> Result, raw_window_handle::HandleError> { - use raw_window_handle::{DisplayHandle, RawDisplayHandle, WebDisplayHandle}; - let handle = WebDisplayHandle::new(); - let raw = RawDisplayHandle::Web(handle); - unsafe { Ok(DisplayHandle::borrow_raw(raw)) } - } -} - -#[derive(Debug, Clone)] -pub struct OffscreenCanvas { - inner: web_sys::OffscreenCanvas, - pub scale_factor: f32, - handle: u32, -} - -#[allow(dead_code)] -impl OffscreenCanvas { - pub const fn new(canvas: web_sys::OffscreenCanvas, scale_factor: f32, handle: u32) -> Self { - Self { - inner: canvas, - scale_factor, - handle, - } - } - - pub fn each(self) -> (web_sys::OffscreenCanvas, u32) { - (self.inner, self.handle) - } - - pub fn logical_resolution(&self) -> (f32, f32) { - let width = self.inner.width(); - let height = self.inner.height(); - (width as f32, height as f32) - } -} - -impl From<&Canvas> for OffscreenCanvas { - fn from(value: &Canvas) -> Self { - let offscreen = value.element.transfer_control_to_offscreen().unwrap(); - let handle = value.handle; - Self::new(offscreen, value.scale_factor, handle) - } -} - -impl raw_window_handle::HasWindowHandle for OffscreenCanvasWrapper { - fn window_handle( - &self, - ) -> Result, raw_window_handle::HandleError> { - use raw_window_handle::{RawWindowHandle, WebOffscreenCanvasWindowHandle, WindowHandle}; - - let value: &JsValue = &self.0 .0.inner; - let obj: NonNull = NonNull::from(value).cast(); - let handle = WebOffscreenCanvasWindowHandle::new(obj); - let raw = RawWindowHandle::WebOffscreenCanvas(handle); - unsafe { Ok(WindowHandle::borrow_raw(raw)) } - } -} - -impl raw_window_handle::HasDisplayHandle for OffscreenCanvasWrapper { - fn display_handle( - &self, - ) -> Result, raw_window_handle::HandleError> { - use raw_window_handle::{DisplayHandle, RawDisplayHandle, WebDisplayHandle}; - let handle = WebDisplayHandle::new(); - let raw = RawDisplayHandle::Web(handle); - unsafe { Ok(DisplayHandle::borrow_raw(raw)) } - } -} diff --git a/src/canvas_view/canvas_view_plugin.rs b/src/canvas_view/canvas_view_plugin.rs index 2dc470f..95d041a 100644 --- a/src/canvas_view/canvas_view_plugin.rs +++ b/src/canvas_view/canvas_view_plugin.rs @@ -1,4 +1,4 @@ -use super::{canvas::*, CanvasViews}; +use super::*; use bevy::app::{App, Plugin}; use bevy::ecs::{ entity::Entity, @@ -54,7 +54,9 @@ pub fn create_canvas_window(app: &mut App) { // Update resolution of bevy window window.resolution.set_scale_factor(scale_factor); - window.resolution.set(logical_res.0, logical_res.1); + window + .resolution + .set(logical_res.0 as f32, logical_res.1 as f32); let raw_window_wrapper = match app_view { ViewObj::Canvas(window_wrapper) => RawHandleWrapper::new(window_wrapper), diff --git a/src/canvas_view/canvas_views.rs b/src/canvas_view/canvas_views.rs index 527980a..73a7561 100644 --- a/src/canvas_view/canvas_views.rs +++ b/src/canvas_view/canvas_views.rs @@ -1,4 +1,4 @@ -use super::canvas::*; +use super::*; use bevy::ecs::entity::Entity; use bevy::utils::HashMap; diff --git a/src/canvas_view/mod.rs b/src/canvas_view/mod.rs index dee04c6..e67f941 100644 --- a/src/canvas_view/mod.rs +++ b/src/canvas_view/mod.rs @@ -1,10 +1,12 @@ use uuid::Uuid; +use app_surface::{CanvasWrapper, OffscreenCanvasWrapper}; +use bevy::window::WindowWrapper; + +pub(crate) use app_surface::{Canvas, OffscreenCanvas}; mod canvas_view_plugin; pub(crate) use canvas_view_plugin::*; -pub(crate) mod canvas; - mod canvas_views; use canvas_views::CanvasViews; @@ -16,3 +18,21 @@ impl WindowId { WindowId(Uuid::new_v4()) } } + +// 封装 ViewObj 来同时支持 Canvas 与 Offscreen +#[derive(Debug)] +pub enum ViewObj { + Canvas(WindowWrapper), + Offscreen(WindowWrapper), +} + +impl ViewObj { + pub fn from_canvas(canvas: Canvas) -> Self { + ViewObj::Canvas(WindowWrapper::new(CanvasWrapper::new(canvas))) + } + + pub fn from_offscreen_canvas(canvas: OffscreenCanvas) -> Self { + ViewObj::Offscreen(WindowWrapper::new(OffscreenCanvasWrapper::new(canvas))) + } +} + diff --git a/src/web_ffi.rs b/src/web_ffi.rs index 79d9642..3cd6639 100644 --- a/src/web_ffi.rs +++ b/src/web_ffi.rs @@ -1,5 +1,5 @@ use crate::bevy_app::init_app; -use crate::{canvas::*, canvas_view, create_canvas_window, ActiveInfo, WorkerApp}; +use crate::{canvas_view::*, create_canvas_window, ActiveInfo, WorkerApp}; use bevy::app::PluginsState; use bevy::ecs::system::SystemState; use bevy::prelude::*; @@ -36,7 +36,7 @@ extern "C" { pub fn init_bevy_app() -> u64 { let mut app = init_app(); // 添加自定义的 canvas 窗口插件 - app.add_plugins(canvas_view::CanvasViewPlugin); + app.add_plugins(CanvasViewPlugin); info!("init_bevy_app"); diff --git a/zh.md b/zh.md index ac174f5..ce6f69c 100644 --- a/zh.md +++ b/zh.md @@ -35,7 +35,7 @@ # 添加 Rust WebAssembly target rustup target add wasm32-unknown-unknown # 安装 wasm-bindgen 命令行工具 -cargo install -f wasm-bindgen-cli --version 0.2.97 +cargo install -f wasm-bindgen-cli --version 0.2.99 # 运行: # 先安装 http server