diff --git a/Cargo.lock b/Cargo.lock index f9b0337..1b7d383 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 4 [[package]] name = "accesskit" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c0690ad6e6f9597b8439bd3c95e8c6df5cd043afd950c6d68f3b37df641e27c" +checksum = "cf203f9d3bd8f29f98833d1fbef628df18f759248a547e7e01cfbf63cda36a99" [[package]] name = "accesskit_android" @@ -27,7 +27,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec27574c1baeb7747c802a194566b46b602461e81dc4957949580ea8da695038" dependencies = [ "accesskit", - "hashbrown", + "hashbrown 0.15.5", ] [[package]] @@ -147,8 +147,9 @@ checksum = "170433209e817da6aae2c51aa0dd443009a613425dd041ebfb2492d1c4c11a25" [[package]] name = "anymore" -version = "0.1.0" -source = "git+https://github.com/linebender/anymore?rev=3537bdc3aa03c92e380f106d18b7957b934c9eb5#3537bdc3aa03c92e380f106d18b7957b934c9eb5" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a38750a2a9617d9f1a1428b408fb909f7256a2766c59b0b07993170959731bb" [[package]] name = "arrayvec" @@ -194,11 +195,11 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.8.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -215,18 +216,18 @@ checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytemuck" -version = "1.23.0" +version = "1.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9134a6ef01ce4b366b50689c94f82c14bc72bc5d0386829828a2e2752ef7958c" +checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.8.1" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a" +checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" dependencies = [ "proc-macro2", "quote", @@ -259,19 +260,20 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "codespan-reporting" -version = "0.11.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81" dependencies = [ + "serde", "termcolor", "unicode-width", ] [[package]] name = "color" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "010263546cea9f9f8385a5b7aad534b9e6448e62a0d3bf9da29d583308dd11bb" +checksum = "a18ef4657441fb193b65f34dc39b3781f0dfec23d3bd94d0eeb4e88cde421edb" [[package]] name = "combine" @@ -285,9 +287,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.4" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" dependencies = [ "core-foundation-sys", "libc", @@ -301,15 +303,24 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "core-graphics-types" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.10.0", "core-foundation", "libc", ] +[[package]] +name = "core_maths" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30" +dependencies = [ + "libm", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -319,17 +330,23 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + [[package]] name = "cursor-icon" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" [[package]] name = "deranged" -version = "0.4.0" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" dependencies = [ "powerfmt", ] @@ -419,6 +436,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "font-types" version = "0.9.0" @@ -428,21 +451,31 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "font-types" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "511e2c18a516c666d27867d2f9821f76e7d591f762e9fc41dd6cc5c90fe54b0b" +dependencies = [ + "bytemuck", +] + [[package]] name = "fontique" -version = "0.5.0" -source = "git+https://github.com/linebender/parley?rev=587b7634ae8601c10de7f0361bfd56085a5b7b4e#587b7634ae8601c10de7f0361bfd56085a5b7b4e" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff3336bc0b87fe42305047263fa60d2eabd650d29cbe62fdeb2a66c7a0a595f9" dependencies = [ "bytemuck", - "hashbrown", - "icu_locid", + "hashbrown 0.15.5", + "icu_locale_core", + "linebender_resource_handle", "memmap2", "objc2", "objc2-core-foundation", "objc2-core-text", "objc2-foundation", - "peniko", - "read-fonts", + "read-fonts 0.35.0", "roxmltree", "smallvec", "windows", @@ -532,7 +565,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", "gpu-alloc-types", ] @@ -542,7 +575,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", ] [[package]] @@ -559,13 +592,13 @@ dependencies = [ [[package]] name = "gpu-descriptor" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf29e94d6d243368b7a56caa16bc213e4f9f8ed38c4d9557069527b5d5281ca" +checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", "gpu-descriptor-types", - "hashbrown", + "hashbrown 0.15.5", ] [[package]] @@ -574,7 +607,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", ] [[package]] @@ -587,22 +620,52 @@ dependencies = [ "svg_fmt", ] +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", +] + +[[package]] +name = "harfrust" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c020db12c71d8a12a3fe7607873cade3a01a6287e29d540c8723276221b9d8" +dependencies = [ + "bitflags 2.10.0", + "bytemuck", + "core_maths", + "read-fonts 0.35.0", + "smallvec", +] + [[package]] name = "hashbrown" -version = "0.15.3" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ "allocator-api2", "equivalent", - "foldhash", + "foldhash 0.1.4", ] [[package]] -name = "heck" -version = "0.5.0" +name = "hashbrown" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] [[package]] name = "hexf-parse" @@ -611,13 +674,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" [[package]] -name = "icu_locid" -version = "1.5.0" +name = "icu_locale_core" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" dependencies = [ "displaydoc", "litemap", + "serde", "tinystr", "writeable", ] @@ -629,7 +693,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.5", ] [[package]] @@ -676,8 +740,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6e0f18953c66af118a70064505bd3780a226d65b06553b7293fb8933067967" dependencies = [ - "bitflags 2.8.0", - "serde", + "bitflags 2.10.0", ] [[package]] @@ -699,11 +762,12 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" [[package]] name = "kurbo" -version = "0.11.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1077d333efea6170d9ccb96d3c3026f300ca0773da4938cc4c811daa6df68b0c" +checksum = "ce9729cc38c18d86123ab736fd2e7151763ba226ac2490ec092d1dd148825e32" dependencies = [ "arrayvec", + "euclid", "smallvec", ] @@ -729,11 +793,23 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + [[package]] name = "litemap" -version = "0.7.5" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" [[package]] name = "litrs" @@ -769,10 +845,9 @@ dependencies = [ [[package]] name = "masonry" version = "0.3.0" -source = "git+https://github.com/linebender/xilem#e14ba3a5f9461b403cb30d95826187fba7f6924b" +source = "git+https://github.com/linebender/xilem?rev=de88321#de88321783e963cf4257e9b5cf9522106a8ac138" dependencies = [ "accesskit", - "cursor-icon", "dpi", "masonry_core", "parley", @@ -795,7 +870,7 @@ dependencies = [ [[package]] name = "masonry_core" version = "0.3.0" -source = "git+https://github.com/linebender/xilem#e14ba3a5f9461b403cb30d95826187fba7f6924b" +source = "git+https://github.com/linebender/xilem?rev=de88321#de88321783e963cf4257e9b5cf9522106a8ac138" dependencies = [ "accesskit", "anymap3", @@ -806,6 +881,7 @@ dependencies = [ "smallvec", "time", "tracing", + "tracing-core", "tracing-subscriber", "tracing_android_trace", "tree_arena", @@ -816,11 +892,11 @@ dependencies = [ [[package]] name = "matchers" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" dependencies = [ - "regex-automata 0.1.10", + "regex-automata", ] [[package]] @@ -831,20 +907,20 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memmap2" -version = "0.9.5" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3f7eed9d3848f8b98834af67102b720745c4ec028fcd0aa0239277e7de374f" +checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490" dependencies = [ "libc", ] [[package]] name = "metal" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e" +checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", "block", "core-graphics-types", "foreign-types", @@ -865,24 +941,28 @@ dependencies = [ [[package]] name = "naga" -version = "24.0.0" +version = "26.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e380993072e52eef724eddfcde0ed013b0c023c3f0417336ed041aa9f076994e" +checksum = "916cbc7cb27db60be930a4e2da243cf4bc39569195f22fd8ee419cd31d5b662c" dependencies = [ "arrayvec", "bit-set", - "bitflags 2.8.0", + "bitflags 2.10.0", + "cfg-if", "cfg_aliases", "codespan-reporting", + "half", + "hashbrown 0.15.5", "hexf-parse", "indexmap", + "libm", "log", + "num-traits", + "once_cell", "rustc-hash", "spirv", - "strum", - "termcolor", "thiserror 2.0.12", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -891,24 +971,15 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", "jni-sys", "log", - "ndk-sys 0.6.0+11769913", + "ndk-sys", "num_enum", "raw-window-handle", "thiserror 1.0.69", ] -[[package]] -name = "ndk-sys" -version = "0.5.0+25.2.9519653" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" -dependencies = [ - "jni-sys", -] - [[package]] name = "ndk-sys" version = "0.6.0+11769913" @@ -920,12 +991,11 @@ dependencies = [ [[package]] name = "nu-ansi-term" -version = "0.46.0" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "overload", - "winapi", + "windows-sys 0.59.0", ] [[package]] @@ -941,6 +1011,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -975,9 +1046,9 @@ dependencies = [ [[package]] name = "objc2" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88c6597e14493ab2e44ce58f2fdecf095a51f12ca57bec060a11c57332520551" +checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05" dependencies = [ "objc2-encode", ] @@ -988,7 +1059,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", ] [[package]] @@ -997,7 +1068,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ba833d4a1cb1aac330f8c973fd92b6ff1858e4aef5cdd00a255eefb28022fb5" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", "objc2-core-foundation", ] @@ -1013,7 +1084,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "900831247d2fe1a09a683278e5384cfb8c80c79fe6b166f9d14bfdde0ea1b03c" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", "objc2", ] @@ -1032,12 +1103,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "parking_lot" version = "0.12.3" @@ -1063,14 +1128,16 @@ dependencies = [ [[package]] name = "parley" -version = "0.5.0" -source = "git+https://github.com/linebender/parley?rev=587b7634ae8601c10de7f0361bfd56085a5b7b4e#587b7634ae8601c10de7f0361bfd56085a5b7b4e" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26746861bb76dbc9bcd5ed1b0b55d2fedf291100961251702a031ab2abd2ce52" dependencies = [ "accesskit", "fontique", - "hashbrown", - "peniko", - "skrifa", + "harfrust", + "hashbrown 0.15.5", + "linebender_resource_handle", + "skrifa 0.37.0", "swash", ] @@ -1082,12 +1149,13 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "peniko" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f9529efd019889b2a205193c14ffb6e2839b54ed9d2720674f10f4b04d87ac9" +checksum = "b3c76095c9a636173600478e0373218c7b955335048c2bcd12dc6a79657649d8" dependencies = [ "color", "kurbo", + "linebender_resource_handle", "smallvec", ] @@ -1122,6 +1190,21 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -1200,7 +1283,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04ca636dac446b5664bd16c069c00a9621806895b8bb02c2dc68542b23b8f25d" dependencies = [ "bytemuck", - "font-types", + "font-types 0.9.0", +] + +[[package]] +name = "read-fonts" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6717cf23b488adf64b9d711329542ba34de147df262370221940dfabc2c91358" +dependencies = [ + "bytemuck", + "core_maths", + "font-types 0.10.0", ] [[package]] @@ -1209,7 +1303,7 @@ version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", ] [[package]] @@ -1220,17 +1314,8 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -1241,15 +1326,9 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.5" @@ -1303,18 +1382,28 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -1343,7 +1432,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbeb4ca4399663735553a09dd17ce7e49a0a0203f03b706b39628c4d913a8607" dependencies = [ "bytemuck", - "read-fonts", + "read-fonts 0.29.3", +] + +[[package]] +name = "skrifa" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c31071dedf532758ecf3fed987cdb4bd9509f900e026ab684b4ecb81ea49841" +dependencies = [ + "bytemuck", + "read-fonts 0.35.0", ] [[package]] @@ -1357,9 +1456,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.15.0" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "spirv" @@ -1367,7 +1466,7 @@ version = "0.3.0+sdk-1.3.268.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", ] [[package]] @@ -1376,28 +1475,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "strum" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - [[package]] name = "svg_fmt" version = "0.4.4" @@ -1406,11 +1483,11 @@ checksum = "ce5d813d71d82c4cbc1742135004e4a79fd870214c155443451c139c9470a0aa" [[package]] name = "swash" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f745de914febc7c9ab4388dfaf94bbc87e69f57bb41133a9b0c84d4be49856f3" +checksum = "47846491253e976bdd07d0f9cc24b7daf24720d11309302ccbbc6e6b6e53550a" dependencies = [ - "skrifa", + "skrifa 0.31.3", "yazi", "zeno", ] @@ -1487,9 +1564,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.41" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" dependencies = [ "deranged", "itoa", @@ -1502,15 +1579,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" [[package]] name = "time-macros" -version = "0.2.22" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" dependencies = [ "num-conv", "time-core", @@ -1518,11 +1595,13 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.6" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" dependencies = [ "displaydoc", + "serde_core", + "zerovec", ] [[package]] @@ -1588,14 +1667,14 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" dependencies = [ "matchers", "nu-ansi-term", "once_cell", - "regex", + "regex-automata", "sharded-slab", "smallvec", "thread_local", @@ -1622,19 +1701,20 @@ dependencies = [ [[package]] name = "tree_arena" version = "0.1.0" -source = "git+https://github.com/linebender/xilem#e14ba3a5f9461b403cb30d95826187fba7f6924b" +source = "git+https://github.com/linebender/xilem?rev=de88321#de88321783e963cf4257e9b5cf9522106a8ac138" dependencies = [ - "hashbrown", + "hashbrown 0.16.0", ] [[package]] name = "ui-events" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4c2cc34489c685d4e7a1a1f97b7b4416c5aa789892114ae77df6cd2a60f0ec4" +checksum = "8a57da61c5700db75d28822c56068295055ec216996560af57a5d4a457914d34" dependencies = [ "dpi", "keyboard-types", + "kurbo", ] [[package]] @@ -1649,12 +1729,6 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - [[package]] name = "valuable" version = "0.1.1" @@ -1663,16 +1737,16 @@ checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "vello" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df026e62e8b0d12d55ff5e91ae9114a20f82d9b856bedfdbf3abd5d1472dceed" +checksum = "71acbd6b5f7f19841425845c113a89a54bbf60556ae39e7d0182a6f80ce37f5b" dependencies = [ "bytemuck", "futures-intrusive", "log", "peniko", "png", - "skrifa", + "skrifa 0.37.0", "static_assertions", "thiserror 2.0.12", "vello_encoding", @@ -1682,24 +1756,25 @@ dependencies = [ [[package]] name = "vello_encoding" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5702642f6ea77eedc12d119e1eebead0dba3cf91fe5c5d1f3efc12bf0cfaf1" +checksum = "cfd5e0b9fec91df34a09fbcbbed474cec68d05691b590a911c7af83c4860ae42" dependencies = [ "bytemuck", "guillotiere", "peniko", - "skrifa", + "skrifa 0.37.0", "smallvec", ] [[package]] name = "vello_shaders" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "381790a3779021edd9f88267c1b13b49546cb0fb164f329ee2f2587869ddf459" +checksum = "8c381dde4e7d0d7957df0c0e3f8a7cc0976762d3972d97da5c71464e57ffefd3" dependencies = [ "bytemuck", + "log", "naga", "thiserror 2.0.12", "vello_encoding", @@ -1814,18 +1889,21 @@ dependencies = [ [[package]] name = "wgpu" -version = "24.0.3" +version = "26.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35904fb00ba2d2e0a4d002fcbbb6e1b89b574d272a50e5fc95f6e81cf281c245" +checksum = "70b6ff82bbf6e9206828e1a3178e851f8c20f1c9028e74dd3a8090741ccd5798" dependencies = [ "arrayvec", - "bitflags 2.8.0", + "bitflags 2.10.0", + "cfg-if", "cfg_aliases", "document-features", + "hashbrown 0.15.5", "js-sys", "log", "naga", "parking_lot", + "portable-atomic", "profiling", "raw-window-handle", "smallvec", @@ -1840,42 +1918,76 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "24.0.2" +version = "26.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671c25545d479b47d3f0a8e373aceb2060b67c6eb841b24ac8c32348151c7a0c" +checksum = "d5f62f1053bd28c2268f42916f31588f81f64796e2ff91b81293515017ca8bd9" dependencies = [ "arrayvec", + "bit-set", "bit-vec", - "bitflags 2.8.0", + "bitflags 2.10.0", "cfg_aliases", "document-features", + "hashbrown 0.15.5", "indexmap", "log", "naga", "once_cell", "parking_lot", + "portable-atomic", "profiling", "raw-window-handle", "rustc-hash", "smallvec", "thiserror 2.0.12", + "wgpu-core-deps-apple", + "wgpu-core-deps-emscripten", + "wgpu-core-deps-windows-linux-android", "wgpu-hal", "wgpu-types", ] +[[package]] +name = "wgpu-core-deps-apple" +version = "26.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18ae5fbde6a4cbebae38358aa73fcd6e0f15c6144b67ef5dc91ded0db125dbdf" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "26.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7670e390f416006f746b4600fdd9136455e3627f5bd763abf9a65daa216dd2d" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "26.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "720a5cb9d12b3d337c15ff0e24d3e97ed11490ff3f7506e7f3d98c68fa5d6f14" +dependencies = [ + "wgpu-hal", +] + [[package]] name = "wgpu-hal" -version = "24.0.4" +version = "26.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f112f464674ca69f3533248508ee30cb84c67cf06c25ff6800685f5e0294e259" +checksum = "a8d0e67224cc7305b3b4eb2cc57ca4c4c3afc665c1d1bee162ea806e19c47bdd" dependencies = [ "android_system_properties", "arrayvec", "ash", "bit-set", - "bitflags 2.8.0", + "bitflags 2.10.0", "block", "bytemuck", + "cfg-if", "cfg_aliases", "core-graphics-types", "glow", @@ -1883,6 +1995,7 @@ dependencies = [ "gpu-alloc", "gpu-allocator", "gpu-descriptor", + "hashbrown 0.15.5", "js-sys", "khronos-egl", "libc", @@ -1890,16 +2003,16 @@ dependencies = [ "log", "metal", "naga", - "ndk-sys 0.5.0+25.2.9519653", + "ndk-sys", "objc", - "once_cell", "ordered-float", "parking_lot", + "portable-atomic", + "portable-atomic-util", "profiling", "range-alloc", "raw-window-handle", "renderdoc-sys", - "rustc-hash", "smallvec", "thiserror 2.0.12", "wasm-bindgen", @@ -1911,32 +2024,18 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "24.0.0" +version = "26.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50ac044c0e76c03a0378e7786ac505d010a873665e2d51383dcff8dd227dc69c" +checksum = "eca7a8d8af57c18f57d393601a1fb159ace8b2328f1b6b5f80893f7d672c9ae2" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", + "bytemuck", "js-sys", "log", + "thiserror 2.0.12", "web-sys", ] -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - [[package]] name = "winapi-util" version = "0.1.9" @@ -1946,12 +2045,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows" version = "0.58.0" @@ -2166,9 +2259,9 @@ dependencies = [ [[package]] name = "writeable" -version = "0.5.5" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" [[package]] name = "xml-rs" @@ -2198,3 +2291,39 @@ name = "zeno" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524" + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "serde", + "zerofrom", +] diff --git a/Cargo.toml b/Cargo.toml index f1ef3a0..7d0f50b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ ndk = "0.9.0" num_enum = "0.7.3" send_wrapper = "0.6.0" smallvec = "1.15.0" -ui-events = "0.1.0" +ui-events = { version = "0.2.0", default-features = false } [profile.dev] panic = "abort" diff --git a/demo/Cargo.toml b/demo/Cargo.toml index fb34ce5..ac8ba46 100644 --- a/demo/Cargo.toml +++ b/demo/Cargo.toml @@ -14,11 +14,11 @@ android-view = { path = ".." } android_logger = "0.15.0" anyhow = "1.0.96" log = "0.4.26" -parley = { git = "https://github.com/linebender/parley", rev = "587b7634ae8601c10de7f0361bfd56085a5b7b4e", features = ["accesskit"] } -peniko = { version = "0.4.0", default-features = false } +parley = { version = "0.6.0", features = ["accesskit"] } +peniko = { version = "0.5.0", default-features = false } pollster = "0.4.0" -ui-events = "0.1.0" -vello = "0.5.0" +ui-events = { version = "0.2.0", default-features = false } +vello = "0.6.0" # Send tracing events to Android GPU inspector, for profiling tracing_android_trace = "0.1.1" diff --git a/demo/src/lib.rs b/demo/src/lib.rs index d34671b..bc116d5 100644 --- a/demo/src/lib.rs +++ b/demo/src/lib.rs @@ -290,7 +290,8 @@ impl DemoViewPeer { // Queue the texture to be presented on the surface. surface_texture.present(); - device_handle.device.poll(wgpu::Maintain::Poll); + // `poll` has a return type for a reason, but not sure what to do with it here. + let _ = device_handle.device.poll(wgpu::PollType::Poll); } fn set_composing_text_internal(&mut self, text: &str, new_cursor_position: jint) { @@ -371,7 +372,7 @@ impl ViewPeer for DemoViewPeer { return false; }; - if matches!(ev, PointerEvent::Up { .. }) { + if matches!(ev, PointerEvent::Up(..)) { ctx.push_static_deferred_callback(show_soft_input); } @@ -437,9 +438,16 @@ impl ViewPeer for DemoViewPeer { width: jint, height: jint, ) { - self.tap_counter = TapCounter::new(ctx.view.view_configuration(&mut ctx.env)); + let android_ctx = ctx.view.context(&mut ctx.env); + let scale_factor = { + let res = android_ctx.resources(&mut ctx.env); + let metrics = res.display_metrics(&mut ctx.env); + metrics.density(&mut ctx.env) as f64 + }; + self.tap_counter = TapCounter::new(ctx.view.view_configuration(&mut ctx.env), scale_factor); let editor = self.editor.editor_mut(); - editor.set_scale(1.0); + #[allow(clippy::cast_possible_truncation, reason = "Unavoidable")] + editor.set_scale(scale_factor as f32); editor.set_width(Some(width as f32 - 2_f32 * text::INSET)); self.last_drawn_generation = Default::default(); let focused = ctx.view.is_focused(&mut ctx.env); diff --git a/demo/src/text.rs b/demo/src/text.rs index 1c68a99..1a4e695 100644 --- a/demo/src/text.rs +++ b/demo/src/text.rs @@ -12,11 +12,11 @@ use parley::{ use std::time::{Duration, Instant}; use ui_events::{ keyboard::{Code, Key, KeyState, KeyboardEvent, NamedKey}, - pointer::{PointerButton, PointerEvent, PointerState, PointerUpdate}, + pointer::{PointerButton, PointerButtonEvent, PointerEvent, PointerState, PointerUpdate}, }; use vello::{ Scene, - kurbo::{Affine, Line, Stroke}, + kurbo::{Affine, Line, Rect, Stroke}, peniko::color::palette, peniko::{Brush, Fill}, }; @@ -148,7 +148,7 @@ impl Editor { pub fn cursor_blink(&mut self) { self.cursor_visible = self.start_time.is_some_and(|start_time| { let elapsed = Instant::now().duration_since(start_time); - (elapsed.as_millis() / self.blink_period.as_millis()) % 2 == 0 + (elapsed.as_millis() / self.blink_period.as_millis()).is_multiple_of(2) }); } @@ -310,7 +310,7 @@ impl Editor { pub fn handle_pointer_event(&mut self, ev: PointerEvent) -> bool { let mut drv = self.editor.driver(&mut self.font_cx, &mut self.layout_cx); match ev { - PointerEvent::Down { + PointerEvent::Down(PointerButtonEvent { button: None | Some(PointerButton::Primary), state: PointerState { @@ -320,7 +320,7 @@ impl Editor { .. }, .. - } => match count { + }) => match count { 2 => drv.select_word_at_point(position.x as f32 - INSET, position.y as f32 - INSET), 3 => drv.select_line_at_point(position.x as f32 - INSET, position.y as f32 - INSET), 1 if modifiers.shift() => drv.extend_selection_to_point( @@ -346,10 +346,10 @@ impl Editor { } pub fn handle_accesskit_action_request(&mut self, req: &accesskit::ActionRequest) { - if req.action == accesskit::Action::SetTextSelection { - if let Some(accesskit::ActionData::SetTextSelection(selection)) = &req.data { - self.driver().select_from_accesskit(selection); - } + if req.action == accesskit::Action::SetTextSelection + && let Some(accesskit::ActionData::SetTextSelection(selection)) = &req.data + { + self.driver().select_from_accesskit(selection); } } @@ -363,25 +363,26 @@ impl Editor { /// Returns drawn `Generation`. pub fn draw(&mut self, scene: &mut Scene) -> Generation { let transform = Affine::translate((INSET as f64, INSET as f64)); - self.editor.selection_geometry_with(|rect, _| { - scene.fill( - Fill::NonZero, - transform, - palette::css::STEEL_BLUE, - None, - &rect, - ); - }); - if self.cursor_visible { - if let Some(cursor) = self.editor.cursor_geometry(5.0) { + self.editor + .selection_geometry_with(|parley::BoundingBox { x0, x1, y0, y1 }, _| { scene.fill( Fill::NonZero, transform, - palette::css::CADET_BLUE, + palette::css::STEEL_BLUE, None, - &cursor, + &Rect { x0, x1, y0, y1 }, ); - } + }); + if self.cursor_visible + && let Some(parley::BoundingBox { x0, x1, y0, y1 }) = self.editor.cursor_geometry(5.0) + { + scene.fill( + Fill::NonZero, + transform, + palette::css::CADET_BLUE, + None, + &Rect { x0, x1, y0, y1 }, + ); } let layout = self.editor.layout(&mut self.font_cx, &mut self.layout_cx); for line in layout.lines() { diff --git a/masonry-demo/Cargo.toml b/masonry-demo/Cargo.toml index 24c07cc..f2e8a63 100644 --- a/masonry-demo/Cargo.toml +++ b/masonry-demo/Cargo.toml @@ -9,7 +9,7 @@ crate-type = ["cdylib"] [dependencies] android-view = { path = ".." } -masonry = { git = "https://github.com/linebender/xilem" } +masonry = { git = "https://github.com/linebender/xilem", rev = "de88321" } masonry_android = { path = "../masonry" } # Send tracing events to Android GPU inspector, for profiling diff --git a/masonry-demo/src/lib.rs b/masonry-demo/src/lib.rs index caaf52a..ffa0d60 100644 --- a/masonry-demo/src/lib.rs +++ b/masonry-demo/src/lib.rs @@ -12,7 +12,7 @@ use android_view::{ }; use masonry::{ core::{ErasedAction, NewWidget, Properties, Widget, WidgetId}, - properties::Padding, + properties::{Padding, types::Length}, theme::default_property_set, widgets::{Button, ButtonPress, Flex, Label, Portal, TextAction, TextArea, TextInput}, }; @@ -20,7 +20,7 @@ use masonry_android::{AppDriver, DriverCtx}; use std::{ffi::c_void, sync::Arc}; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; -const WIDGET_SPACING: f64 = 5.0; +const WIDGET_SPACING: Length = Length::const_px(5.0); struct Driver { next_task: String, @@ -29,7 +29,7 @@ struct Driver { impl AppDriver for Driver { fn on_action(&mut self, ctx: &mut DriverCtx<'_>, _widget_id: WidgetId, action: ErasedAction) { if action.is::() { - ctx.render_root().edit_root_widget(|mut root| { + ctx.render_root().edit_base_layer(|mut root| { let mut portal = root.downcast::>(); let mut flex = Portal::child_mut(&mut portal); Flex::add_child(&mut flex, Label::new(self.next_task.clone()).with_auto_id()); @@ -59,8 +59,8 @@ fn make_widget_tree() -> impl Widget { .with_child(NewWidget::new_with_props( Flex::row() .with_flex_child(TextInput::new("").with_auto_id(), 1.0) - .with_child(Button::new("Add task").with_auto_id()), - Properties::new().with(Padding::all(WIDGET_SPACING)), + .with_child(Button::new(NewWidget::new(Label::new("Add task"))).with_auto_id()), + Properties::new().with(Padding::all(WIDGET_SPACING.get())), )) .with_spacer(WIDGET_SPACING) .with_auto_id(), diff --git a/masonry/Cargo.toml b/masonry/Cargo.toml index 0362ef1..17cba42 100644 --- a/masonry/Cargo.toml +++ b/masonry/Cargo.toml @@ -6,6 +6,6 @@ edition = "2024" [dependencies] accesskit_android = "0.4.0" android-view = { path = ".." } -masonry_core = { git = "https://github.com/linebender/xilem" } +masonry_core = { git = "https://github.com/linebender/xilem", rev = "de88321" } pollster = "0.4.0" tracing = "0.1.40" diff --git a/masonry/src/lib.rs b/masonry/src/lib.rs index 4ffeafb..d211f16 100644 --- a/masonry/src/lib.rs +++ b/masonry/src/lib.rs @@ -116,6 +116,7 @@ impl MasonryState { default_properties, use_system_fonts: true, size_policy: WindowSizePolicy::User, + size: Default::default(), scale_factor, test_font: None, }, @@ -170,6 +171,9 @@ impl MasonryViewPeer { self.app_driver .on_action(&mut driver_ctx, widget_id, action); } + RenderRootSignal::ClipboardStore(..) => { + // TODO + } RenderRootSignal::StartIme => { ctx.push_static_deferred_callback(show_soft_input); } @@ -228,6 +232,15 @@ impl MasonryViewPeer { }; info!("Widget selected in inspector: {widget_id} - {display_name}"); } + RenderRootSignal::NewLayer(..) => { + // TODO + } + RenderRootSignal::RepositionLayer(..) => { + // TODO + } + RenderRootSignal::RemoveLayer(..) => { + // TODO + } } } @@ -243,10 +256,11 @@ impl MasonryViewPeer { let (scene, tree_update) = self.state.render_root.redraw(); - if let Some(events) = self - .state - .accesskit_adapter - .update_if_active(|| tree_update) + if let Some(tree_update) = tree_update + && let Some(events) = self + .state + .accesskit_adapter + .update_if_active(|| tree_update) { ctx.push_dynamic_deferred_callback(move |env, view| { events.raise(env, &view.0); @@ -317,7 +331,8 @@ impl MasonryViewPeer { // Queue the texture to be presented on the surface. surface_texture.present(); - device_handle.device.poll(wgpu::Maintain::Poll); + // `poll` has a return type for a reason, but not sure what to do with it here. + let _ = device_handle.device.poll(wgpu::PollType::Poll); } fn on_key_event<'local>( @@ -347,7 +362,7 @@ impl MasonryViewPeer { if handler.requested_initial_tree { self.state .render_root - .handle_window_event(WindowEvent::RebuildAccessTree); + .handle_window_event(WindowEvent::EnableAccessTree); self.handle_signals(ctx); } result @@ -436,9 +451,10 @@ impl ViewPeer for MasonryViewPeer { width: jint, height: jint, ) { - self.state.tap_counter = TapCounter::new(ctx.view.view_configuration(&mut ctx.env)); let android_ctx = ctx.view.context(&mut ctx.env); let scale_factor = scale_factor(&mut ctx.env, &android_ctx); + self.state.tap_counter = + TapCounter::new(ctx.view.view_configuration(&mut ctx.env), scale_factor); self.state .render_root .handle_window_event(WindowEvent::Rescale(scale_factor)); diff --git a/src/events.rs b/src/events.rs index fc6810b..01b0ff3 100644 --- a/src/events.rs +++ b/src/events.rs @@ -12,7 +12,10 @@ use num_enum::FromPrimitive; use ui_events::{ ScrollDelta, keyboard::{KeyboardEvent, Modifiers}, - pointer::{ContactGeometry, PointerEvent, PointerId, PointerState, PointerUpdate}, + pointer::{ + ContactGeometry, PointerButtonEvent, PointerEvent, PointerGestureEvent, PointerId, + PointerScrollEvent, PointerUpdate, + }, }; use crate::ViewConfiguration; @@ -425,9 +428,11 @@ impl<'local> MotionEvent<'local> { let contact_geometry = if pointer.pointer_type == PointerType::Touch { let height = self.axis(env, Axis::TouchMajor, action_index) as f64; let width = self.axis(env, Axis::TouchMinor, action_index) as f64; - (height > 0.0 && width > 0.0) - .then_some(ContactGeometry { width, height }) - .unwrap_or_default() + if height > 0.0 && width > 0.0 { + ContactGeometry { width, height } + } else { + Default::default() + } } else { Default::default() }; @@ -437,6 +442,8 @@ impl<'local> MotionEvent<'local> { x: self.axis(env, Axis::X, action_index) as f64, y: self.axis(env, Axis::Y, action_index) as f64, }, + // `TapCounter` will attach the scale. + scale_factor: 1.0, buttons, // `TapCounter` will attach an appropriate count. count: 0, @@ -467,16 +474,18 @@ impl<'local> MotionEvent<'local> { }; Some(match action { - MotionAction::Down | MotionAction::PointerDown => PointerEvent::Down { - pointer, - state, - button, - }, - MotionAction::Up | MotionAction::PointerUp => PointerEvent::Up { + MotionAction::Down | MotionAction::PointerDown => { + PointerEvent::Down(PointerButtonEvent { + pointer, + state, + button, + }) + } + MotionAction::Up | MotionAction::PointerUp => PointerEvent::Up(PointerButtonEvent { pointer, state, button, - }, + }), MotionAction::Move | MotionAction::HoverMove => { let hsz = self.history_size(env); let mut coalesced: Vec = vec![state.clone(); hsz as usize]; @@ -492,9 +501,11 @@ impl<'local> MotionEvent<'local> { self.historical_axis(env, Axis::TouchMajor, action_index, pos) as f64; let width = self.historical_axis(env, Axis::TouchMinor, action_index, pos) as f64; - (height > 0.0 && width > 0.0) - .then_some(ContactGeometry { width, height }) - .unwrap_or_default() + if height > 0.0 && width > 0.0 { + ContactGeometry { width, height } + } else { + Default::default() + } } else { Default::default() }; @@ -527,7 +538,7 @@ impl<'local> MotionEvent<'local> { MotionAction::Cancel => PointerEvent::Cancel(pointer), MotionAction::HoverEnter => PointerEvent::Enter(pointer), MotionAction::HoverExit => PointerEvent::Leave(pointer), - MotionAction::Scroll => PointerEvent::Scroll { + MotionAction::Scroll => PointerEvent::Scroll(PointerScrollEvent { pointer, delta: ScrollDelta::PixelDelta(PhysicalPosition:: { x: (self.axis(env, Axis::Hscroll, action_index) @@ -536,7 +547,7 @@ impl<'local> MotionEvent<'local> { * vc.scaled_vertical_scroll_factor) as f64, }), state, - }, + }), _ => { // Other current `MotionAction` values relate to gamepad/joystick buttons; // ui-events doesn't currently have types for these, so consider them unhandled. @@ -606,137 +617,121 @@ struct TapState { pub struct TapCounter { /// The `ViewConfiguration` which configures tap counting. pub vc: ViewConfiguration, + /// The scale factor. + pub scale_factor: f64, /// Recent taps which can be used for tap counting. taps: Vec, } impl TapCounter { /// Make a new `TapCounter` with `ViewConfiguration` from your view. - pub fn new(vc: ViewConfiguration) -> Self { - Self { vc, taps: vec![] } + pub fn new(vc: ViewConfiguration, scale_factor: f64) -> Self { + Self { + vc, + scale_factor, + taps: vec![], + } } /// Enhance a `PointerEvent` with `count`. /// - pub fn attach_count(&mut self, e: PointerEvent) -> PointerEvent { + pub fn attach_count(&mut self, mut e: PointerEvent) -> PointerEvent { match e { - PointerEvent::Down { - button, + PointerEvent::Down(PointerButtonEvent { pointer, - state, - } => { - let e = if let Some(i) = - self.taps.iter().position(|TapState { x, y, up_time, .. }| { - let dx = (x - state.position.x).abs(); - let dy = (y - state.position.y).abs(); - (dx * dx + dy * dy).sqrt() < self.vc.scaled_double_tap_slop as f64 - && (up_time + self.vc.multi_press_timeout.max(400) as u64 * 1000000) - > state.time - }) { - let count = self.taps[i].count + 1; - self.taps[i].count = count; - self.taps[i].pointer_id = pointer.pointer_id; - self.taps[i].down_time = state.time; - self.taps[i].up_time = state.time; - self.taps[i].x = state.position.x; - self.taps[i].y = state.position.y; - - PointerEvent::Down { - button, - pointer, - state: PointerState { count, ..state }, - } + ref mut state, + .. + }) => { + let pointer_id = pointer.pointer_id; + let position = state.position; + let time = state.time; + + let slop = self.vc.scaled_double_tap_slop as f64; + + if let Some(tap) = + self.taps.iter_mut().find(|TapState { x, y, up_time, .. }| { + let dx = (x - position.x).abs(); + let dy = (y - position.y).abs(); + (dx * dx + dy * dy).sqrt() < slop + && (*up_time + self.vc.multi_press_timeout.max(400) as u64 * 1000000) + > time + }) + { + let count = tap.count + 1; + state.count = count; + tap.count = count; + tap.pointer_id = pointer_id; + tap.down_time = time; + tap.up_time = time; + tap.x = position.x; + tap.y = position.y; } else { let s = TapState { - pointer_id: pointer.pointer_id, - down_time: state.time, - up_time: state.time, + pointer_id, + down_time: time, + up_time: time, count: 1, - x: state.position.x, - y: state.position.y, + x: position.x, + y: position.y, }; self.taps.push(s); - PointerEvent::Down { - button, - pointer, - state: PointerState { count: 1, ..state }, - } + state.count = 1; }; - self.clear_expired(state.time); - e + state.scale_factor = self.scale_factor; + self.clear_expired(time); } - PointerEvent::Up { - button, + PointerEvent::Up(PointerButtonEvent { pointer, - ref state, - } => { - if let Some(i) = self + ref mut state, + .. + }) => { + if let Some(tap) = self .taps - .iter() - .position(|TapState { pointer_id, .. }| *pointer_id == pointer.pointer_id) + .iter_mut() + .find(|TapState { pointer_id, .. }| *pointer_id == pointer.pointer_id) { - self.taps[i].up_time = state.time; - PointerEvent::Up { - button, - pointer, - state: PointerState { - count: self.taps[i].count, - ..state.clone() - }, - } - } else { - e.clone() + tap.up_time = state.time; + state.count = tap.count; } + state.scale_factor = self.scale_factor; } PointerEvent::Move(PointerUpdate { pointer, - ref current, - ref coalesced, - ref predicted, + ref mut current, + ref mut coalesced, + ref mut predicted, }) => { - if let Some(TapState { count, .. }) = self - .taps - .iter() - .find( - |TapState { - pointer_id, - down_time, - up_time, - .. - }| { - *pointer_id == pointer.pointer_id && down_time == up_time - }, - ) - .cloned() - { - PointerEvent::Move(PointerUpdate { - pointer, - current: PointerState { - count, - ..current.clone() - }, - coalesced: coalesced - .iter() - .cloned() - .map(|u| PointerState { count, ..u }) - .collect(), - predicted: predicted - .iter() - .cloned() - .map(|u| PointerState { count, ..u }) - .collect(), - }) - } else { - e + current.scale_factor = self.scale_factor; + for u in coalesced.iter_mut().chain(predicted.iter_mut()) { + u.scale_factor = self.scale_factor; + } + if let Some(TapState { count, .. }) = self.taps.iter().find( + |TapState { + pointer_id, + down_time, + up_time, + .. + }| { + *pointer_id == pointer.pointer_id && down_time == up_time + }, + ) { + current.count = *count; + for u in coalesced.iter_mut().chain(predicted.iter_mut()) { + u.count = *count; + } } } + PointerEvent::Scroll(PointerScrollEvent { ref mut state, .. }) + | PointerEvent::Gesture(PointerGestureEvent { ref mut state, .. }) => { + state.scale_factor = self.scale_factor; + } PointerEvent::Cancel(p) | PointerEvent::Leave(p) => { self.taps .retain(|TapState { pointer_id, .. }| *pointer_id != p.pointer_id); - e.clone() } - PointerEvent::Enter(..) | PointerEvent::Scroll { .. } => e.clone(), + PointerEvent::Enter(..) => {} } + e } /// Clear expired taps.