diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d212e21aa..5d05cffbf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,13 +23,13 @@ jobs: # We only run `cargo build` (not `cargo test`) so as to avoid requiring dev-dependencies to build with the MSRV # version. Building is likely sufficient as runtime errors varying between rust versions is very unlikely. build-msrv: - name: "MSRV Build [Rust 1.88]" + name: "MSRV Build [Rust 1.89]" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.88 + toolchain: 1.89 - run: perl -pi.bak -e 's/opt-level = 2/opt-level = 0/g' Cargo.toml - uses: awalsh128/cache-apt-pkgs-action@latest with: diff --git a/Cargo.lock b/Cargo.lock index 1888413d8..6ab97f04a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,92 +24,6 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3d3b8f9bae46a948369bc4a03e815d4ed6d616bd00de4051133a5019dc31c5a" -[[package]] -name = "accesskit_atspi_common" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c5dd55e6e94949498698daf4d48fb5659e824d7abec0d394089656ceaf99d4f" -dependencies = [ - "accesskit", - "accesskit_consumer", - "atspi-common", - "serde", - "thiserror 1.0.69", - "zvariant 4.2.0", -] - -[[package]] -name = "accesskit_consumer" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f47983a1084940ba9a39c077a8c63e55c619388be5476ac04c804cfbd1e63459" -dependencies = [ - "accesskit", - "hashbrown 0.15.5", - "immutable-chunkmap", -] - -[[package]] -name = "accesskit_macos" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7329821f3bd1101e03a7d2e03bd339e3ac0dc64c70b4c9f9ae1949e3ba8dece1" -dependencies = [ - "accesskit", - "accesskit_consumer", - "hashbrown 0.15.5", - "objc2 0.5.2", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "accesskit_unix" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcee751cc20d88678c33edaf9c07e8b693cd02819fe89053776f5313492273f5" -dependencies = [ - "accesskit", - "accesskit_atspi_common", - "async-channel", - "async-executor", - "async-task", - "atspi", - "futures-lite", - "futures-util", - "serde", - "zbus 4.4.0", -] - -[[package]] -name = "accesskit_windows" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24fcd5d23d70670992b823e735e859374d694a3d12bfd8dd32bd3bd8bedb5d81" -dependencies = [ - "accesskit", - "accesskit_consumer", - "hashbrown 0.15.5", - "paste", - "static_assertions", - "windows 0.58.0", - "windows-core 0.58.0", -] - -[[package]] -name = "accesskit_winit" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6a48dad5530b6deb9fc7a52cc6c3bf72cdd9eb8157ac9d32d69f2427a5e879" -dependencies = [ - "accesskit", - "accesskit_macos", - "accesskit_unix", - "accesskit_windows", - "raw-window-handle", - "winit", -] - [[package]] name = "adler2" version = "2.0.1" @@ -277,11 +191,11 @@ dependencies = [ "hashbrown 0.16.1", "kurbo 0.12.0", "oaty", - "objc2 0.6.3", - "objc2-app-kit 0.3.2", + "objc2", + "objc2-app-kit", "objc2-core-foundation", - "objc2-metal 0.3.2", - "objc2-quartz-core 0.3.2", + "objc2-metal", + "objc2-quartz-core", "peniko", "pixels_window_renderer", "raw-window-handle", @@ -371,9 +285,9 @@ checksum = "0348a1c054491f4bfe6ab86a7b6ab1e44e45d899005de92f58b3df180b36ddaf" dependencies = [ "clipboard-win", "log", - "objc2 0.6.3", - "objc2-app-kit 0.3.2", - "objc2-foundation 0.3.2", + "objc2", + "objc2-app-kit", + "objc2-foundation", "parking_lot", "percent-encoding", "windows-sys 0.60.2", @@ -436,7 +350,7 @@ dependencies = [ "enumflags2", "futures-channel", "futures-util", - "rand 0.9.2", + "rand", "raw-window-handle", "serde", "serde_repr", @@ -445,7 +359,7 @@ dependencies = [ "wayland-backend", "wayland-client", "wayland-protocols", - "zbus 5.12.0", + "zbus", ] [[package]] @@ -460,90 +374,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "async-channel" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-executor" -version = "1.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497c00e0fd83a72a79a39fcbd8e3e2f055d6f6c7e025f3b3d91f4f8e76527fb8" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "pin-project-lite", - "slab", -] - -[[package]] -name = "async-fs" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8034a681df4aed8b8edbd7fbe472401ecf009251c8b40556b304567052e294c5" -dependencies = [ - "async-lock", - "blocking", - "futures-lite", -] - -[[package]] -name = "async-io" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" -dependencies = [ - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-io", - "futures-lite", - "parking", - "polling", - "rustix 1.1.2", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-lock" -version = "3.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" -dependencies = [ - "event-listener", - "event-listener-strategy", - "pin-project-lite", -] - -[[package]] -name = "async-process" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" -dependencies = [ - "async-channel", - "async-io", - "async-lock", - "async-signal", - "async-task", - "blocking", - "cfg-if", - "event-listener", - "futures-lite", - "rustix 1.1.2", -] - [[package]] name = "async-recursion" version = "1.1.1" @@ -555,30 +385,6 @@ dependencies = [ "syn 2.0.111", ] -[[package]] -name = "async-signal" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43c070bbf59cd3570b6b2dd54cd772527c7c3620fce8be898406dd3ed6adc64c" -dependencies = [ - "async-io", - "async-lock", - "atomic-waker", - "cfg-if", - "futures-core", - "futures-io", - "rustix 1.1.2", - "signal-hook-registry", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-task" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" - [[package]] name = "async-trait" version = "0.1.89" @@ -608,57 +414,6 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41e67cd8309bbd06cd603a9e693a784ac2e5d1e955f11286e355089fcab3047c" -[[package]] -name = "atspi" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be534b16650e35237bb1ed189ba2aab86ce65e88cc84c66f4935ba38575cecbf" -dependencies = [ - "atspi-common", - "atspi-connection", - "atspi-proxies", -] - -[[package]] -name = "atspi-common" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1909ed2dc01d0a17505d89311d192518507e8a056a48148e3598fef5e7bb6ba7" -dependencies = [ - "enumflags2", - "serde", - "static_assertions", - "zbus 4.4.0", - "zbus-lockstep", - "zbus-lockstep-macros", - "zbus_names 3.0.0", - "zvariant 4.2.0", -] - -[[package]] -name = "atspi-connection" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "430c5960624a4baaa511c9c0fcc2218e3b58f5dbcc47e6190cafee344b873333" -dependencies = [ - "atspi-common", - "atspi-proxies", - "futures-lite", - "zbus 4.4.0", -] - -[[package]] -name = "atspi-proxies" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e6c5de3e524cf967569722446bcd458d5032348554d9a17d7d72b041ab7496" -dependencies = [ - "atspi-common", - "serde", - "zbus 4.4.0", - "zvariant 4.2.0", -] - [[package]] name = "autocfg" version = "1.5.0" @@ -805,10 +560,10 @@ dependencies = [ "fastrand", "html-escape", "image", - "keyboard-types", + "keyboard-types 0.7.0", "linebender_resource_handle", "markup5ever", - "objc2 0.6.3", + "objc2", "parley", "percent-encoding", "rayon", @@ -904,7 +659,6 @@ name = "blitz-shell" version = "0.2.2" dependencies = [ "accesskit", - "accesskit_winit", "android-activity", "anyrender", "arboard", @@ -913,7 +667,7 @@ dependencies = [ "blitz-traits", "data-url", "futures-util", - "keyboard-types", + "keyboard-types 0.7.0", "rfd", "tracing", "winit", @@ -927,7 +681,7 @@ dependencies = [ "bytes", "cursor-icon", "http", - "keyboard-types", + "keyboard-types 0.7.0", "serde", "smol_str", "url", @@ -948,35 +702,22 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block2" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" -dependencies = [ - "objc2 0.5.2", -] - [[package]] name = "block2" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" dependencies = [ - "objc2 0.6.3", + "objc2", ] [[package]] -name = "blocking" -version = "1.6.2" +name = "borsh" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21" +checksum = "d1da5ab77c1437701eeff7c88d968729e7766172279eab0676857b3d63af7a6f" dependencies = [ - "async-channel", - "async-task", - "futures-io", - "futures-lite", - "piper", + "cfg_aliases 0.2.1", ] [[package]] @@ -1001,6 +742,7 @@ dependencies = [ "linebender_resource_handle", "tracing-subscriber", "webbrowser", + "winit", ] [[package]] @@ -1093,26 +835,25 @@ dependencies = [ [[package]] name = "calloop" -version = "0.13.0" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +checksum = "cb9f6e1368bd4621d2c86baa7e37de77a938adf5221e5dd3d6133340101b309e" dependencies = [ "bitflags 2.10.0", - "log", "polling", - "rustix 0.38.44", + "rustix 1.1.2", "slab", - "thiserror 1.0.69", + "tracing", ] [[package]] name = "calloop-wayland-source" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" dependencies = [ "calloop", - "rustix 0.38.44", + "rustix 1.1.2", "wayland-backend", "wayland-client", ] @@ -2007,7 +1748,7 @@ dependencies = [ "futures-channel", "futures-util", "generational-box", - "keyboard-types", + "keyboard-types 0.7.0", "lazy-js-bundle", "rustversion", "serde", @@ -2085,7 +1826,7 @@ dependencies = [ "dioxus-signals", "dioxus-stores", "futures-util", - "keyboard-types", + "keyboard-types 0.7.0", "manganis", "rustc-hash 1.1.0", "tokio", @@ -2104,7 +1845,7 @@ dependencies = [ "dioxus-core", "dioxus-html", "futures-util", - "keyboard-types", + "keyboard-types 0.7.0", "rustc-hash 1.1.0", "tracing", ] @@ -2216,12 +1957,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "dispatch" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" - [[package]] name = "dispatch2" version = "0.3.0" @@ -2229,9 +1964,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" dependencies = [ "bitflags 2.10.0", - "block2 0.6.2", + "block2", "libc", - "objc2 0.6.3", + "objc2", ] [[package]] @@ -2614,10 +2349,10 @@ dependencies = [ "icu_locale_core", "linebender_resource_handle", "memmap2 0.9.9", - "objc2 0.6.3", + "objc2", "objc2-core-foundation", "objc2-core-text", - "objc2-foundation 0.3.2", + "objc2-foundation", "read-fonts", "roxmltree 0.21.1", "smallvec", @@ -2957,10 +2692,10 @@ dependencies = [ "glutin_glx_sys", "glutin_wgl_sys 0.6.1", "libloading 0.8.9", - "objc2 0.6.3", - "objc2-app-kit 0.3.2", + "objc2", + "objc2-app-kit", "objc2-core-foundation", - "objc2-foundation 0.3.2", + "objc2-foundation", "once_cell", "raw-window-handle", "wayland-sys", @@ -3584,15 +3319,6 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edcd27d72f2f071c64249075f42e205ff93c9a4c5f6c6da53e79ed9f9832c285" -[[package]] -name = "immutable-chunkmap" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3e98b1520e49e252237edc238a39869da9f3241f2ec19dc788c1d24694d1e4" -dependencies = [ - "arrayvec", -] - [[package]] name = "indexmap" version = "2.12.1" @@ -3761,6 +3487,16 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "keyboard-types" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" +dependencies = [ + "bitflags 2.10.0", + "serde", +] + [[package]] name = "khronos-egl" version = "6.0.0" @@ -4293,19 +4029,6 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.10.0", - "cfg-if", - "cfg_aliases 0.2.1", - "libc", - "memoffset", -] - [[package]] name = "nix" version = "0.30.1" @@ -4470,22 +4193,6 @@ dependencies = [ "objc_exception", ] -[[package]] -name = "objc-sys" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" - -[[package]] -name = "objc2" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" -dependencies = [ - "objc-sys", - "objc2-encode", -] - [[package]] name = "objc2" version = "0.6.3" @@ -4495,22 +4202,6 @@ dependencies = [ "objc2-encode", ] -[[package]] -name = "objc2-app-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" -dependencies = [ - "bitflags 2.10.0", - "block2 0.5.1", - "libc", - "objc2 0.5.2", - "objc2-core-data 0.2.2", - "objc2-core-image 0.2.2", - "objc2-foundation 0.2.2", - "objc2-quartz-core 0.2.2", -] - [[package]] name = "objc2-app-kit" version = "0.3.2" @@ -4518,25 +4209,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" dependencies = [ "bitflags 2.10.0", - "block2 0.6.2", - "objc2 0.6.3", + "block2", + "objc2", "objc2-core-foundation", "objc2-core-graphics", - "objc2-foundation 0.3.2", - "objc2-quartz-core 0.3.2", -] - -[[package]] -name = "objc2-cloud-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" -dependencies = [ - "bitflags 2.10.0", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-core-location 0.2.2", - "objc2-foundation 0.2.2", + "objc2-foundation", + "objc2-quartz-core", ] [[package]] @@ -4546,31 +4224,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" dependencies = [ "bitflags 2.10.0", - "objc2 0.6.3", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-contacts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-core-data" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" -dependencies = [ - "bitflags 2.10.0", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", + "objc2", + "objc2-foundation", ] [[package]] @@ -4579,8 +4234,8 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" dependencies = [ - "objc2 0.6.3", - "objc2-foundation 0.3.2", + "objc2", + "objc2-foundation", ] [[package]] @@ -4590,8 +4245,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ "bitflags 2.10.0", + "block2", "dispatch2", - "objc2 0.6.3", + "objc2", ] [[package]] @@ -4602,63 +4258,51 @@ checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" dependencies = [ "bitflags 2.10.0", "dispatch2", - "objc2 0.6.3", + "libc", + "objc2", "objc2-core-foundation", "objc2-io-surface", ] -[[package]] -name = "objc2-core-image" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", - "objc2-metal 0.2.2", -] - [[package]] name = "objc2-core-image" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" dependencies = [ - "objc2 0.6.3", - "objc2-foundation 0.3.2", + "objc2", + "objc2-foundation", ] [[package]] name = "objc2-core-location" -version = "0.2.2" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +checksum = "ca347214e24bc973fc025fd0d36ebb179ff30536ed1f80252706db19ee452009" dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-contacts", - "objc2-foundation 0.2.2", + "objc2", + "objc2-foundation", ] [[package]] -name = "objc2-core-location" +name = "objc2-core-text" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca347214e24bc973fc025fd0d36ebb179ff30536ed1f80252706db19ee452009" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" dependencies = [ - "objc2 0.6.3", - "objc2-foundation 0.3.2", + "bitflags 2.10.0", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", ] [[package]] -name = "objc2-core-text" +name = "objc2-core-video" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6" dependencies = [ "bitflags 2.10.0", - "objc2 0.6.3", "objc2-core-foundation", "objc2-core-graphics", ] @@ -4669,19 +4313,6 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" -[[package]] -name = "objc2-foundation" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" -dependencies = [ - "bitflags 2.10.0", - "block2 0.5.1", - "dispatch", - "libc", - "objc2 0.5.2", -] - [[package]] name = "objc2-foundation" version = "0.3.2" @@ -4689,9 +4320,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ "bitflags 2.10.0", - "block2 0.6.2", + "block2", "libc", - "objc2 0.6.3", + "objc2", "objc2-core-foundation", ] @@ -4702,34 +4333,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" dependencies = [ "bitflags 2.10.0", - "objc2 0.6.3", + "objc2", "objc2-core-foundation", ] -[[package]] -name = "objc2-link-presentation" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-metal" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" -dependencies = [ - "bitflags 2.10.0", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", -] - [[package]] name = "objc2-metal" version = "0.3.2" @@ -4737,21 +4344,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" dependencies = [ "bitflags 2.10.0", - "objc2 0.6.3", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-quartz-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" -dependencies = [ - "bitflags 2.10.0", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", - "objc2-metal 0.2.2", + "objc2", + "objc2-foundation", ] [[package]] @@ -4761,41 +4355,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" dependencies = [ "bitflags 2.10.0", - "objc2 0.6.3", + "objc2", "objc2-core-foundation", - "objc2-foundation 0.3.2", - "objc2-metal 0.3.2", -] - -[[package]] -name = "objc2-symbols" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" -dependencies = [ - "objc2 0.5.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-ui-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" -dependencies = [ - "bitflags 2.10.0", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-cloud-kit 0.2.2", - "objc2-core-data 0.2.2", - "objc2-core-image 0.2.2", - "objc2-core-location 0.2.2", - "objc2-foundation 0.2.2", - "objc2-link-presentation", - "objc2-quartz-core 0.2.2", - "objc2-symbols", - "objc2-uniform-type-identifiers", - "objc2-user-notifications 0.2.2", + "objc2-foundation", + "objc2-metal", ] [[package]] @@ -4805,42 +4368,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" dependencies = [ "bitflags 2.10.0", - "block2 0.6.2", - "objc2 0.6.3", - "objc2-cloud-kit 0.3.2", - "objc2-core-data 0.3.2", + "block2", + "objc2", + "objc2-cloud-kit", + "objc2-core-data", "objc2-core-foundation", "objc2-core-graphics", - "objc2-core-image 0.3.2", - "objc2-core-location 0.3.2", + "objc2-core-image", + "objc2-core-location", "objc2-core-text", - "objc2-foundation 0.3.2", - "objc2-quartz-core 0.3.2", - "objc2-user-notifications 0.3.2", -] - -[[package]] -name = "objc2-uniform-type-identifiers" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-user-notifications" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" -dependencies = [ - "bitflags 2.10.0", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-core-location 0.2.2", - "objc2-foundation 0.2.2", + "objc2-foundation", + "objc2-quartz-core", + "objc2-user-notifications", ] [[package]] @@ -4849,8 +4388,8 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e" dependencies = [ - "objc2 0.6.3", - "objc2-foundation 0.3.2", + "objc2", + "objc2-foundation", ] [[package]] @@ -4969,10 +4508,10 @@ checksum = "e4022a17595a00d6a369236fdae483f0de7f0a339960a53118b818238e132224" dependencies = [ "android_system_properties", "log", - "nix 0.30.1", - "objc2 0.6.3", - "objc2-foundation 0.3.2", - "objc2-ui-kit 0.3.2", + "nix", + "objc2", + "objc2-foundation", + "objc2-ui-kit", "serde", "windows-sys 0.61.2", ] @@ -5150,17 +4689,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "piper" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" -dependencies = [ - "atomic-waker", - "fastrand", - "futures-io", -] - [[package]] name = "pixels" version = "0.15.0" @@ -5370,16 +4898,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" -[[package]] -name = "quick-xml" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" -dependencies = [ - "memchr", - "serde", -] - [[package]] name = "quick-xml" version = "0.37.5" @@ -5404,35 +4922,14 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - [[package]] name = "rand" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_chacha 0.9.0", - "rand_core 0.9.3", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", + "rand_chacha", + "rand_core", ] [[package]] @@ -5442,16 +4939,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core 0.9.3", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.16", + "rand_core", ] [[package]] @@ -5542,15 +5030,6 @@ dependencies = [ "winit", ] -[[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.18" @@ -5695,14 +5174,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef2bee61e6cffa4635c72d7d81a84294e28f0930db0ddcb0f66d10244674ebed" dependencies = [ "ashpd", - "block2 0.6.2", + "block2", "dispatch2", "js-sys", "log", - "objc2 0.6.3", - "objc2-app-kit 0.3.2", + "objc2", + "objc2-app-kit", "objc2-core-foundation", - "objc2-foundation 0.3.2", + "objc2-foundation", "pollster 0.4.0", "raw-window-handle", "urlencoding", @@ -5892,9 +5371,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sctk-adwaita" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" +checksum = "1dd3accc0f3f4bbaf2c9e1957a030dc582028130c67660d44c0a0345a22ca69b" dependencies = [ "ab_glyph", "log", @@ -6242,9 +5721,9 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "smithay-client-toolkit" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" dependencies = [ "bitflags 2.10.0", "calloop", @@ -6253,13 +5732,15 @@ dependencies = [ "libc", "log", "memmap2 0.9.9", - "rustix 0.38.44", - "thiserror 1.0.69", + "rustix 1.1.2", + "thiserror 2.0.17", "wayland-backend", "wayland-client", "wayland-csd-frame", "wayland-cursor", "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", "wayland-protocols-wlr", "wayland-scanner", "xkeysym", @@ -6267,11 +5748,12 @@ dependencies = [ [[package]] name = "smol_str" -version = "0.2.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +checksum = "3498b0a27f93ef1402f20eefacfaa1691272ac4eca1cdc8c596cb0a245d6cbf5" dependencies = [ - "serde", + "borsh", + "serde_core", ] [[package]] @@ -6297,11 +5779,11 @@ dependencies = [ "js-sys", "memmap2 0.9.9", "ndk", - "objc2 0.6.3", + "objc2", "objc2-core-foundation", "objc2-core-graphics", - "objc2-foundation 0.3.2", - "objc2-quartz-core 0.3.2", + "objc2-foundation", + "objc2-quartz-core", "raw-window-handle", "redox_syscall 0.5.18", "rustix 1.1.2", @@ -7145,6 +6627,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -7237,7 +6720,7 @@ dependencies = [ "http", "httparse", "log", - "rand 0.9.2", + "rand", "sha1", "thiserror 2.0.17", "utf-8", @@ -7771,6 +7254,32 @@ dependencies = [ "wayland-scanner", ] +[[package]] +name = "wayland-protocols-experimental" +version = "20250721.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags 2.10.0", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfe33d551eb8bffd03ff067a8b44bb963919157841a99957151299a6307d19c" +dependencies = [ + "bitflags 2.10.0", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + [[package]] name = "wayland-protocols-plasma" version = "0.3.9" @@ -7804,7 +7313,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54cb1e9dc49da91950bdfd8b848c49330536d9d1fb03d4bfec8cae50caa50ae3" dependencies = [ "proc-macro2", - "quick-xml 0.37.5", + "quick-xml", "quote", ] @@ -7862,8 +7371,8 @@ dependencies = [ "jni", "log", "ndk-context", - "objc2 0.6.3", - "objc2-foundation 0.3.2", + "objc2", + "objc2-foundation", "url", "web-sys", ] @@ -8642,51 +8151,224 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "winit" -version = "0.30.12" +version = "0.31.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66d4b9ed69c4009f6321f762d6e61ad8a2389cd431b97cb1e146812e9e6c732" +checksum = "2879d2854d1a43e48f67322d4bd097afcb6eb8f8f775c8de0260a71aea1df1aa" dependencies = [ - "ahash", - "android-activity", - "atomic-waker", "bitflags 2.10.0", - "block2 0.5.1", - "bytemuck", - "calloop", "cfg_aliases 0.2.1", - "concurrent-queue", - "core-foundation 0.9.4", - "core-graphics", "cursor-icon", "dpi", - "js-sys", "libc", - "memmap2 0.9.9", + "raw-window-handle", + "rustix 1.1.2", + "smol_str", + "tracing", + "winit-android", + "winit-appkit", + "winit-common", + "winit-core", + "winit-orbital", + "winit-uikit", + "winit-wayland", + "winit-web", + "winit-win32", + "winit-x11", +] + +[[package]] +name = "winit-android" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d9c0d2cd93efec3a9f9ad819cfaf0834782403af7c0d248c784ec0c61761df" +dependencies = [ + "android-activity", + "bitflags 2.10.0", + "dpi", "ndk", - "objc2 0.5.2", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", - "objc2-ui-kit 0.2.2", + "raw-window-handle", + "smol_str", + "tracing", + "winit-core", +] + +[[package]] +name = "winit-appkit" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21310ca07851a49c348e0c2cc768e36b52ca65afda2c2354d78ed4b90074d8aa" +dependencies = [ + "bitflags 2.10.0", + "block2", + "dispatch2", + "dpi", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-video", + "objc2-foundation", + "raw-window-handle", + "smol_str", + "tracing", + "winit-common", + "winit-core", +] + +[[package]] +name = "winit-common" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45375fbac4cbb77260d83a30b1f9d8105880dbac99a9ae97f56656694680ff69" +dependencies = [ + "memmap2 0.9.9", + "objc2", + "objc2-core-foundation", + "smol_str", + "tracing", + "winit-core", + "x11-dl", + "xkbcommon-dl", +] + +[[package]] +name = "winit-core" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4f0ccd7abb43740e2c6124ac7cae7d865ecec74eec63783e8922577ac232583" +dependencies = [ + "bitflags 2.10.0", + "cursor-icon", + "dpi", + "keyboard-types 0.8.3", + "raw-window-handle", + "smol_str", + "web-time", +] + +[[package]] +name = "winit-orbital" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51ea1fb262e7209f265f12bd0cc792c399b14355675e65531e9c8a87db287d46" +dependencies = [ + "bitflags 2.10.0", + "dpi", "orbclient", - "percent-encoding", - "pin-project", "raw-window-handle", - "redox_syscall 0.4.1", - "rustix 0.38.44", + "redox_syscall 0.5.18", + "smol_str", + "tracing", + "winit-core", +] + +[[package]] +name = "winit-uikit" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680a356e798837d8eb274d4556e83bceaf81698194e31aafc5cfb8a9f2fab643" +dependencies = [ + "bitflags 2.10.0", + "block2", + "dispatch2", + "dpi", + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-ui-kit", + "raw-window-handle", + "smol_str", + "tracing", + "winit-common", + "winit-core", +] + +[[package]] +name = "winit-wayland" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce5afb2ba07da603f84b722c95f9f9396d2cedae3944fb6c0cda4a6f88de545" +dependencies = [ + "ahash", + "bitflags 2.10.0", + "calloop", + "cursor-icon", + "dpi", + "libc", + "memmap2 0.9.9", + "raw-window-handle", + "rustix 1.1.2", "sctk-adwaita", "smithay-client-toolkit", "smol_str", "tracing", - "unicode-segmentation", - "wasm-bindgen", - "wasm-bindgen-futures", "wayland-backend", "wayland-client", "wayland-protocols", "wayland-protocols-plasma", + "winit-common", + "winit-core", +] + +[[package]] +name = "winit-web" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2490a953fb776fbbd5e295d54f1c3847f4f15b6c3929ec53c09acda6487a92" +dependencies = [ + "atomic-waker", + "bitflags 2.10.0", + "concurrent-queue", + "cursor-icon", + "dpi", + "js-sys", + "pin-project", + "raw-window-handle", + "smol_str", + "tracing", + "wasm-bindgen", + "wasm-bindgen-futures", "web-sys", "web-time", - "windows-sys 0.52.0", + "winit-core", +] + +[[package]] +name = "winit-win32" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "644ea78af0e858aa3b092e5d1c67c41995a98220c81813f1353b28bc8bb91eaa" +dependencies = [ + "bitflags 2.10.0", + "cursor-icon", + "dpi", + "raw-window-handle", + "smol_str", + "tracing", + "unicode-segmentation", + "windows-sys 0.59.0", + "winit-core", +] + +[[package]] +name = "winit-x11" +version = "0.31.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa5b600756534c7041aa93cd0d244d44b09fca1b89e202bd1cd80dd9f3636c46" +dependencies = [ + "bitflags 2.10.0", + "bytemuck", + "calloop", + "cursor-icon", + "dpi", + "libc", + "percent-encoding", + "raw-window-handle", + "rustix 1.1.2", + "smol_str", + "tracing", + "winit-common", + "winit-core", "x11-dl", "x11rb", "xkbcommon-dl", @@ -8807,6 +8489,7 @@ dependencies = [ "once_cell", "rustix 1.1.2", "x11rb-protocol", + "xcursor", ] [[package]] @@ -8831,16 +8514,6 @@ version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bec9e4a500ca8864c5b47b8b482a73d62e4237670e5b5f1d6b9e3cae50f28f2b" -[[package]] -name = "xdg-home" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6" -dependencies = [ - "libc", - "windows-sys 0.59.0", -] - [[package]] name = "xkbcommon-dl" version = "0.4.2" @@ -8928,44 +8601,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "zbus" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb97012beadd29e654708a0fdb4c84bc046f537aecfde2c3ee0a9e4b4d48c725" -dependencies = [ - "async-broadcast", - "async-executor", - "async-fs", - "async-io", - "async-lock", - "async-process", - "async-recursion", - "async-task", - "async-trait", - "blocking", - "enumflags2", - "event-listener", - "futures-core", - "futures-sink", - "futures-util", - "hex", - "nix 0.29.0", - "ordered-stream", - "rand 0.8.5", - "serde", - "serde_repr", - "sha1", - "static_assertions", - "tracing", - "uds_windows", - "windows-sys 0.52.0", - "xdg-home", - "zbus_macros 4.4.0", - "zbus_names 3.0.0", - "zvariant 4.2.0", -] - [[package]] name = "zbus" version = "5.12.0" @@ -8980,7 +8615,7 @@ dependencies = [ "futures-core", "futures-lite", "hex", - "nix 0.30.1", + "nix", "ordered-stream", "serde", "serde_repr", @@ -8990,46 +8625,9 @@ dependencies = [ "uuid", "windows-sys 0.61.2", "winnow", - "zbus_macros 5.12.0", - "zbus_names 4.2.0", - "zvariant 5.8.0", -] - -[[package]] -name = "zbus-lockstep" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca2c5dceb099bddaade154055c926bb8ae507a18756ba1d8963fd7b51d8ed1d" -dependencies = [ - "zbus_xml", - "zvariant 4.2.0", -] - -[[package]] -name = "zbus-lockstep-macros" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "709ab20fc57cb22af85be7b360239563209258430bccf38d8b979c5a2ae3ecce" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.111", - "zbus-lockstep", - "zbus_xml", - "zvariant 4.2.0", -] - -[[package]] -name = "zbus_macros" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267db9407081e90bbfa46d841d3cbc60f59c0351838c4bc65199ecd79ab1983e" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.111", - "zvariant_utils 2.1.0", + "zbus_macros", + "zbus_names", + "zvariant", ] [[package]] @@ -9042,20 +8640,9 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.111", - "zbus_names 4.2.0", - "zvariant 5.8.0", - "zvariant_utils 3.2.1", -] - -[[package]] -name = "zbus_names" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" -dependencies = [ - "serde", - "static_assertions", - "zvariant 4.2.0", + "zbus_names", + "zvariant", + "zvariant_utils", ] [[package]] @@ -9067,20 +8654,7 @@ dependencies = [ "serde", "static_assertions", "winnow", - "zvariant 5.8.0", -] - -[[package]] -name = "zbus_xml" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3f374552b954f6abb4bd6ce979e6c9b38fb9d0cd7cc68a7d796e70c9f3a233" -dependencies = [ - "quick-xml 0.30.0", - "serde", - "static_assertions", - "zbus_names 3.0.0", - "zvariant 4.2.0", + "zvariant", ] [[package]] @@ -9183,19 +8757,6 @@ dependencies = [ "zune-core", ] -[[package]] -name = "zvariant" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2084290ab9a1c471c38fc524945837734fbf124487e105daec2bb57fd48c81fe" -dependencies = [ - "endi", - "enumflags2", - "serde", - "static_assertions", - "zvariant_derive 4.2.0", -] - [[package]] name = "zvariant" version = "5.8.0" @@ -9207,21 +8768,8 @@ dependencies = [ "serde", "url", "winnow", - "zvariant_derive 5.8.0", - "zvariant_utils 3.2.1", -] - -[[package]] -name = "zvariant_derive" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73e2ba546bda683a90652bac4a279bc146adad1386f25379cf73200d2002c449" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.111", - "zvariant_utils 2.1.0", + "zvariant_derive", + "zvariant_utils", ] [[package]] @@ -9234,18 +8782,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.111", - "zvariant_utils 3.2.1", -] - -[[package]] -name = "zvariant_utils" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.111", + "zvariant_utils", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ed1a301b3..651345e26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ homepage = "https://github.com/dioxuslabs/blitz" repository = "https://github.com/dioxuslabs/blitz" categories = ["gui"] edition = "2024" -rust-version = "1.88.0" +rust-version = "1.89.0" [workspace.dependencies] # Blitz dependencies(in-repo) @@ -128,7 +128,7 @@ usvg = "0.45.1" # Windowing & Input raw-window-handle = "0.6.0" -winit = { version = "0.30.2", features = ["rwh_06"] } +winit = { version = "=0.31.0-beta.2" } accesskit_winit = "0.23" accesskit = "0.17" arboard = { version = "3.4.1", default-features = false } @@ -167,7 +167,7 @@ tracing-subscriber = "0.3" futures-util = "0.3.30" futures-intrusive = "0.5.0" pollster = "0.4" -smol_str = "0.2" +smol_str = "0.3" bitflags = "2.8.0" bytemuck = "1" fastrand = "2.3.0" @@ -214,7 +214,7 @@ edition = "2024" description = "Top level crate for Blitz" license = "MIT OR Apache-2.0" keywords = ["dom", "ui", "gui", "react", "wasm"] -rust-version = "1.86.0" +rust-version = "1.89.0" publish = false [dev-dependencies] diff --git a/apps/browser/Cargo.toml b/apps/browser/Cargo.toml index e737a515f..1da6727a2 100644 --- a/apps/browser/Cargo.toml +++ b/apps/browser/Cargo.toml @@ -41,3 +41,4 @@ blitz-html = { workspace = true } linebender_resource_handle = { workspace = true } tracing-subscriber = { workspace = true, optional = true } webbrowser = { workspace = true } +winit = { workspace = true } diff --git a/apps/readme/src/main.rs b/apps/readme/src/main.rs index 5ecb72773..b1742621a 100644 --- a/apps/readme/src/main.rs +++ b/apps/readme/src/main.rs @@ -37,24 +37,22 @@ use markdown::{BLITZ_MD_STYLES, GITHUB_MD_STYLES, markdown_to_html}; use notify::{Error as NotifyError, Event as NotifyEvent, RecursiveMode, Watcher as _}; use readme_application::{ReadmeApplication, ReadmeEvent}; -use blitz_shell::{BlitzShellEvent, BlitzShellNetWaker, WindowConfig, create_default_event_loop}; +use blitz_shell::{BlitzShellEvent, BlitzShellProxy, WindowConfig, create_default_event_loop}; use std::env::current_dir; use std::fs; use std::path::{Path, PathBuf}; use std::sync::Arc; use tokio::sync::oneshot; use url::Url; -use winit::event_loop::EventLoopProxy; use winit::window::WindowAttributes; struct ReadmeNavigationProvider { - proxy: EventLoopProxy, + proxy: BlitzShellProxy, } impl NavigationProvider for ReadmeNavigationProvider { fn navigate_to(&self, opts: NavigationOptions) { - let _ = self - .proxy + self.proxy .send_event(BlitzShellEvent::Navigate(Box::new(opts))); } } @@ -74,9 +72,10 @@ fn main() { let _guard = rt.enter(); let event_loop = create_default_event_loop(); - let proxy = event_loop.create_proxy(); + let winit_proxy = event_loop.create_proxy(); + let (proxy, event_queue) = BlitzShellProxy::new(winit_proxy); - let net_waker = Some(BlitzShellNetWaker::shared(proxy.clone())); + let net_waker = Some(Arc::new(proxy.clone()) as _); let net_provider = Arc::new(Provider::new(net_waker)); let (base_url, contents, is_md, file_path) = @@ -98,7 +97,6 @@ fn main() { // println!("{html}"); - let proxy = event_loop.create_proxy(); let navigation_provider = ReadmeNavigationProvider { proxy: proxy.clone(), }; @@ -121,6 +119,7 @@ fn main() { // Create application let mut application = ReadmeApplication::new( proxy.clone(), + event_queue, raw_url.clone(), net_provider, navigation_provider, @@ -131,7 +130,7 @@ fn main() { let mut watcher = notify::recommended_watcher(move |_: Result| { let event = BlitzShellEvent::Embedder(Arc::new(ReadmeEvent)); - proxy.send_event(event).unwrap(); + proxy.send_event(event); }) .unwrap(); @@ -145,7 +144,7 @@ fn main() { } // Run event loop - event_loop.run_app(&mut application).unwrap() + event_loop.run_app(application).unwrap() } async fn fetch( diff --git a/apps/readme/src/readme_application.rs b/apps/readme/src/readme_application.rs index ce22dd9ea..db45cf4c1 100644 --- a/apps/readme/src/readme_application.rs +++ b/apps/readme/src/readme_application.rs @@ -4,13 +4,14 @@ use crate::WindowRenderer; use blitz_dom::DocumentConfig; use blitz_html::HtmlDocument; use blitz_net::Provider; -use blitz_shell::{BlitzApplication, BlitzShellEvent, View, WindowConfig}; +use blitz_shell::{BlitzApplication, BlitzShellEvent, BlitzShellProxy, View, WindowConfig}; use blitz_traits::navigation::{NavigationOptions, NavigationProvider}; use tokio::runtime::Handle; use winit::application::ApplicationHandler; use winit::event::{Modifiers, StartCause, WindowEvent}; -use winit::event_loop::{ActiveEventLoop, EventLoopProxy}; +use winit::event_loop::ActiveEventLoop; use winit::keyboard::{KeyCode, PhysicalKey}; +use winit::platform::macos::ApplicationHandlerExtMacOS; use winit::window::{Theme, WindowId}; use crate::fetch; @@ -30,14 +31,15 @@ pub struct ReadmeApplication { impl ReadmeApplication { pub fn new( - proxy: EventLoopProxy, + proxy: BlitzShellProxy, + event_queue: std::sync::mpsc::Receiver, raw_url: String, net_provider: Arc, navigation_provider: Arc, ) -> Self { let handle = Handle::current(); Self { - inner: BlitzApplication::new(proxy.clone()), + inner: BlitzApplication::new(proxy, event_queue), handle, raw_url, net_provider, @@ -63,14 +65,12 @@ impl ReadmeApplication { self.handle.spawn(async move { let url = url; let (base_url, contents, is_md, _file_path) = fetch(&url, net_provider).await; - proxy - .send_event(BlitzShellEvent::NavigationLoad { - url: base_url, - contents, - is_md, - retain_scroll_position, - }) - .unwrap(); + proxy.send_event(BlitzShellEvent::NavigationLoad { + url: base_url, + contents, + is_md, + retain_scroll_position, + }); }); } @@ -81,14 +81,12 @@ impl ReadmeApplication { Box::new(move |result| { let (url, bytes) = result.unwrap(); let contents = std::str::from_utf8(&bytes).unwrap().to_string(); - proxy - .send_event(BlitzShellEvent::NavigationLoad { - url, - contents, - is_md: false, - retain_scroll_position: false, - }) - .unwrap(); + proxy.send_event(BlitzShellEvent::NavigationLoad { + url, + contents, + is_md: false, + retain_scroll_position: false, + }); }), ); } @@ -132,22 +130,34 @@ impl ReadmeApplication { } } -impl ApplicationHandler for ReadmeApplication { - fn resumed(&mut self, event_loop: &ActiveEventLoop) { +impl ApplicationHandler for ReadmeApplication { + fn macos_handler(&mut self) -> Option<&mut dyn ApplicationHandlerExtMacOS> { + self.inner.macos_handler() + } + + fn resumed(&mut self, event_loop: &dyn ActiveEventLoop) { self.inner.resumed(event_loop); } - fn suspended(&mut self, event_loop: &ActiveEventLoop) { + fn suspended(&mut self, event_loop: &dyn ActiveEventLoop) { self.inner.suspended(event_loop); } - fn new_events(&mut self, event_loop: &ActiveEventLoop, cause: StartCause) { + fn can_create_surfaces(&mut self, event_loop: &dyn ActiveEventLoop) { + self.inner.can_create_surfaces(event_loop); + } + + fn destroy_surfaces(&mut self, event_loop: &dyn ActiveEventLoop) { + self.inner.destroy_surfaces(event_loop); + } + + fn new_events(&mut self, event_loop: &dyn ActiveEventLoop, cause: StartCause) { self.inner.new_events(event_loop, cause); } fn window_event( &mut self, - event_loop: &ActiveEventLoop, + event_loop: &dyn ActiveEventLoop, window_id: WindowId, event: WindowEvent, ) { @@ -157,7 +167,7 @@ impl ApplicationHandler for ReadmeApplication { if let WindowEvent::KeyboardInput { event, .. } = &event { let mods = self.keyboard_modifiers.state(); - if !event.state.is_pressed() && (mods.control_key() || mods.super_key()) { + if !event.state.is_pressed() && (mods.control_key() || mods.meta_key()) { match event.physical_key { PhysicalKey::Code(KeyCode::KeyR) => self.reload_document(true), PhysicalKey::Code(KeyCode::KeyT) => self.toggle_theme(), @@ -175,28 +185,30 @@ impl ApplicationHandler for ReadmeApplication { self.inner.window_event(event_loop, window_id, event); } - fn user_event(&mut self, event_loop: &ActiveEventLoop, event: BlitzShellEvent) { - match event { - BlitzShellEvent::Embedder(event) => { - if let Some(_event) = event.downcast_ref::() { - self.reload_document(true); + fn proxy_wake_up(&mut self, event_loop: &dyn ActiveEventLoop) { + while let Ok(event) = self.inner.event_queue.try_recv() { + match event { + BlitzShellEvent::Embedder(event) => { + if let Some(_event) = event.downcast_ref::() { + self.reload_document(true); + } } + BlitzShellEvent::Navigate(options) => { + let old_url = std::mem::replace(&mut self.raw_url, options.url.to_string()); + self.url_history.push(old_url); + self.reload_document(false); + self.navigate(*options); + } + BlitzShellEvent::NavigationLoad { + url, + contents, + retain_scroll_position, + is_md, + } => { + self.load_document(contents, retain_scroll_position, url, is_md); + } + event => self.inner.handle_blitz_shell_event(event_loop, event), } - BlitzShellEvent::Navigate(options) => { - let old_url = std::mem::replace(&mut self.raw_url, options.url.to_string()); - self.url_history.push(old_url); - self.reload_document(false); - self.navigate(*options); - } - BlitzShellEvent::NavigationLoad { - url, - contents, - retain_scroll_position, - is_md, - } => { - self.load_document(contents, retain_scroll_position, url, is_md); - } - event => self.inner.user_event(event_loop, event), } } } diff --git a/examples/inner_html.rs b/examples/inner_html.rs index 03df3be4b..d2e4d8268 100644 --- a/examples/inner_html.rs +++ b/examples/inner_html.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use anyrender_vello::VelloWindowRenderer; use blitz_dom::DocumentConfig; use blitz_html::{HtmlDocument, HtmlProvider}; -use blitz_shell::{BlitzApplication, BlitzShellEvent, WindowConfig, create_default_event_loop}; +use blitz_shell::{BlitzApplication, BlitzShellProxy, WindowConfig, create_default_event_loop}; pub fn main() { // Create renderer @@ -22,14 +22,15 @@ pub fn main() { doc.resolve(0.0); // Create the Winit application and window - let event_loop = create_default_event_loop::(); - let mut application = BlitzApplication::new(event_loop.create_proxy()); + let event_loop = create_default_event_loop(); + let (proxy, reciever) = BlitzShellProxy::new(event_loop.create_proxy()); + let mut application = BlitzApplication::new(proxy, reciever); let renderer = VelloWindowRenderer::new(); let window = WindowConfig::new(Box::new(doc), renderer); application.add_window(window); // Run event loop - event_loop.run_app(&mut application).unwrap() + event_loop.run_app(application).unwrap() } static HTML: &str = r#" diff --git a/examples/screenshot.rs b/examples/screenshot.rs index 8a05dc25d..df3de74fd 100644 --- a/examples/screenshot.rs +++ b/examples/screenshot.rs @@ -117,7 +117,15 @@ async fn main() { ); // Render document - paint_scene(scene, document.as_ref(), scale, render_width, render_height); + paint_scene( + scene, + document.as_ref(), + scale, + render_width, + render_height, + 0, + 0, + ); }, render_width, render_height, diff --git a/examples/wgpu_texture/src/html.rs b/examples/wgpu_texture/src/html.rs index 77f10c244..0a28feeba 100644 --- a/examples/wgpu_texture/src/html.rs +++ b/examples/wgpu_texture/src/html.rs @@ -1,7 +1,7 @@ use anyrender_vello::{VelloRendererOptions, VelloWindowRenderer}; use blitz_dom::{qual_name, DocumentConfig}; use blitz_html::HtmlDocument; -use blitz_shell::{create_default_event_loop, BlitzApplication, BlitzShellEvent, WindowConfig}; +use blitz_shell::{create_default_event_loop, BlitzApplication, BlitzShellProxy, WindowConfig}; use crate::{limits, DemoPaintSource, FEATURES, STYLES}; @@ -30,13 +30,14 @@ pub fn launch_html() { .set_attribute(canvas_node_id, src_attr, &src_str); // Create the Winit application and window - let event_loop = create_default_event_loop::(); - let mut application = BlitzApplication::new(event_loop.create_proxy()); + let event_loop = create_default_event_loop(); + let (proxy, reciever) = BlitzShellProxy::new(event_loop.create_proxy()); + let mut application = BlitzApplication::new(proxy, reciever); let window = WindowConfig::new(Box::new(doc), renderer); application.add_window(window); // Run event loop - event_loop.run_app(&mut application).unwrap() + event_loop.run_app(application).unwrap() } static HTML: &str = r#" diff --git a/packages/blitz-dom/src/events/ime.rs b/packages/blitz-dom/src/events/ime.rs index 635015681..ad629915a 100644 --- a/packages/blitz-dom/src/events/ime.rs +++ b/packages/blitz-dom/src/events/ime.rs @@ -41,6 +41,14 @@ pub(crate) fn handle_ime_event( } doc.shell_provider.request_redraw(); } + BlitzImeEvent::DeleteSurrounding { + before_bytes, + after_bytes, + } => { + let _ = before_bytes; + let _ = after_bytes; + // TODO + } } println!("Sent ime event to {node_id}"); } diff --git a/packages/blitz-paint/src/lib.rs b/packages/blitz-paint/src/lib.rs index 62f56008e..9b3c4de91 100644 --- a/packages/blitz-paint/src/lib.rs +++ b/packages/blitz-paint/src/lib.rs @@ -31,8 +31,11 @@ pub fn paint_scene( scale: f64, width: u32, height: u32, + x_offset: u32, + y_offset: u32, ) { - let generator = BlitzDomPainter::new(dom, scale, width, height, 0.0, 0.0); + let generator = + BlitzDomPainter::new(dom, scale, width, height, x_offset as f64, y_offset as f64); generator.paint_scene(scene); // println!( diff --git a/packages/blitz-shell/Cargo.toml b/packages/blitz-shell/Cargo.toml index 89d3416d6..7dfe70e3e 100644 --- a/packages/blitz-shell/Cargo.toml +++ b/packages/blitz-shell/Cargo.toml @@ -14,7 +14,7 @@ rust-version.workspace = true default = ["accessibility", "clipboard", "file_dialog"] accessibility = [ "dep:accesskit", - "dep:accesskit_winit", + # "dep:accesskit_winit", "blitz-dom/accessibility", ] clipboard = ["dep:arboard"] @@ -34,7 +34,7 @@ anyrender = { workspace = true } winit = { workspace = true } keyboard-types = { workspace = true } accesskit = { workspace = true, optional = true } -accesskit_winit = { workspace = true, optional = true } +# accesskit_winit = { workspace = true, optional = true } # Other dependencies tracing = { workspace = true, optional = true } diff --git a/packages/blitz-shell/src/accessibility.rs b/packages/blitz-shell/src/accessibility.rs index 07aeb9c8d..79fc8ac3d 100644 --- a/packages/blitz-shell/src/accessibility.rs +++ b/packages/blitz-shell/src/accessibility.rs @@ -1,22 +1,25 @@ -use crate::event::BlitzShellEvent; -use accesskit_winit::Adapter; +use crate::event::BlitzShellProxy; +// use accesskit_winit::Adapter; use blitz_dom::BaseDocument; -use winit::{event_loop::EventLoopProxy, window::Window}; +use winit::window::Window; /// State of the accessibility node tree and platform adapter. pub struct AccessibilityState { - /// Adapter to connect to the [`EventLoop`](`winit::event_loop::EventLoop`). - adapter: accesskit_winit::Adapter, + // /// Adapter to connect to the [`EventLoop`](`winit::event_loop::EventLoop`). + // adapter: accesskit_winit::Adapter, } impl AccessibilityState { - pub fn new(window: &Window, proxy: EventLoopProxy) -> Self { + pub fn new(window: &dyn Window, proxy: BlitzShellProxy) -> Self { + let _ = window; + let _ = proxy; Self { - adapter: Adapter::with_event_loop_proxy(window, proxy.clone()), + // adapter: Adapter::with_event_loop_proxy(window, proxy.clone()), } } pub fn update_tree(&mut self, doc: &BaseDocument) { - self.adapter - .update_if_active(|| doc.build_accessibility_tree()); + let _ = doc; + // self.adapter + // .update_if_active(|| doc.build_accessibility_tree()); } } diff --git a/packages/blitz-shell/src/application.rs b/packages/blitz-shell/src/application.rs index eb7076a67..5a0fbc189 100644 --- a/packages/blitz-shell/src/application.rs +++ b/packages/blitz-shell/src/application.rs @@ -1,26 +1,32 @@ -use crate::event::BlitzShellEvent; +use crate::event::{BlitzShellEvent, BlitzShellProxy}; use anyrender::WindowRenderer; use std::collections::HashMap; +use std::sync::mpsc::Receiver; use winit::application::ApplicationHandler; use winit::event::WindowEvent; -use winit::event_loop::{ActiveEventLoop, EventLoopProxy}; +use winit::event_loop::ActiveEventLoop; use winit::window::WindowId; +#[cfg(target_os = "macos")] +use winit::platform::macos::ApplicationHandlerExtMacOS; + use crate::{View, WindowConfig}; pub struct BlitzApplication { pub windows: HashMap>, pub pending_windows: Vec>, - pub proxy: EventLoopProxy, + pub proxy: BlitzShellProxy, + pub event_queue: Receiver, } impl BlitzApplication { - pub fn new(proxy: EventLoopProxy) -> Self { + pub fn new(proxy: BlitzShellProxy, event_queue: Receiver) -> Self { BlitzApplication { windows: HashMap::new(), pending_windows: Vec::new(), proxy, + event_queue, } } @@ -31,10 +37,56 @@ impl BlitzApplication { fn window_mut_by_doc_id(&mut self, doc_id: usize) -> Option<&mut View> { self.windows.values_mut().find(|w| w.doc.id() == doc_id) } + + pub fn handle_blitz_shell_event( + &mut self, + _event_loop: &dyn ActiveEventLoop, + event: BlitzShellEvent, + ) { + match event { + BlitzShellEvent::Poll { window_id } => { + if let Some(window) = self.windows.get_mut(&window_id) { + window.poll(); + }; + } + BlitzShellEvent::RequestRedraw { doc_id } => { + // TODO: Handle multiple documents per window + if let Some(window) = self.window_mut_by_doc_id(doc_id) { + window.request_redraw(); + } + } + + // #[cfg(feature = "accessibility")] + // BlitzShellEvent::Accessibility { window_id, data } => { + // if let Some(window) = self.windows.get_mut(&window_id) { + // match &*data { + // accesskit_winit::WindowEvent::InitialTreeRequested => { + // window.build_accessibility_tree(); + // } + // accesskit_winit::WindowEvent::AccessibilityDeactivated => { + // // TODO + // } + // accesskit_winit::WindowEvent::ActionRequested(_req) => { + // // TODO + // } + // } + // } + // } + BlitzShellEvent::Embedder(_) => { + // Do nothing. Should be handled by embedders (if required). + } + BlitzShellEvent::Navigate(_opts) => { + // Do nothing. Should be handled by embedders (if required). + } + BlitzShellEvent::NavigationLoad { .. } => { + // Do nothing. Should be handled by embedders (if required). + } + } + } } -impl ApplicationHandler for BlitzApplication { - fn resumed(&mut self, event_loop: &ActiveEventLoop) { +impl ApplicationHandler for BlitzApplication { + fn can_create_surfaces(&mut self, event_loop: &dyn ActiveEventLoop) { // Resume existing windows for (_, view) in self.windows.iter_mut() { view.resume(); @@ -51,15 +103,23 @@ impl ApplicationHandler for BlitzApplicat } } - fn suspended(&mut self, _event_loop: &ActiveEventLoop) { + fn destroy_surfaces(&mut self, _event_loop: &dyn ActiveEventLoop) { for (_, view) in self.windows.iter_mut() { view.suspend(); } } + fn resumed(&mut self, _event_loop: &dyn ActiveEventLoop) { + // TODO + } + + fn suspended(&mut self, _event_loop: &dyn ActiveEventLoop) { + // TODO + } + fn window_event( &mut self, - event_loop: &ActiveEventLoop, + event_loop: &dyn ActiveEventLoop, window_id: WindowId, event: WindowEvent, ) { @@ -79,49 +139,31 @@ impl ApplicationHandler for BlitzApplicat window.handle_winit_event(event); } - let _ = self.proxy.send_event(BlitzShellEvent::Poll { window_id }); + self.proxy.send_event(BlitzShellEvent::Poll { window_id }); } - fn user_event(&mut self, _event_loop: &ActiveEventLoop, event: BlitzShellEvent) { - match event { - BlitzShellEvent::Poll { window_id } => { - if let Some(window) = self.windows.get_mut(&window_id) { - window.poll(); - }; - } - BlitzShellEvent::RequestRedraw { doc_id } => { - // TODO: Handle multiple documents per window - if let Some(window) = self.window_mut_by_doc_id(doc_id) { - window.request_redraw(); - } - } + fn proxy_wake_up(&mut self, event_loop: &dyn ActiveEventLoop) { + while let Ok(event) = self.event_queue.try_recv() { + self.handle_blitz_shell_event(event_loop, event); + } + } - #[cfg(feature = "accessibility")] - BlitzShellEvent::Accessibility { window_id, data } => { - if let Some(window) = self.windows.get_mut(&window_id) { - match &*data { - accesskit_winit::WindowEvent::InitialTreeRequested => { - window.build_accessibility_tree(); - } - accesskit_winit::WindowEvent::AccessibilityDeactivated => { - // TODO - } - accesskit_winit::WindowEvent::ActionRequested(_req) => { - // TODO - } - } - } - } + #[cfg(target_os = "macos")] + fn macos_handler(&mut self) -> Option<&mut dyn ApplicationHandlerExtMacOS> { + Some(self) + } +} - BlitzShellEvent::Embedder(_) => { - // Do nothing. Should be handled by embedders (if required). - } - BlitzShellEvent::Navigate(_opts) => { - // Do nothing. Should be handled by embedders (if required). - } - BlitzShellEvent::NavigationLoad { .. } => { - // Do nothing. Should be handled by embedders (if required). - } - } +#[cfg(target_os = "macos")] +impl ApplicationHandlerExtMacOS for BlitzApplication { + fn standard_key_binding( + &mut self, + event_loop: &dyn ActiveEventLoop, + window_id: WindowId, + action: &str, + ) { + let _ = event_loop; + let _ = window_id; + let _ = action; } } diff --git a/packages/blitz-shell/src/convert_events.rs b/packages/blitz-shell/src/convert_events.rs index e3971fe34..bec3ba861 100644 --- a/packages/blitz-shell/src/convert_events.rs +++ b/packages/blitz-shell/src/convert_events.rs @@ -32,6 +32,13 @@ pub(crate) fn winit_ime_to_blitz(event: Ime) -> BlitzImeEvent { Ime::Disabled => BlitzImeEvent::Disabled, Ime::Preedit(text, cursor) => BlitzImeEvent::Preedit(text, cursor), Ime::Commit(text) => BlitzImeEvent::Commit(text), + Ime::DeleteSurrounding { + before_bytes, + after_bytes, + } => BlitzImeEvent::DeleteSurrounding { + before_bytes, + after_bytes, + }, } } @@ -65,7 +72,7 @@ pub(crate) fn winit_modifiers_to_kbt_modifiers(winit_modifiers: WinitModifiers) if winit_modifiers.shift_key() { modifiers.insert(Modifiers::SHIFT); } - if winit_modifiers.super_key() { + if winit_modifiers.meta_key() { modifiers.insert(Modifiers::SUPER); } modifiers @@ -80,15 +87,13 @@ pub(crate) fn winit_key_location_to_kbt_location(location: WinitKeyLocation) -> } } +#[allow(deprecated)] // Should cover all variants for conversion pub(crate) fn winit_physical_key_to_kbt_code(physical_key: &WinitPhysicalKey) -> Code { match physical_key { WinitPhysicalKey::Unidentified(_) => Code::Unidentified, WinitPhysicalKey::Code(key_code) => match key_code { - // Variants that don't match 1:1 - WinitKeyCode::Meta => Code::Super, - WinitKeyCode::SuperLeft => Code::Super, - WinitKeyCode::SuperRight => Code::Super, - + WinitKeyCode::MetaLeft => Code::Super, + WinitKeyCode::MetaRight => Code::Super, WinitKeyCode::Backquote => Code::Backquote, WinitKeyCode::Backslash => Code::Backslash, WinitKeyCode::BracketLeft => Code::BracketLeft, @@ -280,12 +285,37 @@ pub(crate) fn winit_physical_key_to_kbt_code(physical_key: &WinitPhysicalKey) -> WinitKeyCode::F33 => Code::F33, WinitKeyCode::F34 => Code::F34, WinitKeyCode::F35 => Code::F35, + WinitKeyCode::Super => Code::Super, + WinitKeyCode::Unidentified => Code::Unidentified, + WinitKeyCode::BrightnessDown => Code::BrightnessDown, + WinitKeyCode::BrightnessUp => Code::BrightnessUp, + WinitKeyCode::DisplayToggleIntExt => Code::DisplayToggleIntExt, + WinitKeyCode::KeyboardLayoutSelect => Code::KeyboardLayoutSelect, + WinitKeyCode::LaunchAssistant => Code::LaunchAssistant, + WinitKeyCode::LaunchControlPanel => Code::LaunchControlPanel, + WinitKeyCode::LaunchScreenSaver => Code::LaunchScreenSaver, + WinitKeyCode::MailForward => Code::MailForward, + WinitKeyCode::MailReply => Code::MailReply, + WinitKeyCode::MailSend => Code::MailSend, + WinitKeyCode::MediaFastForward => Code::MediaFastForward, + WinitKeyCode::MediaPause => Code::MediaPause, + WinitKeyCode::MediaPlay => Code::MediaPlay, + WinitKeyCode::MediaRecord => Code::MediaRecord, + WinitKeyCode::MediaRewind => Code::MediaRewind, + WinitKeyCode::MicrophoneMuteToggle => Code::MicrophoneMuteToggle, + WinitKeyCode::PrivacyScreenToggle => Code::PrivacyScreenToggle, + WinitKeyCode::SelectTask => Code::SelectTask, + WinitKeyCode::ShowAllWindows => Code::ShowAllWindows, + WinitKeyCode::ZoomToggle => Code::ZoomToggle, + + WinitKeyCode::KeyboardBacklightToggle => todo!(), _ => todo!(), }, } } pub(crate) fn winit_key_to_kbt_key(winit_key: &WinitKey) -> Key { + #[allow(deprecated)] // Should cover all variants for conversion match winit_key { WinitKey::Character(c) => Key::Character(c.to_string()), WinitKey::Unidentified(_) => Key::Unidentified, @@ -307,7 +337,6 @@ pub(crate) fn winit_key_to_kbt_key(winit_key: &WinitKey) -> Key { WinitNamedKey::Super => Key::Super, WinitNamedKey::Enter => Key::Enter, WinitNamedKey::Tab => Key::Tab, - WinitNamedKey::Space => Key::Character(" ".to_string()), WinitNamedKey::ArrowDown => Key::ArrowDown, WinitNamedKey::ArrowLeft => Key::ArrowLeft, WinitNamedKey::ArrowRight => Key::ArrowRight, @@ -597,6 +626,9 @@ pub(crate) fn winit_key_to_kbt_key(winit_key: &WinitKey) -> Key { WinitNamedKey::F33 => Key::F33, WinitNamedKey::F34 => Key::F34, WinitNamedKey::F35 => Key::F35, + WinitNamedKey::Unidentified => Key::Unidentified, + WinitNamedKey::Dead => Key::Dead, + _ => Key::Unidentified, }, } diff --git a/packages/blitz-shell/src/event.rs b/packages/blitz-shell/src/event.rs index 6df53ba9a..6b3ce497e 100644 --- a/packages/blitz-shell/src/event.rs +++ b/packages/blitz-shell/src/event.rs @@ -1,10 +1,12 @@ use blitz_traits::navigation::NavigationOptions; +use blitz_traits::net::NetWaker; use futures_util::task::ArcWake; +use std::sync::mpsc::{Receiver, Sender, channel}; use std::{any::Any, sync::Arc}; use winit::{event_loop::EventLoopProxy, window::WindowId}; -#[cfg(feature = "accessibility")] -use accesskit_winit::{Event as AccessKitEvent, WindowEvent as AccessKitWindowEvent}; +// #[cfg(feature = "accessibility")] +// use accesskit_winit::{Event as AccessKitEvent, WindowEvent as AccessKitWindowEvent}; #[derive(Debug, Clone)] pub enum BlitzShellEvent { @@ -17,11 +19,11 @@ pub enum BlitzShellEvent { }, /// An accessibility event from `accesskit`. - #[cfg(feature = "accessibility")] - Accessibility { - window_id: WindowId, - data: Arc, - }, + // #[cfg(feature = "accessibility")] + // Accessibility { + // window_id: WindowId, + // data: Arc, + // }, /// An arbitary event from the Blitz embedder Embedder(Arc), @@ -44,13 +46,48 @@ impl BlitzShellEvent { } } -#[cfg(feature = "accessibility")] -impl From for BlitzShellEvent { - fn from(value: AccessKitEvent) -> Self { - Self::Accessibility { - window_id: value.window_id, - data: Arc::new(value.window_event), - } +// #[cfg(feature = "accessibility")] +// impl From for BlitzShellEvent { +// fn from(value: AccessKitEvent) -> Self { +// Self::Accessibility { +// window_id: value.window_id, +// data: Arc::new(value.window_event), +// } +// } +// } + +#[derive(Clone)] +pub struct BlitzShellProxy(Arc); +pub struct BlitzShellProxyInner { + winit_proxy: EventLoopProxy, + sender: Sender, +} + +impl BlitzShellProxy { + pub fn new(winit_proxy: EventLoopProxy) -> (Self, Receiver) { + let (sender, receiver) = channel(); + let proxy = Self(Arc::new(BlitzShellProxyInner { + winit_proxy, + sender, + })); + (proxy, receiver) + } + + pub fn wake_up(&self) { + self.0.winit_proxy.wake_up(); + } + pub fn send_event(&self, event: impl Into) { + self.send_event_impl(event.into()); + } + fn send_event_impl(&self, event: BlitzShellEvent) { + let _ = self.0.sender.send(event); + self.wake_up(); + } +} + +impl NetWaker for BlitzShellProxy { + fn wake(&self, client_id: usize) { + self.send_event_impl(BlitzShellEvent::RequestRedraw { doc_id: client_id }) } } @@ -59,16 +96,17 @@ impl From for BlitzShellEvent { /// This lets the VirtualDom "come up for air" and process events while the main thread is blocked by the WebView. /// /// All other IO lives in the Tokio runtime, -pub fn create_waker(proxy: &EventLoopProxy, id: WindowId) -> std::task::Waker { +pub fn create_waker(proxy: &BlitzShellProxy, id: WindowId) -> std::task::Waker { struct DomHandle { - proxy: EventLoopProxy, + proxy: BlitzShellProxy, id: WindowId, } impl ArcWake for DomHandle { fn wake_by_ref(arc_self: &Arc) { - _ = arc_self.proxy.send_event(BlitzShellEvent::Poll { + let event = BlitzShellEvent::Poll { window_id: arc_self.id, - }) + }; + arc_self.proxy.send_event(event) } } diff --git a/packages/blitz-shell/src/lib.rs b/packages/blitz-shell/src/lib.rs index a8d442db4..4149085ce 100644 --- a/packages/blitz-shell/src/lib.rs +++ b/packages/blitz-shell/src/lib.rs @@ -18,8 +18,7 @@ mod window; mod accessibility; pub use crate::application::BlitzApplication; -pub use crate::event::BlitzShellEvent; -pub use crate::net::BlitzShellNetWaker; +pub use crate::event::{BlitzShellEvent, BlitzShellProxy}; pub use crate::window::{View, WindowConfig}; #[cfg(feature = "data-uri")] @@ -40,9 +39,11 @@ pub use crate::net::DataUriNetProvider; use blitz_traits::shell::FileDialogFilter; use blitz_traits::shell::ShellProvider; use std::sync::Arc; +use winit::cursor::{Cursor, CursorIcon}; use winit::dpi::{LogicalPosition, LogicalSize}; pub use winit::event_loop::{ControlFlow, EventLoop, EventLoopProxy}; -pub use winit::window::{CursorIcon, Window}; +pub use winit::window::Window; +use winit::window::{ImeCapabilities, ImeEnableRequest, ImeRequest, ImeRequestData}; #[derive(Default)] pub struct Config { @@ -51,8 +52,8 @@ pub struct Config { } /// Build an event loop for the application -pub fn create_default_event_loop() -> EventLoop { - let mut ev_builder = EventLoop::::with_user_event(); +pub fn create_default_event_loop() -> EventLoop { + let mut ev_builder = EventLoop::builder(); #[cfg(target_os = "android")] { use winit::platform::android::EventLoopBuilderExtAndroid; @@ -84,10 +85,10 @@ pub fn current_android_app() -> android_activity::AndroidApp { } pub struct BlitzShellProvider { - window: Arc, + window: Arc, } impl BlitzShellProvider { - pub fn new(window: Arc) -> Self { + pub fn new(window: Arc) -> Self { Self { window } } } @@ -97,17 +98,27 @@ impl ShellProvider for BlitzShellProvider { self.window.request_redraw(); } fn set_cursor(&self, icon: CursorIcon) { - self.window.set_cursor(icon); + self.window.set_cursor(Cursor::Icon(icon)); } fn set_window_title(&self, title: String) { self.window.set_title(&title); } fn set_ime_enabled(&self, is_enabled: bool) { - self.window.set_ime_allowed(is_enabled); + if is_enabled { + let _ = self.window.request_ime_update(ImeRequest::Enable( + ImeEnableRequest::new(ImeCapabilities::new(), ImeRequestData::default()).unwrap(), + )); + } else { + let _ = self.window.request_ime_update(ImeRequest::Disable); + } } fn set_ime_cursor_area(&self, x: f32, y: f32, width: f32, height: f32) { - self.window - .set_ime_cursor_area(LogicalPosition::new(x, y), LogicalSize::new(width, height)); + let _ = self.window.request_ime_update(ImeRequest::Update( + ImeRequestData::default().with_cursor_area( + LogicalPosition::new(x, y).into(), + LogicalSize::new(width, height).into(), + ), + )); } #[cfg(all( diff --git a/packages/blitz-shell/src/net.rs b/packages/blitz-shell/src/net.rs index 986c14c2c..f589ab2b2 100644 --- a/packages/blitz-shell/src/net.rs +++ b/packages/blitz-shell/src/net.rs @@ -1,29 +1,27 @@ -use std::sync::Arc; +// use std::sync::Arc; -use blitz_traits::net::NetWaker; -use winit::event_loop::EventLoopProxy; +// use blitz_traits::net::NetWaker; +// use winit::event_loop::EventLoopProxy; -use crate::BlitzShellEvent; +// use crate::{BlitzShellEvent, event::BlitzShellProxy}; -/// A NetWaker that wakes up our winit event loop -pub struct BlitzShellNetWaker(EventLoopProxy); +// /// A NetWaker that wakes up our winit event loop +// pub struct BlitzShellNetWaker(BlitzShellProxy); -impl BlitzShellNetWaker { - pub fn new(proxy: EventLoopProxy) -> Self { - Self(proxy) - } +// impl BlitzShellNetWaker { +// pub fn new(proxy: BlitzShellProxy) -> Self { +// Self(proxy) +// } - pub fn shared(proxy: EventLoopProxy) -> Arc { - Arc::new(Self(proxy)) - } -} -impl NetWaker for BlitzShellNetWaker { - fn wake(&self, doc_id: usize) { - self.0 - .send_event(BlitzShellEvent::RequestRedraw { doc_id }) - .unwrap() - } -} +// pub fn shared(proxy: BlitzShellProxy) -> Arc { +// Arc::new(Self(proxy)) +// } +// } +// impl NetWaker for BlitzShellNetWaker { +// fn wake(&self, doc_id: usize) { +// self.0.send_event(BlitzShellEvent::RequestRedraw { doc_id }) +// } +// } #[cfg(feature = "data-uri")] mod data_uri_net_provider { diff --git a/packages/blitz-shell/src/window.rs b/packages/blitz-shell/src/window.rs index 4b1eec39d..7a18ccaf4 100644 --- a/packages/blitz-shell/src/window.rs +++ b/packages/blitz-shell/src/window.rs @@ -3,7 +3,7 @@ use crate::convert_events::{ color_scheme_to_theme, theme_to_color_scheme, winit_ime_to_blitz, winit_key_event_to_blitz, winit_modifiers_to_kbt_modifiers, }; -use crate::event::{BlitzShellEvent, create_waker}; +use crate::event::{BlitzShellProxy, create_waker}; use anyrender::WindowRenderer; use blitz_dom::Document; use blitz_paint::paint_scene; @@ -12,14 +12,15 @@ use blitz_traits::events::{ UiEvent, }; use blitz_traits::shell::Viewport; +use winit::dpi::PhysicalInsets; use winit::keyboard::PhysicalKey; use std::any::Any; use std::sync::Arc; use std::task::Waker; use std::time::Instant; -use winit::event::{ElementState, MouseButton}; -use winit::event_loop::{ActiveEventLoop, EventLoopProxy}; +use winit::event::{ButtonSource, ElementState, MouseButton}; +use winit::event_loop::ActiveEventLoop; use winit::window::{Theme, WindowAttributes, WindowId}; use winit::{event::Modifiers, event::WindowEvent, keyboard::KeyCode, window::Window}; @@ -34,7 +35,7 @@ pub struct WindowConfig { impl WindowConfig { pub fn new(doc: Box, renderer: Rend) -> Self { - Self::with_attributes(doc, renderer, Window::default_attributes()) + Self::with_attributes(doc, renderer, WindowAttributes::default()) } pub fn with_attributes( @@ -56,8 +57,8 @@ pub struct View { pub renderer: Rend, pub waker: Option, - pub event_loop_proxy: EventLoopProxy, - pub window: Arc, + pub proxy: BlitzShellProxy, + pub window: Arc, /// The state of the keyboard modifiers (ctrl, shift, etc). Winit/Tao don't track these for us so we /// need to store them in order to have access to them when processing keypress events @@ -67,6 +68,7 @@ pub struct View { pub mouse_pos: (f32, f32), pub animation_timer: Option, pub is_visible: bool, + pub safe_area_insets: PhysicalInsets, #[cfg(feature = "accessibility")] /// Accessibility adapter for `accesskit`. @@ -76,14 +78,17 @@ pub struct View { impl View { pub fn init( config: WindowConfig, - event_loop: &ActiveEventLoop, - proxy: &EventLoopProxy, + event_loop: &dyn ActiveEventLoop, + proxy: &BlitzShellProxy, ) -> Self { - let winit_window = Arc::from(event_loop.create_window(config.attributes).unwrap()); + let winit_window: Arc = + Arc::from(event_loop.create_window(config.attributes).unwrap()); // Create viewport - let size = winit_window.inner_size(); + // TODO: account for the "safe area" + let size = winit_window.surface_size(); let scale = winit_window.scale_factor() as f32; + let safe_area_insets = winit_window.safe_area(); let theme = winit_window.theme().unwrap_or(Theme::Light); let color_scheme = theme_to_color_scheme(theme); let viewport = Viewport::new(size.width, size.height, scale, color_scheme); @@ -111,15 +116,16 @@ impl View { waker: None, animation_timer: None, keyboard_modifiers: Default::default(), - event_loop_proxy: proxy.clone(), + proxy: proxy.clone(), window: winit_window.clone(), doc, theme_override: None, buttons: MouseEventButtons::None, + safe_area_insets, mouse_pos: Default::default(), is_visible: winit_window.is_visible().unwrap_or(true), #[cfg(feature = "accessibility")] - accessibility: AccessibilityState::new(&winit_window, proxy.clone()), + accessibility: AccessibilityState::new(&*winit_window, proxy.clone()), } } @@ -189,17 +195,20 @@ impl View { // Resume renderer let (width, height) = inner.viewport().window_size; let scale = inner.viewport().scale_f64(); - self.renderer.resume(self.window.clone(), width, height); + self.renderer + .resume(Arc::new(self.window.clone()), width, height); if !self.renderer.is_active() { panic!("Renderer failed to resume"); }; // Render - self.renderer - .render(|scene| paint_scene(scene, &inner, scale, width, height)); + let insets = self.safe_area_insets; + self.renderer.render(|scene| { + paint_scene(scene, &inner, scale, width, height, insets.left, insets.top) + }); // Set waker - self.waker = Some(create_waker(&self.event_loop_proxy, window_id)); + self.waker = Some(create_waker(&self.proxy, window_id)); } pub fn suspend(&mut self) { @@ -243,8 +252,10 @@ impl View { let (width, height) = inner.viewport().window_size; let scale = inner.viewport().scale_f64(); let is_animating = inner.is_animating(); - self.renderer - .render(|scene| paint_scene(scene, &inner, scale, width, height)); + let insets = self.safe_area_insets; + self.renderer.render(|scene| { + paint_scene(scene, &inner, scale, width, height, insets.left, insets.top) + }); drop(inner); @@ -279,7 +290,6 @@ impl View { pub fn handle_winit_event(&mut self, event: WindowEvent) { match event { - // Window lifecycle events WindowEvent::Destroyed => {} WindowEvent::ActivationTokenDone { .. } => {}, WindowEvent::CloseRequested => { @@ -288,8 +298,6 @@ impl View { WindowEvent::RedrawRequested => { self.redraw(); } - - // Window size/position events WindowEvent::Moved(_) => {} WindowEvent::Occluded(is_occluded) => { self.is_visible = !is_occluded; @@ -297,21 +305,23 @@ impl View { self.request_redraw(); } }, - WindowEvent::Resized(physical_size) => { - self.with_viewport(|v| v.window_size = (physical_size.width, physical_size.height)); + WindowEvent::SurfaceResized(physical_size) => { + self.safe_area_insets = self.window.safe_area(); + let insets = self.safe_area_insets; + let width = physical_size.width - insets.left - insets.right; + let height = physical_size.height - insets.top - insets.bottom; + self.with_viewport(|v| v.window_size = (width, height)); + self.request_redraw(); } WindowEvent::ScaleFactorChanged { scale_factor, .. } => { self.with_viewport(|v| v.set_hidpi_scale(scale_factor as f32)); + self.request_redraw(); } - - // Theme events WindowEvent::ThemeChanged(theme) => { let color_scheme = theme_to_color_scheme(self.theme_override.unwrap_or(theme)); let mut inner = self.doc.inner_mut(); inner.viewport_mut().color_scheme = color_scheme; } - - // Text / keyboard events WindowEvent::Ime(ime_event) => { self.doc.handle_ui_event(UiEvent::Ime(winit_ime_to_blitz(ime_event))); self.request_redraw(); @@ -327,7 +337,7 @@ impl View { if event.state.is_pressed() { let ctrl = self.keyboard_modifiers.state().control_key(); - let meta = self.keyboard_modifiers.state().super_key(); + let meta = self.keyboard_modifiers.state().meta_key(); let alt = self.keyboard_modifiers.state().alt_key(); // Ctrl/Super keyboard shortcuts @@ -381,12 +391,9 @@ impl View { self.doc.handle_ui_event(event); } - - - // Mouse/pointer events - WindowEvent::CursorEntered { /*device_id*/.. } => {} - WindowEvent::CursorLeft { /*device_id*/.. } => {} - WindowEvent::CursorMoved { position, .. } => { + WindowEvent::PointerEntered { /*device_id*/.. } => {} + WindowEvent::PointerLeft { /*device_id*/.. } => {} + WindowEvent::PointerMoved { position, .. } => { let winit::dpi::LogicalPosition:: { x, y } = position.to_logical(self.window.scale_factor()); self.mouse_pos = (x, y); let event = UiEvent::MouseMove(BlitzMouseButtonEvent { @@ -398,12 +405,17 @@ impl View { }); self.doc.handle_ui_event(event); } - WindowEvent::MouseInput { button, state, .. } => { + WindowEvent::PointerButton { button, state, .. } => { let button = match button { - MouseButton::Left => MouseEventButton::Main, - MouseButton::Right => MouseEventButton::Secondary, - MouseButton::Middle => MouseEventButton::Auxiliary, + ButtonSource::Mouse(mouse_button) => match mouse_button { + MouseButton::Left => MouseEventButton::Main, + MouseButton::Right => MouseEventButton::Secondary, + MouseButton::Middle => MouseEventButton::Auxiliary, + // TODO: handle other button types + _ => return, + } _ => return, + }; match state { @@ -443,22 +455,16 @@ impl View { self.doc.handle_ui_event(UiEvent::Wheel(event)); } - - // File events - WindowEvent::DroppedFile(_) => {} - WindowEvent::HoveredFile(_) => {} - WindowEvent::HoveredFileCancelled => {} WindowEvent::Focused(_) => {} - - // Touch and motion events - // Todo implement touch scrolling - WindowEvent::Touch(_) => {} WindowEvent::TouchpadPressure { .. } => {} - WindowEvent::AxisMotion { .. } => {} WindowEvent::PinchGesture { .. } => {}, WindowEvent::PanGesture { .. } => {}, WindowEvent::DoubleTapGesture { .. } => {}, WindowEvent::RotationGesture { .. } => {}, + WindowEvent::DragEntered { .. } => {}, + WindowEvent::DragMoved { .. } => {}, + WindowEvent::DragDropped { .. } => {}, + WindowEvent::DragLeft { .. } => {}, } } } diff --git a/packages/blitz-traits/src/events.rs b/packages/blitz-traits/src/events.rs index e9c174e34..9780a0171 100644 --- a/packages/blitz-traits/src/events.rs +++ b/packages/blitz-traits/src/events.rs @@ -439,7 +439,8 @@ pub enum BlitzImeEvent { /// Notifies when the IME was enabled. /// /// After getting this event you could receive [`Preedit`][Self::Preedit] and - /// [`Commit`][Self::Commit] events. + /// [`Commit`][Self::Commit] events. You should also start performing IME related requests + /// like [`Window::set_ime_cursor_area`]. Enabled, /// Notifies when a new composing text should be set at the cursor position. @@ -448,7 +449,7 @@ pub enum BlitzImeEvent { /// position. When it's `None`, the cursor should be hidden. When `String` is an empty string /// this indicates that preedit was cleared. /// - /// The cursor position is byte-wise indexed. + /// The cursor position is byte-wise indexed, assuming UTF-8. Preedit(String, Option<(usize, usize)>), /// Notifies when text should be inserted into the editor widget. @@ -456,9 +457,25 @@ pub enum BlitzImeEvent { /// Right before this event winit will send empty [`Self::Preedit`] event. Commit(String), + /// Delete text surrounding the cursor or selection. + /// + /// This event does not affect either the pre-edit string. + /// This means that the application must first remove the pre-edit, + /// then execute the deletion, then insert the removed text back. + /// + /// This event assumes text is stored in UTF-8. + DeleteSurrounding { + /// Bytes to remove before the selection + before_bytes: usize, + /// Bytes to remove after the selection + after_bytes: usize, + }, + /// Notifies when the IME was disabled. /// /// After receiving this event you won't get any more [`Preedit`][Self::Preedit] or - /// [`Commit`][Self::Commit] events until the next [`Enabled`][Self::Enabled] event. + /// [`Commit`][Self::Commit] events until the next [`Enabled`][Self::Enabled] event. You should + /// also stop issuing IME related requests like [`Window::set_ime_cursor_area`] and clear + /// pending preedit text. Disabled, } diff --git a/packages/blitz/src/lib.rs b/packages/blitz/src/lib.rs index 66e085b00..0f89192d5 100644 --- a/packages/blitz/src/lib.rs +++ b/packages/blitz/src/lib.rs @@ -17,7 +17,7 @@ use anyrender_vello::VelloWindowRenderer as WindowRenderer; use blitz_dom::DocumentConfig; use blitz_html::HtmlDocument; use blitz_shell::{ - BlitzApplication, BlitzShellEvent, Config, EventLoop, WindowConfig, create_default_event_loop, + BlitzApplication, BlitzShellProxy, Config, EventLoop, WindowConfig, create_default_event_loop, }; use blitz_traits::net::NetProvider; @@ -55,8 +55,10 @@ pub fn launch_url(url: &str) { .unwrap(); let _guard = rt.enter(); - let event_loop = create_default_event_loop::(); - let net_provider = create_net_provider(&event_loop); + let event_loop = create_default_event_loop(); + let (proxy, reciever) = BlitzShellProxy::new(event_loop.create_proxy()); + let net_provider = create_net_provider(proxy.clone()); + let application = BlitzApplication::new(proxy, reciever); let (url, bytes) = rt .block_on(net_provider.fetch_async(blitz_traits::net::Request::get(url))) @@ -70,6 +72,7 @@ pub fn launch_url(url: &str) { base_url: Some(url), }, event_loop, + application, net_provider, ) } @@ -88,16 +91,19 @@ pub fn launch_static_html_cfg(html: &str, cfg: Config) { #[cfg(feature = "net")] let _guard = rt.enter(); - let event_loop = create_default_event_loop::(); - let net_provider = create_net_provider(&event_loop); + let event_loop = create_default_event_loop(); + let (proxy, reciever) = BlitzShellProxy::new(event_loop.create_proxy()); + let net_provider = create_net_provider(proxy.clone()); + let application = BlitzApplication::new(proxy, reciever); - launch_internal(html, cfg, event_loop, net_provider) + launch_internal(html, cfg, event_loop, application, net_provider) } fn launch_internal( html: &str, cfg: Config, - event_loop: EventLoop, + event_loop: EventLoop, + mut application: BlitzApplication, net_provider: Arc, ) { let doc = HtmlDocument::from_html( @@ -113,11 +119,11 @@ fn launch_internal( let window = WindowConfig::new(Box::new(doc) as _, renderer); // Create application - let mut application = BlitzApplication::new(event_loop.create_proxy()); + application.add_window(window); // Run event loop - event_loop.run_app(&mut application).unwrap() + event_loop.run_app(application).unwrap() } #[cfg(feature = "net")] @@ -125,15 +131,9 @@ type EnabledNetProvider = blitz_net::Provider; #[cfg(not(feature = "net"))] type EnabledNetProvider = blitz_traits::net::DummyNetProvider; -fn create_net_provider( - event_loop: &blitz_shell::EventLoop, -) -> Arc { +fn create_net_provider(proxy: BlitzShellProxy) -> Arc { #[cfg(feature = "net")] - let net_provider = { - let proxy = event_loop.create_proxy(); - let waker = blitz_shell::BlitzShellNetWaker::shared(proxy); - Arc::new(blitz_net::Provider::new(Some(waker))) - }; + let net_provider = Arc::new(blitz_net::Provider::new(Some(Arc::new(proxy)))); #[cfg(not(feature = "net"))] let net_provider = { use blitz_traits::net::DummyNetProvider; diff --git a/packages/dioxus-native/src/assets.rs b/packages/dioxus-native/src/assets.rs index 3332c5063..90fbd95a1 100644 --- a/packages/dioxus-native/src/assets.rs +++ b/packages/dioxus-native/src/assets.rs @@ -1,9 +1,7 @@ -use blitz_shell::BlitzShellNetWaker; +use blitz_shell::BlitzShellProxy; use std::sync::Arc; -use blitz_shell::BlitzShellEvent; use blitz_traits::net::{NetHandler, NetProvider, Request}; -use winit::event_loop::EventLoopProxy; pub struct DioxusNativeNetProvider { inner_net_provider: Option>, @@ -11,12 +9,13 @@ pub struct DioxusNativeNetProvider { #[allow(unused)] impl DioxusNativeNetProvider { - pub fn shared(proxy: EventLoopProxy) -> Arc { + pub fn shared(proxy: BlitzShellProxy) -> Arc { Arc::new(Self::new(proxy)) as Arc } - pub fn new(proxy: EventLoopProxy) -> Self { - let net_waker = Some(BlitzShellNetWaker::shared(proxy)); + pub fn new(proxy: BlitzShellProxy) -> Self { + #[cfg(any(feature = "data-uri", feature = "net"))] + let net_waker = Some(Arc::new(proxy) as _); #[cfg(feature = "net")] let inner_net_provider = Some(blitz_net::Provider::shared(net_waker.clone())); @@ -28,7 +27,7 @@ impl DioxusNativeNetProvider { Self { inner_net_provider } } - pub fn with_inner(proxy: EventLoopProxy, inner: Arc) -> Self { + pub fn with_inner(proxy: BlitzShellProxy, inner: Arc) -> Self { Self { inner_net_provider: Some(inner), } diff --git a/packages/dioxus-native/src/contexts.rs b/packages/dioxus-native/src/contexts.rs index 0cc6c5ab3..114186db9 100644 --- a/packages/dioxus-native/src/contexts.rs +++ b/packages/dioxus-native/src/contexts.rs @@ -1,16 +1,16 @@ -use blitz_shell::BlitzShellEvent; +use blitz_shell::{BlitzShellEvent, BlitzShellProxy}; use dioxus_document::{Document, NoOpDocument}; -use winit::{event_loop::EventLoopProxy, window::WindowId}; +use winit::window::WindowId; use crate::DioxusNativeEvent; pub struct DioxusNativeDocument { - pub(crate) proxy: EventLoopProxy, + pub(crate) proxy: BlitzShellProxy, pub(crate) window: WindowId, } impl DioxusNativeDocument { - pub(crate) fn new(proxy: EventLoopProxy, window: WindowId) -> Self { + pub(crate) fn new(proxy: BlitzShellProxy, window: WindowId) -> Self { Self { proxy, window } } } @@ -27,7 +27,7 @@ impl Document for DioxusNativeDocument { contents: Option, ) { let window = self.window; - _ = self.proxy.send_event(BlitzShellEvent::embedder_event( + self.proxy.send_event(BlitzShellEvent::embedder_event( DioxusNativeEvent::CreateHeadElement { name: name.to_string(), attributes: attributes diff --git a/packages/dioxus-native/src/dioxus_application.rs b/packages/dioxus-native/src/dioxus_application.rs index 4622b30a5..cb4617802 100644 --- a/packages/dioxus-native/src/dioxus_application.rs +++ b/packages/dioxus-native/src/dioxus_application.rs @@ -1,12 +1,16 @@ -use blitz_shell::{BlitzApplication, View}; +use blitz_shell::{BlitzApplication, BlitzShellProxy, View}; use dioxus_core::{provide_context, ScopeId}; use dioxus_history::{History, MemoryHistory}; use std::rc::Rc; +use std::sync::Arc; use winit::application::ApplicationHandler; use winit::event::{StartCause, WindowEvent}; -use winit::event_loop::{ActiveEventLoop, EventLoopProxy}; +use winit::event_loop::ActiveEventLoop; use winit::window::WindowId; +#[cfg(target_os = "macos")] +use winit::platform::macos::ApplicationHandlerExtMacOS; + use crate::DioxusNativeWindowRenderer; use crate::{contexts::DioxusNativeDocument, BlitzShellEvent, DioxusDocument, WindowConfig}; @@ -30,18 +34,17 @@ pub enum DioxusNativeEvent { pub struct DioxusNativeApplication { pending_window: Option>, inner: BlitzApplication, - proxy: EventLoopProxy, } impl DioxusNativeApplication { pub fn new( - proxy: EventLoopProxy, + proxy: BlitzShellProxy, + event_queue: std::sync::mpsc::Receiver, config: WindowConfig, ) -> Self { Self { pending_window: Some(config), - inner: BlitzApplication::new(proxy.clone()), - proxy, + inner: BlitzApplication::new(proxy, event_queue), } } @@ -49,9 +52,9 @@ impl DioxusNativeApplication { self.inner.add_window(window_config); } - fn handle_blitz_shell_event( + fn handle_dioxus_native_event( &mut self, - event_loop: &ActiveEventLoop, + event_loop: &dyn ActiveEventLoop, event: &DioxusNativeEvent, ) { match event { @@ -105,20 +108,40 @@ impl DioxusNativeApplication { } } -impl ApplicationHandler for DioxusNativeApplication { - fn resumed(&mut self, event_loop: &ActiveEventLoop) { +impl ApplicationHandler for DioxusNativeApplication { + #[cfg(target_os = "macos")] + fn macos_handler(&mut self) -> Option<&mut dyn ApplicationHandlerExtMacOS> { + self.inner.macos_handler() + } + + fn resumed(&mut self, event_loop: &dyn ActiveEventLoop) { + self.inner.resumed(event_loop); + } + + fn suspended(&mut self, event_loop: &dyn ActiveEventLoop) { + self.inner.suspended(event_loop); + } + + fn destroy_surfaces(&mut self, event_loop: &dyn ActiveEventLoop) { + self.inner.destroy_surfaces(event_loop); + } + + fn can_create_surfaces(&mut self, event_loop: &dyn ActiveEventLoop) { #[cfg(feature = "tracing")] tracing::debug!("Injecting document provider into all windows"); if let Some(config) = self.pending_window.take() { - let mut window = View::init(config, event_loop, &self.proxy); + let mut window = View::init(config, event_loop, &self.inner.proxy); + let winit_window = Arc::clone(&window.window); let renderer = window.renderer.clone(); let window_id = window.window_id(); let doc = window.downcast_doc_mut::(); doc.vdom.in_scope(ScopeId::ROOT, || { - let shared: Rc = - Rc::new(DioxusNativeDocument::new(self.proxy.clone(), window_id)); + let shared: Rc = Rc::new(DioxusNativeDocument::new( + self.inner.proxy.clone(), + window_id, + )); provide_context(shared); }); @@ -136,6 +159,10 @@ impl ApplicationHandler for DioxusNativeApplication { doc.vdom .in_scope(ScopeId::ROOT, move || provide_context(renderer)); + // Add winit window + doc.vdom + .in_scope(ScopeId::ROOT, move || provide_context(winit_window)); + // Queue rebuild doc.initial_build(); @@ -146,34 +173,32 @@ impl ApplicationHandler for DioxusNativeApplication { self.inner.windows.insert(window_id, window); } - self.inner.resumed(event_loop); + self.inner.can_create_surfaces(event_loop); } - fn suspended(&mut self, event_loop: &ActiveEventLoop) { - self.inner.suspended(event_loop); - } - - fn new_events(&mut self, event_loop: &ActiveEventLoop, cause: StartCause) { + fn new_events(&mut self, event_loop: &dyn ActiveEventLoop, cause: StartCause) { self.inner.new_events(event_loop, cause); } fn window_event( &mut self, - event_loop: &ActiveEventLoop, + event_loop: &dyn ActiveEventLoop, window_id: WindowId, event: WindowEvent, ) { self.inner.window_event(event_loop, window_id, event); } - fn user_event(&mut self, event_loop: &ActiveEventLoop, event: BlitzShellEvent) { - match event { - BlitzShellEvent::Embedder(event) => { - if let Some(event) = event.downcast_ref::() { - self.handle_blitz_shell_event(event_loop, event); + fn proxy_wake_up(&mut self, event_loop: &dyn ActiveEventLoop) { + while let Ok(event) = self.inner.event_queue.try_recv() { + match event { + BlitzShellEvent::Embedder(event) => { + if let Some(event) = event.downcast_ref::() { + self.handle_dioxus_native_event(event_loop, event); + } } + event => self.inner.handle_blitz_shell_event(event_loop, event), } - event => self.inner.user_event(event_loop, event), } } } diff --git a/packages/dioxus-native/src/lib.rs b/packages/dioxus-native/src/lib.rs index cc966a617..386379915 100644 --- a/packages/dioxus-native/src/lib.rs +++ b/packages/dioxus-native/src/lib.rs @@ -58,12 +58,30 @@ pub use { dioxus_renderer::{use_wgpu, Features, Limits}, }; -use blitz_shell::{create_default_event_loop, BlitzShellEvent, Config, WindowConfig}; -use dioxus_core::{ComponentFunction, Element, VirtualDom}; +use blitz_shell::{ + create_default_event_loop, BlitzShellEvent, BlitzShellProxy, Config, WindowConfig, +}; +use dioxus_core::{consume_context, use_hook, ComponentFunction, Element, VirtualDom}; use link_handler::DioxusNativeNavigationProvider; use std::any::Any; use std::sync::Arc; -use winit::window::WindowAttributes; +use winit::{ + raw_window_handle::{HasWindowHandle as _, RawWindowHandle}, + window::{Window, WindowAttributes}, +}; + +pub fn use_window() -> Arc { + use_hook(consume_context::>) +} + +pub fn use_raw_window_handle() -> RawWindowHandle { + use_hook(|| { + consume_context::>() + .window_handle() + .unwrap() + .as_raw() + }) +} /// Launch an interactive HTML/CSS renderer driven by the Dioxus virtualdom pub fn launch(app: fn() -> Element) { @@ -130,7 +148,9 @@ pub fn launch_cfg_with_props( let _ = cfg; } - let event_loop = create_default_event_loop::(); + let event_loop = create_default_event_loop(); + let winit_proxy = event_loop.create_proxy(); + let (proxy, event_queue) = BlitzShellProxy::new(winit_proxy); // Turn on the runtime and enter it #[cfg(feature = "net")] @@ -144,10 +164,10 @@ pub fn launch_cfg_with_props( // Setup hot-reloading if enabled. #[cfg(all(feature = "hot-reload", debug_assertions))] { - let proxy = event_loop.create_proxy(); + let proxy = proxy.clone(); dioxus_devtools::connect(move |event| { let dxn_event = DioxusNativeEvent::DevserverEvent(event); - let _ = proxy.send_event(BlitzShellEvent::embedder_event(dxn_event)); + proxy.send_event(BlitzShellEvent::embedder_event(dxn_event)); }) } @@ -163,22 +183,18 @@ pub fn launch_cfg_with_props( #[cfg(feature = "net")] let net_provider = { - use blitz_shell::BlitzShellNetWaker; - - let proxy = event_loop.create_proxy(); - let net_waker = Some(BlitzShellNetWaker::shared(proxy.clone())); - - let inner_net_provider = Arc::new(blitz_net::Provider::new(net_waker.clone())); + let net_waker = Some(Arc::new(proxy.clone()) as _); + let inner_net_provider = Arc::new(blitz_net::Provider::new(net_waker)); vdom.provide_root_context(Arc::clone(&inner_net_provider)); Arc::new(DioxusNativeNetProvider::with_inner( - proxy, + proxy.clone(), inner_net_provider as _, )) as Arc }; #[cfg(not(feature = "net"))] - let net_provider = DioxusNativeNetProvider::shared(event_loop.create_proxy()); + let net_provider = DioxusNativeNetProvider::shared(proxy.clone()); vdom.provide_root_context(Arc::clone(&net_provider)); @@ -226,8 +242,8 @@ pub fn launch_cfg_with_props( ); // Create application - let mut application = DioxusNativeApplication::new(event_loop.create_proxy(), config); + let application = DioxusNativeApplication::new(proxy, event_queue, config); // Run event loop - event_loop.run_app(&mut application).unwrap(); + event_loop.run_app(application).unwrap(); } diff --git a/wpt/runner/src/test_runners/ref_test.rs b/wpt/runner/src/test_runners/ref_test.rs index 8a09b2d4d..1154b7519 100644 --- a/wpt/runner/src/test_runners/ref_test.rs +++ b/wpt/runner/src/test_runners/ref_test.rs @@ -118,7 +118,7 @@ fn render_html_to_buffer( ctx.renderer.render_to_vec( |scene| { scene.reset(); - paint_scene(scene, document.as_ref(), SCALE, WIDTH, HEIGHT); + paint_scene(scene, document.as_ref(), SCALE, WIDTH, HEIGHT, 0, 0); }, buf, );