From 9d148804e45770d1af5a8a5f75c6ce7a9eca0f1c Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Wed, 11 Feb 2026 17:06:09 +0100 Subject: [PATCH] update ashpd --- Cargo.lock | 320 +++++++++++++++++----- flake.lock | 12 +- input-capture/Cargo.toml | 5 +- input-capture/src/libei.rs | 83 +++--- input-emulation/Cargo.toml | 4 +- input-emulation/src/libei.rs | 41 +-- input-emulation/src/xdg_desktop_portal.rs | 68 +++-- 7 files changed, 371 insertions(+), 162 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5fcf02..e00d440 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -140,18 +140,16 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "ashpd" -version = "0.11.0" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cbdf310d77fd3aaee6ea2093db7011dc2d35d2eb3481e5607f1f8d942ed99df" +checksum = "0848bedd08067dca1c02c31cbb371a94ad4f2f8a61a82f2c43d96ec36a395244" dependencies = [ "enumflags2", - "futures-channel", "futures-util", - "rand 0.9.2", + "getrandom 0.4.1", "serde", "serde_repr", "tokio", - "url", "zbus", ] @@ -456,12 +454,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "cipher" version = "0.4.4" @@ -935,6 +927,12 @@ dependencies = [ "rustc_version", ] +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "foreign-types" version = "0.5.0" @@ -1178,6 +1176,19 @@ dependencies = [ "wasi 0.14.2+wasi-0.2.4", ] +[[package]] +name = "getrandom" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", + "wasip3", +] + [[package]] name = "ghash" version = "0.5.1" @@ -1423,6 +1434,9 @@ name = "hashbrown" version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" +dependencies = [ + "foldhash", +] [[package]] name = "heck" @@ -1508,7 +1522,7 @@ checksum = "a56f203cd1c76362b69e3863fd987520ac36cf70a8c92627449b2f64a8cf7d65" dependencies = [ "cfg-if", "libc", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -1621,6 +1635,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "idna" version = "1.0.3" @@ -1650,6 +1670,7 @@ checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" dependencies = [ "equivalent", "hashbrown", + "serde", ] [[package]] @@ -1931,6 +1952,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libadwaita" version = "0.7.2" @@ -1964,9 +1991,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.174" +version = "0.2.182" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" +checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" [[package]] name = "libgit2-sys" @@ -2000,9 +2027,9 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "linux-raw-sys" -version = "0.9.4" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "litemap" @@ -2157,19 +2184,6 @@ dependencies = [ "pin-utils", ] -[[package]] -name = "nix" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" -dependencies = [ - "bitflags 2.9.1", - "cfg-if", - "cfg_aliases", - "libc", - "memoffset 0.9.1", -] - [[package]] name = "nom" version = "7.1.3" @@ -2507,6 +2521,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "primeorder" version = "0.13.6" @@ -2763,15 +2787,15 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.8" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags 2.9.1", "errno", "libc", - "linux-raw-sys 0.9.4", - "windows-sys 0.60.2", + "linux-raw-sys 0.11.0", + "windows-sys 0.61.2", ] [[package]] @@ -3047,12 +3071,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "strsim" version = "0.11.1" @@ -3067,9 +3085,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.104" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -3114,15 +3132,15 @@ checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" [[package]] name = "tempfile" -version = "3.20.0" +version = "3.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" +checksum = "0136791f7c95b1f6dd99f9cc786b91bb81c3800b639b3478e561ddb7be95e5f1" dependencies = [ "fastrand", "getrandom 0.3.3", "once_cell", - "rustix 1.0.8", - "windows-sys 0.59.0", + "rustix 1.1.3", + "windows-sys 0.61.2", ] [[package]] @@ -3476,7 +3494,6 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", - "serde", ] [[package]] @@ -3499,6 +3516,7 @@ checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" dependencies = [ "getrandom 0.3.3", "js-sys", + "serde", "wasm-bindgen", ] @@ -3541,6 +3559,24 @@ dependencies = [ "wit-bindgen-rt", ] +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + [[package]] name = "wasm-bindgen" version = "0.2.100" @@ -3599,6 +3635,40 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.9.1", + "hashbrown", + "indexmap", + "semver", +] + [[package]] name = "wayland-backend" version = "0.3.11" @@ -3607,7 +3677,7 @@ checksum = "673a33c33048a5ade91a6b139580fa174e19fb0d23f396dca9fa15f2e1e49b35" dependencies = [ "cc", "downcast-rs", - "rustix 1.0.8", + "rustix 1.1.3", "smallvec", "wayland-sys", ] @@ -3619,7 +3689,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c66a47e840dc20793f2264eb4b3e4ecb4b75d91c0dd4af04b456128e0bdd449d" dependencies = [ "bitflags 2.9.1", - "rustix 1.0.8", + "rustix 1.1.3", "wayland-backend", "wayland-scanner", ] @@ -3733,7 +3803,7 @@ dependencies = [ "lazy_static", "libc", "log", - "nix 0.26.4", + "nix", "portable-atomic", "rand 0.8.5", "thiserror 1.0.69", @@ -3778,7 +3848,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -3799,7 +3869,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -3811,7 +3881,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -3843,6 +3913,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -3850,7 +3926,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -3859,7 +3935,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -3868,7 +3944,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -3907,6 +3983,15 @@ dependencies = [ "windows-targets 0.53.3", ] +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -3944,7 +4029,7 @@ version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ - "windows-link", + "windows-link 0.1.3", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", @@ -3961,7 +4046,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -4121,6 +4206,26 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + [[package]] name = "wit-bindgen-rt" version = "0.39.0" @@ -4130,6 +4235,74 @@ dependencies = [ "bitflags 2.9.1", ] +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.9.1", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "writeable" version = "0.6.1" @@ -4210,9 +4383,9 @@ dependencies = [ [[package]] name = "zbus" -version = "5.9.0" +version = "5.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bb4f9a464286d42851d18a605f7193b8febaf5b0919d71c6399b7b26e5b0aad" +checksum = "1bfeff997a0aaa3eb20c4652baf788d2dfa6d2839a0ead0b3ff69ce2f9c4bdd1" dependencies = [ "async-broadcast", "async-recursion", @@ -4222,14 +4395,16 @@ dependencies = [ "futures-core", "futures-lite", "hex", - "nix 0.30.1", + "libc", "ordered-stream", + "rustix 1.1.3", "serde", "serde_repr", "tokio", "tracing", "uds_windows", - "windows-sys 0.59.0", + "uuid", + "windows-sys 0.61.2", "winnow", "zbus_macros", "zbus_names", @@ -4238,9 +4413,9 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "5.9.0" +version = "5.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef9859f68ee0c4ee2e8cde84737c78e3f4c54f946f2a38645d0d4c7a95327659" +checksum = "0bbd5a90dbe8feee5b13def448427ae314ccd26a49cac47905cafefb9ff846f1" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4253,12 +4428,11 @@ dependencies = [ [[package]] name = "zbus_names" -version = "4.2.0" +version = "4.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be68e64bf6ce8db94f63e72f0c7eb9a60d733f7e0499e628dfab0f84d6bcb97" +checksum = "ffd8af6d5b78619bab301ff3c560a5bd22426150253db278f164d6cf3b72c50f" dependencies = [ "serde", - "static_assertions", "winnow", "zvariant", ] @@ -4359,14 +4533,13 @@ dependencies = [ [[package]] name = "zvariant" -version = "5.6.0" +version = "5.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91b3680bb339216abd84714172b5138a4edac677e641ef17e1d8cb1b3ca6e6f" +checksum = "68b64ef4f40c7951337ddc7023dd03528a57a3ce3408ee9da5e948bd29b232c4" dependencies = [ "endi", "enumflags2", "serde", - "url", "winnow", "zvariant_derive", "zvariant_utils", @@ -4374,9 +4547,9 @@ dependencies = [ [[package]] name = "zvariant_derive" -version = "5.6.0" +version = "5.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8c68501be459a8dbfffbe5d792acdd23b4959940fc87785fb013b32edbc208" +checksum = "484d5d975eb7afb52cc6b929c13d3719a20ad650fea4120e6310de3fc55e415c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4387,14 +4560,13 @@ dependencies = [ [[package]] name = "zvariant_utils" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16edfee43e5d7b553b77872d99bc36afdda75c223ca7ad5e3fbecd82ca5fc34" +checksum = "f75c23a64ef8f40f13a6989991e643554d9bef1d682a281160cf0c1bc389c5e9" dependencies = [ "proc-macro2", "quote", "serde", - "static_assertions", "syn", "winnow", ] diff --git a/flake.lock b/flake.lock index 3badc2b..5d7da6a 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1752687322, - "narHash": "sha256-RKwfXA4OZROjBTQAl9WOZQFm7L8Bo93FQwSJpAiSRvo=", + "lastModified": 1770841267, + "narHash": "sha256-9xejG0KoqsoKEGp2kVbXRlEYtFFcDTHjidiuX8hGO44=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6e987485eb2c77e5dcc5af4e3c70843711ef9251", + "rev": "ec7c70d12ce2fc37cb92aff673dcdca89d187bae", "type": "github" }, "original": { @@ -29,11 +29,11 @@ ] }, "locked": { - "lastModified": 1752806774, - "narHash": "sha256-4cHeoR2roN7d/3J6gT+l6o7J2hTrBIUiCwVdDNMeXzE=", + "lastModified": 1770952264, + "narHash": "sha256-CjymNrJZWBtpavyuTkfPVPaZkwzIzGaf0E/3WgcwM14=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "3c90219b3ba1c9790c45a078eae121de48a39c55", + "rev": "ec6a3d5cdf14bb5a1dd03652bd3f6351004d2188", "type": "github" }, "original": { diff --git a/input-capture/Cargo.toml b/input-capture/Cargo.toml index 0f77eb2..0811d83 100644 --- a/input-capture/Cargo.toml +++ b/input-capture/Cargo.toml @@ -12,7 +12,7 @@ futures-core = "0.3.30" log = "0.4.22" input-event = { path = "../input-event", version = "0.3.0" } memmap = "0.7" -tempfile = "3.8" +tempfile = "3.25.0" thiserror = "2.0.0" tokio = { version = "1.32.0", features = [ "io-util", @@ -41,7 +41,8 @@ wayland-protocols-wlr = { version = "0.3.1", features = [ "client", ], optional = true } x11 = { version = "2.21.0", features = ["xlib", "xtest"], optional = true } -ashpd = { version = "0.11.0", default-features = false, features = [ +ashpd = { version = "0.13.0", default-features = false, features = [ + "input_capture", "tokio", ], optional = true } reis = { version = "0.5.0", features = ["tokio"], optional = true } diff --git a/input-capture/src/libei.rs b/input-capture/src/libei.rs index 697b782..fa16895 100644 --- a/input-capture/src/libei.rs +++ b/input-capture/src/libei.rs @@ -2,8 +2,8 @@ use ashpd::{ desktop::{ Session, input_capture::{ - Activated, ActivatedBarrier, Barrier, BarrierID, Capabilities, InputCapture, Region, - Zones, + Activated, ActivatedBarrier, Barrier, BarrierID, Capabilities, CreateSessionOptions, + InputCapture, Region, ReleaseOptions, Zones, }, }, enumflags2::BitFlags, @@ -58,8 +58,8 @@ enum LibeiNotifyEvent { } #[allow(dead_code)] -pub struct LibeiInputCapture<'a> { - input_capture: Pin>>, +pub struct LibeiInputCapture { + input_capture: Pin>, capture_task: JoinHandle>, event_rx: Receiver<(Position, CaptureEvent)>, notify_capture: Sender, @@ -130,12 +130,15 @@ fn select_barriers( } async fn update_barriers( - input_capture: &InputCapture<'_>, - session: &Session<'_, InputCapture<'_>>, + input_capture: &InputCapture, + session: &Session, active_clients: &[Position], next_barrier_id: &mut NonZeroU32, ) -> Result<(Vec, HashMap), ashpd::Error> { - let zones = input_capture.zones(session).await?.response()?; + let zones = input_capture + .zones(session, Default::default()) + .await? + .response()?; log::debug!("zones: {zones:?}"); let (barriers, id_map) = select_barriers(&zones, active_clients, next_barrier_id); @@ -144,31 +147,38 @@ async fn update_barriers( let ashpd_barriers: Vec = barriers.iter().copied().map(|b| b.into()).collect(); let response = input_capture - .set_pointer_barriers(session, &ashpd_barriers, zones.zone_set()) + .set_pointer_barriers( + session, + &ashpd_barriers, + zones.zone_set(), + Default::default(), + ) .await?; let response = response.response()?; log::debug!("{response:?}"); Ok((barriers, id_map)) } -async fn create_session<'a>( - input_capture: &'a InputCapture<'a>, -) -> std::result::Result<(Session<'a, InputCapture<'a>>, BitFlags), ashpd::Error> { +async fn create_session( + input_capture: &InputCapture, +) -> std::result::Result<(Session, BitFlags), ashpd::Error> { log::debug!("creating input capture session"); + let create_session_options = CreateSessionOptions::default().set_capabilities( + Capabilities::Keyboard | Capabilities::Pointer | Capabilities::Touchscreen, + ); input_capture - .create_session( - None, - Capabilities::Keyboard | Capabilities::Pointer | Capabilities::Touchscreen, - ) + .create_session(None, create_session_options) .await } async fn connect_to_eis( - input_capture: &InputCapture<'_>, - session: &Session<'_, InputCapture<'_>>, + input_capture: &InputCapture, + session: &Session, ) -> Result<(ei::Context, Connection, EiConvertEventStream), CaptureError> { log::debug!("connect_to_eis"); - let fd = input_capture.connect_to_eis(session).await?; + let fd = input_capture + .connect_to_eis(session, Default::default()) + .await?; // create unix stream from fd let stream = UnixStream::from(fd); @@ -201,10 +211,10 @@ async fn libei_event_handler( } } -impl LibeiInputCapture<'_> { +impl LibeiInputCapture { pub async fn new() -> std::result::Result { let input_capture = Box::pin(InputCapture::new().await?); - let input_capture_ptr = input_capture.as_ref().get_ref() as *const InputCapture<'static>; + let input_capture_ptr = input_capture.as_ref().get_ref() as *const InputCapture; let first_session = Some(create_session(unsafe { &*input_capture_ptr }).await?); let (event_tx, event_rx) = mpsc::channel(1); @@ -238,10 +248,10 @@ impl LibeiInputCapture<'_> { } async fn do_capture( - input_capture: *const InputCapture<'static>, + input_capture: *const InputCapture, mut capture_event: Receiver, notify_release: Arc, - session: Option<(Session<'_, InputCapture<'_>>, BitFlags)>, + session: Option<(Session, BitFlags)>, event_tx: Sender<(Position, CaptureEvent)>, cancellation_token: CancellationToken, ) -> Result<(), CaptureError> { @@ -307,7 +317,7 @@ async fn do_capture( // disable capture log::debug!("disabling input capture"); - if let Err(e) = input_capture.disable(&session).await { + if let Err(e) = input_capture.disable(&session, Default::default()).await { log::warn!("input_capture.disable(&session) {e}"); } if let Err(e) = session.close().await { @@ -336,8 +346,8 @@ async fn do_capture( } async fn do_capture_session( - input_capture: &InputCapture<'_>, - session: &mut Session<'_, InputCapture<'_>>, + input_capture: &InputCapture, + session: &mut Session, event_tx: &Sender<(Position, CaptureEvent)>, active_clients: &[Position], next_barrier_id: &mut NonZeroU32, @@ -356,7 +366,7 @@ async fn do_capture_session( update_barriers(input_capture, session, active_clients, next_barrier_id).await?; log::debug!("enabling session"); - input_capture.enable(session).await?; + input_capture.enable(session, Default::default()).await?; // cancellation token to release session let release_session = Arc::new(Notify::new()); @@ -462,9 +472,9 @@ async fn do_capture_session( Ok(()) } -async fn release_capture<'a>( - input_capture: &InputCapture<'a>, - session: &Session<'a, InputCapture<'a>>, +async fn release_capture( + input_capture: &InputCapture, + session: &Session, activated: Activated, current_pos: Position, ) -> Result<(), CaptureError> { @@ -484,9 +494,10 @@ async fn release_capture<'a>( }; // release 1px to the right of the entered zone let cursor_position = (x as f64 + dx, y as f64 + dy); - input_capture - .release(session, activated.activation_id(), Some(cursor_position)) - .await?; + let release_options = ReleaseOptions::default() + .set_activation_id(activated.activation_id()) + .set_cursor_position(Some(cursor_position)); + input_capture.release(session, release_options).await?; Ok(()) } @@ -561,7 +572,7 @@ async fn handle_ei_event( } #[async_trait] -impl LanMouseInputCapture for LibeiInputCapture<'_> { +impl LanMouseInputCapture for LibeiInputCapture { async fn create(&mut self, pos: Position) -> Result<(), CaptureError> { let _ = self .notify_capture @@ -598,7 +609,7 @@ impl LanMouseInputCapture for LibeiInputCapture<'_> { } } -impl Drop for LibeiInputCapture<'_> { +impl Drop for LibeiInputCapture { fn drop(&mut self) { if !self.terminated { /* this workaround is needed until async drop is stabilized */ @@ -607,10 +618,10 @@ impl Drop for LibeiInputCapture<'_> { } } -impl Stream for LibeiInputCapture<'_> { +impl Stream for LibeiInputCapture { type Item = Result<(Position, CaptureEvent), CaptureError>; - fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll> { match self.capture_task.poll_unpin(cx) { Poll::Ready(r) => match r.expect("failed to join") { Ok(()) => Poll::Ready(None), diff --git a/input-emulation/Cargo.toml b/input-emulation/Cargo.toml index e2c98b1..81b2916 100644 --- a/input-emulation/Cargo.toml +++ b/input-emulation/Cargo.toml @@ -40,7 +40,9 @@ wayland-protocols-misc = { version = "0.3.1", features = [ "client", ], optional = true } x11 = { version = "2.21.0", features = ["xlib", "xtest"], optional = true } -ashpd = { version = "0.11.0", default-features = false, features = [ +ashpd = { version = "0.13.0", default-features = false, features = [ + "remote_desktop", + "screencast", "tokio", ], optional = true } reis = { version = "0.5.0", features = ["tokio"], optional = true } diff --git a/input-emulation/src/libei.rs b/input-emulation/src/libei.rs index 4e60c98..3ac6e89 100644 --- a/input-emulation/src/libei.rs +++ b/input-emulation/src/libei.rs @@ -13,7 +13,7 @@ use tokio::task::JoinHandle; use ashpd::desktop::{ PersistMode, Session, - remote_desktop::{DeviceType, RemoteDesktop}, + remote_desktop::{DeviceType, RemoteDesktop, SelectDevicesOptions}, }; use async_trait::async_trait; @@ -40,15 +40,15 @@ struct Devices { keyboard: Arc>>, } -pub(crate) struct LibeiEmulation<'a> { +pub(crate) struct LibeiEmulation { context: ei::Context, conn: event::Connection, devices: Devices, ei_task: JoinHandle<()>, error: Arc>>, libei_error: Arc, - _remote_desktop: RemoteDesktop<'a>, - session: Session<'a, RemoteDesktop<'a>>, + _remote_desktop: RemoteDesktop, + session: Session, } /// Get the path to the RemoteDesktop token file @@ -84,27 +84,26 @@ fn write_token(token: &str) -> io::Result<()> { Ok(()) } -async fn get_ei_fd<'a>() --> Result<(RemoteDesktop<'a>, Session<'a, RemoteDesktop<'a>>, OwnedFd), ashpd::Error> { +async fn get_ei_fd() -> Result<(RemoteDesktop, Session, OwnedFd), ashpd::Error> { let remote_desktop = RemoteDesktop::new().await?; let restore_token = read_token(); log::debug!("creating session ..."); - let session = remote_desktop.create_session().await?; + let session = remote_desktop.create_session(Default::default()).await?; log::debug!("selecting devices ..."); - remote_desktop - .select_devices( - &session, - DeviceType::Keyboard | DeviceType::Pointer, - restore_token.as_deref(), - PersistMode::ExplicitlyRevoked, - ) - .await?; + let options = SelectDevicesOptions::default() + .set_devices(DeviceType::Keyboard | DeviceType::Pointer) + .set_persist_mode(PersistMode::ExplicitlyRevoked) + .set_restore_token(restore_token.as_deref()); + remote_desktop.select_devices(&session, options).await?; log::info!("requesting permission for input emulation"); - let start_response = remote_desktop.start(&session, None).await?.response()?; + let start_response = remote_desktop + .start(&session, None, Default::default()) + .await? + .response()?; // The restore token is only valid once, we need to re-save it each time if let Some(token_str) = start_response.restore_token() { @@ -113,11 +112,13 @@ async fn get_ei_fd<'a>() } } - let fd = remote_desktop.connect_to_eis(&session).await?; + let fd = remote_desktop + .connect_to_eis(&session, Default::default()) + .await?; Ok((remote_desktop, session, fd)) } -impl LibeiEmulation<'_> { +impl LibeiEmulation { pub(crate) async fn new() -> Result { let (_remote_desktop, session, eifd) = get_ei_fd().await?; let stream = UnixStream::from(eifd); @@ -152,14 +153,14 @@ impl LibeiEmulation<'_> { } } -impl Drop for LibeiEmulation<'_> { +impl Drop for LibeiEmulation { fn drop(&mut self) { self.ei_task.abort(); } } #[async_trait] -impl Emulation for LibeiEmulation<'_> { +impl Emulation for LibeiEmulation { async fn consume( &mut self, event: Event, diff --git a/input-emulation/src/xdg_desktop_portal.rs b/input-emulation/src/xdg_desktop_portal.rs index 37d2974..7c2d133 100644 --- a/input-emulation/src/xdg_desktop_portal.rs +++ b/input-emulation/src/xdg_desktop_portal.rs @@ -1,7 +1,10 @@ use ashpd::{ desktop::{ PersistMode, Session, - remote_desktop::{Axis, DeviceType, KeyState, RemoteDesktop}, + remote_desktop::{ + Axis, DeviceType, KeyState, NotifyPointerAxisOptions, RemoteDesktop, + SelectDevicesOptions, + }, }, zbus::AsyncDrop, }; @@ -17,32 +20,31 @@ use crate::error::EmulationError; use super::{Emulation, EmulationHandle, error::XdpEmulationCreationError}; -pub(crate) struct DesktopPortalEmulation<'a> { - proxy: RemoteDesktop<'a>, - session: Session<'a, RemoteDesktop<'a>>, +pub(crate) struct DesktopPortalEmulation { + proxy: RemoteDesktop, + session: Session, } -impl<'a> DesktopPortalEmulation<'a> { - pub(crate) async fn new() -> Result, XdpEmulationCreationError> { +impl DesktopPortalEmulation { + pub(crate) async fn new() -> Result { log::debug!("connecting to org.freedesktop.portal.RemoteDesktop portal ..."); let proxy = RemoteDesktop::new().await?; // retry when user presses the cancel button log::debug!("creating session ..."); - let session = proxy.create_session().await?; + let session = proxy.create_session(Default::default()).await?; log::debug!("selecting devices ..."); - proxy - .select_devices( - &session, - DeviceType::Keyboard | DeviceType::Pointer, - None, - PersistMode::ExplicitlyRevoked, - ) - .await?; + let options = SelectDevicesOptions::default() + .set_devices(DeviceType::Keyboard | DeviceType::Pointer) + .set_persist_mode(PersistMode::ExplicitlyRevoked); + proxy.select_devices(&session, options).await?; log::info!("requesting permission for input emulation"); - let _devices = proxy.start(&session, None).await?.response()?; + let _devices = proxy + .start(&session, None, Default::default()) + .await? + .response()?; log::debug!("started session"); let session = session; @@ -52,7 +54,7 @@ impl<'a> DesktopPortalEmulation<'a> { } #[async_trait] -impl Emulation for DesktopPortalEmulation<'_> { +impl Emulation for DesktopPortalEmulation { async fn consume( &mut self, event: input_event::Event, @@ -62,7 +64,7 @@ impl Emulation for DesktopPortalEmulation<'_> { Pointer(p) => match p { PointerEvent::Motion { time: _, dx, dy } => { self.proxy - .notify_pointer_motion(&self.session, dx, dy) + .notify_pointer_motion(&self.session, dx, dy, Default::default()) .await?; } PointerEvent::Button { @@ -75,7 +77,12 @@ impl Emulation for DesktopPortalEmulation<'_> { _ => KeyState::Pressed, }; self.proxy - .notify_pointer_button(&self.session, button as i32, state) + .notify_pointer_button( + &self.session, + button as i32, + state, + Default::default(), + ) .await?; } PointerEvent::AxisDiscrete120 { axis, value } => { @@ -84,7 +91,12 @@ impl Emulation for DesktopPortalEmulation<'_> { _ => Axis::Horizontal, }; self.proxy - .notify_pointer_axis_discrete(&self.session, axis, value / 120) + .notify_pointer_axis_discrete( + &self.session, + axis, + value / 120, + Default::default(), + ) .await?; } PointerEvent::Axis { @@ -101,7 +113,12 @@ impl Emulation for DesktopPortalEmulation<'_> { Axis::Horizontal => (value, 0.), }; self.proxy - .notify_pointer_axis(&self.session, dx, dy, true) + .notify_pointer_axis( + &self.session, + dx, + dy, + NotifyPointerAxisOptions::default().set_finish(true), + ) .await?; } }, @@ -117,7 +134,12 @@ impl Emulation for DesktopPortalEmulation<'_> { _ => KeyState::Pressed, }; self.proxy - .notify_keyboard_keycode(&self.session, key as i32, state) + .notify_keyboard_keycode( + &self.session, + key as i32, + state, + Default::default(), + ) .await?; } KeyboardEvent::Modifiers { .. } => { @@ -141,7 +163,7 @@ impl Emulation for DesktopPortalEmulation<'_> { } } -impl AsyncDrop for DesktopPortalEmulation<'_> { +impl AsyncDrop for DesktopPortalEmulation { #[doc = r" Perform the async cleanup."] #[allow(clippy::type_complexity, clippy::type_repetition_in_bounds)] fn async_drop<'async_trait>(