diff --git a/Cargo.lock b/Cargo.lock index f9b0337..2e3fa65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,7 +82,7 @@ dependencies = [ "tracing-subscriber", "tracing_android_trace", "ui-events", - "vello", + "vello 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[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,9 +195,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" dependencies = [ "serde", ] @@ -267,6 +268,17 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "codespan-reporting" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81" +dependencies = [ + "serde", + "termcolor", + "unicode-width", +] + [[package]] name = "color" version = "0.3.0" @@ -319,6 +331,12 @@ 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" @@ -532,7 +550,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "gpu-alloc-types", ] @@ -542,7 +560,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", ] [[package]] @@ -563,7 +581,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf29e94d6d243368b7a56caa16bc213e4f9f8ed38c4d9557069527b5d5281ca" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "gpu-descriptor-types", "hashbrown", ] @@ -574,7 +592,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", ] [[package]] @@ -587,6 +605,17 @@ dependencies = [ "svg_fmt", ] +[[package]] +name = "half" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" +dependencies = [ + "cfg-if", + "crunchy", + "num-traits", +] + [[package]] name = "hashbrown" version = "0.15.3" @@ -676,7 +705,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6e0f18953c66af118a70064505bd3780a226d65b06553b7293fb8933067967" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "serde", ] @@ -729,6 +758,12 @@ 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 = "litemap" version = "0.7.5" @@ -769,16 +804,15 @@ dependencies = [ [[package]] name = "masonry" version = "0.3.0" -source = "git+https://github.com/linebender/xilem#e14ba3a5f9461b403cb30d95826187fba7f6924b" +source = "git+https://github.com/xorgy/xilem?branch=ui-events-0.2.0#e827f6e66950765595a1ce551b0743b65fc7c0d5" dependencies = [ "accesskit", - "cursor-icon", "dpi", "masonry_core", "parley", "tracing", "ui-events", - "vello", + "vello 0.5.0 (git+https://github.com/linebender/vello?rev=2e74f202aed09f273fe7e84234e9b564f99ff9bc)", ] [[package]] @@ -795,7 +829,7 @@ dependencies = [ [[package]] name = "masonry_core" version = "0.3.0" -source = "git+https://github.com/linebender/xilem#e14ba3a5f9461b403cb30d95826187fba7f6924b" +source = "git+https://github.com/xorgy/xilem?branch=ui-events-0.2.0#e827f6e66950765595a1ce551b0743b65fc7c0d5" dependencies = [ "accesskit", "anymap3", @@ -810,7 +844,7 @@ dependencies = [ "tracing_android_trace", "tree_arena", "ui-events", - "vello", + "vello 0.5.0 (git+https://github.com/linebender/vello?rev=2e74f202aed09f273fe7e84234e9b564f99ff9bc)", "web-time", ] @@ -844,7 +878,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "block", "core-graphics-types", "foreign-types", @@ -871,9 +905,9 @@ checksum = "e380993072e52eef724eddfcde0ed013b0c023c3f0417336ed041aa9f076994e" dependencies = [ "arrayvec", "bit-set", - "bitflags 2.8.0", + "bitflags 2.9.1", "cfg_aliases", - "codespan-reporting", + "codespan-reporting 0.11.1", "hexf-parse", "indexmap", "log", @@ -885,13 +919,38 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "naga" +version = "25.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b977c445f26e49757f9aca3631c3b8b836942cb278d69a92e7b80d3b24da632" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags 2.9.1", + "cfg_aliases", + "codespan-reporting 0.12.0", + "half", + "hashbrown", + "hexf-parse", + "indexmap", + "log", + "num-traits", + "once_cell", + "rustc-hash", + "spirv", + "strum", + "thiserror 2.0.12", + "unicode-ident", +] + [[package]] name = "ndk" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "jni-sys", "log", "ndk-sys 0.6.0+11769913", @@ -941,6 +1000,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -988,7 +1048,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", ] [[package]] @@ -997,7 +1057,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ba833d4a1cb1aac330f8c973fd92b6ff1858e4aef5cdd00a255eefb28022fb5" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "objc2-core-foundation", ] @@ -1013,15 +1073,15 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "900831247d2fe1a09a683278e5384cfb8c80c79fe6b166f9d14bfdde0ea1b03c" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "objc2", ] [[package]] name = "once_cell" -version = "1.21.1" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "ordered-float" @@ -1122,6 +1182,12 @@ 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 = "powerfmt" version = "0.2.0" @@ -1209,7 +1275,7 @@ version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", ] [[package]] @@ -1357,9 +1423,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 +1433,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.9.1", ] [[package]] @@ -1622,7 +1688,7 @@ dependencies = [ [[package]] name = "tree_arena" version = "0.1.0" -source = "git+https://github.com/linebender/xilem#e14ba3a5f9461b403cb30d95826187fba7f6924b" +source = "git+https://github.com/xorgy/xilem?branch=ui-events-0.2.0#e827f6e66950765595a1ce551b0743b65fc7c0d5" dependencies = [ "hashbrown", ] @@ -1630,8 +1696,7 @@ dependencies = [ [[package]] name = "ui-events" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4c2cc34489c685d4e7a1a1f97b7b4416c5aa789892114ae77df6cd2a60f0ec4" +source = "git+https://github.com/endoli/ui-events?rev=6382e63#6382e6394a008bc21ef1802e1825b507b4b822f1" dependencies = [ "dpi", "keyboard-types", @@ -1675,9 +1740,27 @@ dependencies = [ "skrifa", "static_assertions", "thiserror 2.0.12", - "vello_encoding", - "vello_shaders", - "wgpu", + "vello_encoding 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "vello_shaders 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wgpu 24.0.3", +] + +[[package]] +name = "vello" +version = "0.5.0" +source = "git+https://github.com/linebender/vello?rev=2e74f202aed09f273fe7e84234e9b564f99ff9bc#2e74f202aed09f273fe7e84234e9b564f99ff9bc" +dependencies = [ + "bytemuck", + "futures-intrusive", + "log", + "peniko", + "png", + "skrifa", + "static_assertions", + "thiserror 2.0.12", + "vello_encoding 0.5.0 (git+https://github.com/linebender/vello?rev=2e74f202aed09f273fe7e84234e9b564f99ff9bc)", + "vello_shaders 0.5.0 (git+https://github.com/linebender/vello?rev=2e74f202aed09f273fe7e84234e9b564f99ff9bc)", + "wgpu 25.0.2", ] [[package]] @@ -1693,6 +1776,18 @@ dependencies = [ "smallvec", ] +[[package]] +name = "vello_encoding" +version = "0.5.0" +source = "git+https://github.com/linebender/vello?rev=2e74f202aed09f273fe7e84234e9b564f99ff9bc#2e74f202aed09f273fe7e84234e9b564f99ff9bc" +dependencies = [ + "bytemuck", + "guillotiere", + "peniko", + "skrifa", + "smallvec", +] + [[package]] name = "vello_shaders" version = "0.5.0" @@ -1700,9 +1795,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "381790a3779021edd9f88267c1b13b49546cb0fb164f329ee2f2587869ddf459" dependencies = [ "bytemuck", - "naga", + "naga 24.0.0", + "thiserror 2.0.12", + "vello_encoding 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "vello_shaders" +version = "0.5.0" +source = "git+https://github.com/linebender/vello?rev=2e74f202aed09f273fe7e84234e9b564f99ff9bc#2e74f202aed09f273fe7e84234e9b564f99ff9bc" +dependencies = [ + "bytemuck", + "log", + "naga 25.0.1", "thiserror 2.0.12", - "vello_encoding", + "vello_encoding 0.5.0 (git+https://github.com/linebender/vello?rev=2e74f202aed09f273fe7e84234e9b564f99ff9bc)", ] [[package]] @@ -1819,12 +1926,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35904fb00ba2d2e0a4d002fcbbb6e1b89b574d272a50e5fc95f6e81cf281c245" dependencies = [ "arrayvec", - "bitflags 2.8.0", + "bitflags 2.9.1", "cfg_aliases", "document-features", "js-sys", "log", - "naga", + "naga 24.0.0", "parking_lot", "profiling", "raw-window-handle", @@ -1833,9 +1940,37 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "wgpu-core", - "wgpu-hal", - "wgpu-types", + "wgpu-core 24.0.2", + "wgpu-hal 24.0.4", + "wgpu-types 24.0.0", +] + +[[package]] +name = "wgpu" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8fb398f119472be4d80bc3647339f56eb63b2a331f6a3d16e25d8144197dd9" +dependencies = [ + "arrayvec", + "bitflags 2.9.1", + "cfg_aliases", + "document-features", + "hashbrown", + "js-sys", + "log", + "naga 25.0.1", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core 25.0.2", + "wgpu-hal 25.0.2", + "wgpu-types 25.0.0", ] [[package]] @@ -1846,21 +1981,79 @@ checksum = "671c25545d479b47d3f0a8e373aceb2060b67c6eb841b24ac8c32348151c7a0c" dependencies = [ "arrayvec", "bit-vec", - "bitflags 2.8.0", + "bitflags 2.9.1", + "cfg_aliases", + "document-features", + "indexmap", + "log", + "naga 24.0.0", + "once_cell", + "parking_lot", + "profiling", + "raw-window-handle", + "rustc-hash", + "smallvec", + "thiserror 2.0.12", + "wgpu-hal 24.0.4", + "wgpu-types 24.0.0", +] + +[[package]] +name = "wgpu-core" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7b882196f8368511d613c6aeec80655160db6646aebddf8328879a88d54e500" +dependencies = [ + "arrayvec", + "bit-set", + "bit-vec", + "bitflags 2.9.1", "cfg_aliases", "document-features", + "hashbrown", "indexmap", "log", - "naga", + "naga 25.0.1", "once_cell", "parking_lot", + "portable-atomic", "profiling", "raw-window-handle", "rustc-hash", "smallvec", "thiserror 2.0.12", - "wgpu-hal", - "wgpu-types", + "wgpu-core-deps-apple", + "wgpu-core-deps-emscripten", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal 25.0.2", + "wgpu-types 25.0.0", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "25.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfd488b3239b6b7b185c3b045c39ca6bf8af34467a4c5de4e0b1a564135d093d" +dependencies = [ + "wgpu-hal 25.0.2", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "25.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f09ad7aceb3818e52539acc679f049d3475775586f3f4e311c30165cf2c00445" +dependencies = [ + "wgpu-hal 25.0.2", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "25.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cba5fb5f7f9c98baa7c889d444f63ace25574833df56f5b817985f641af58e46" +dependencies = [ + "wgpu-hal 25.0.2", ] [[package]] @@ -1873,7 +2066,7 @@ dependencies = [ "arrayvec", "ash", "bit-set", - "bitflags 2.8.0", + "bitflags 2.9.1", "block", "bytemuck", "cfg_aliases", @@ -1889,7 +2082,7 @@ dependencies = [ "libloading", "log", "metal", - "naga", + "naga 24.0.0", "ndk-sys 0.5.0+25.2.9519653", "objc", "once_cell", @@ -1904,7 +2097,54 @@ dependencies = [ "thiserror 2.0.12", "wasm-bindgen", "web-sys", - "wgpu-types", + "wgpu-types 24.0.0", + "windows", + "windows-core", +] + +[[package]] +name = "wgpu-hal" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f968767fe4d3d33747bbd1473ccd55bf0f6451f55d733b5597e67b5deab4ad17" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags 2.9.1", + "block", + "bytemuck", + "cfg-if", + "cfg_aliases", + "core-graphics-types", + "glow", + "glutin_wgl_sys", + "gpu-alloc", + "gpu-allocator", + "gpu-descriptor", + "hashbrown", + "js-sys", + "khronos-egl", + "libc", + "libloading", + "log", + "metal", + "naga 25.0.1", + "ndk-sys 0.5.0+25.2.9519653", + "objc", + "ordered-float", + "parking_lot", + "portable-atomic", + "profiling", + "range-alloc", + "raw-window-handle", + "renderdoc-sys", + "smallvec", + "thiserror 2.0.12", + "wasm-bindgen", + "web-sys", + "wgpu-types 25.0.0", "windows", "windows-core", ] @@ -1915,9 +2155,23 @@ version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50ac044c0e76c03a0378e7786ac505d010a873665e2d51383dcff8dd227dc69c" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", + "js-sys", + "log", + "web-sys", +] + +[[package]] +name = "wgpu-types" +version = "25.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aa49460c2a8ee8edba3fca54325540d904dd85b2e086ada762767e17d06e8bc" +dependencies = [ + "bitflags 2.9.1", + "bytemuck", "js-sys", "log", + "thiserror 2.0.12", "web-sys", ] diff --git a/Cargo.toml b/Cargo.toml index f1ef3a0..e518262 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 = { git = "https://github.com/endoli/ui-events", rev = "6382e63" } [profile.dev] panic = "abort" diff --git a/demo/Cargo.toml b/demo/Cargo.toml index fb34ce5..ddddb00 100644 --- a/demo/Cargo.toml +++ b/demo/Cargo.toml @@ -17,7 +17,7 @@ log = "0.4.26" parley = { git = "https://github.com/linebender/parley", rev = "587b7634ae8601c10de7f0361bfd56085a5b7b4e", features = ["accesskit"] } peniko = { version = "0.4.0", default-features = false } pollster = "0.4.0" -ui-events = "0.1.0" +ui-events = { git = "https://github.com/endoli/ui-events", rev = "6382e63" } vello = "0.5.0" # Send tracing events to Android GPU inspector, for profiling diff --git a/demo/src/lib.rs b/demo/src/lib.rs index d34671b..e1af7ce 100644 --- a/demo/src/lib.rs +++ b/demo/src/lib.rs @@ -371,7 +371,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); } diff --git a/demo/src/text.rs b/demo/src/text.rs index 1c68a99..3094261 100644 --- a/demo/src/text.rs +++ b/demo/src/text.rs @@ -12,7 +12,7 @@ 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, @@ -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( diff --git a/masonry-demo/Cargo.toml b/masonry-demo/Cargo.toml index 24c07cc..8e87161 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/xorgy/xilem", branch = "ui-events-0.2.0" } masonry_android = { path = "../masonry" } # Send tracing events to Android GPU inspector, for profiling diff --git a/masonry/Cargo.toml b/masonry/Cargo.toml index 0362ef1..a3cfcb6 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/xorgy/xilem", branch = "ui-events-0.2.0" } pollster = "0.4.0" tracing = "0.1.40" diff --git a/src/events.rs b/src/events.rs index fc6810b..946e1f9 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, PointerId, PointerScrollEvent, + PointerState, PointerUpdate, + }, }; use crate::ViewConfiguration; @@ -467,16 +470,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]; @@ -527,7 +532,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 +541,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. @@ -620,11 +625,11 @@ impl TapCounter { /// pub fn attach_count(&mut self, e: PointerEvent) -> PointerEvent { match e { - PointerEvent::Down { + PointerEvent::Down(PointerButtonEvent { button, pointer, state, - } => { + }) => { let e = if let Some(i) = self.taps.iter().position(|TapState { x, y, up_time, .. }| { let dx = (x - state.position.x).abs(); @@ -641,11 +646,11 @@ impl TapCounter { self.taps[i].x = state.position.x; self.taps[i].y = state.position.y; - PointerEvent::Down { + PointerEvent::Down(PointerButtonEvent { button, pointer, state: PointerState { count, ..state }, - } + }) } else { let s = TapState { pointer_id: pointer.pointer_id, @@ -656,34 +661,34 @@ impl TapCounter { y: state.position.y, }; self.taps.push(s); - PointerEvent::Down { + PointerEvent::Down(PointerButtonEvent { button, pointer, state: PointerState { count: 1, ..state }, - } + }) }; self.clear_expired(state.time); e } - PointerEvent::Up { + PointerEvent::Up(PointerButtonEvent { button, pointer, ref state, - } => { + }) => { if let Some(i) = self .taps .iter() .position(|TapState { pointer_id, .. }| *pointer_id == pointer.pointer_id) { self.taps[i].up_time = state.time; - PointerEvent::Up { + PointerEvent::Up(PointerButtonEvent { button, pointer, state: PointerState { count: self.taps[i].count, ..state.clone() }, - } + }) } else { e.clone() } @@ -735,7 +740,7 @@ impl TapCounter { .retain(|TapState { pointer_id, .. }| *pointer_id != p.pointer_id); e.clone() } - PointerEvent::Enter(..) | PointerEvent::Scroll { .. } => e.clone(), + PointerEvent::Enter(..) | PointerEvent::Scroll(..) => e.clone(), } }