Compare commits

..

2 Commits

Author SHA1 Message Date
Ferdinand Schober
b391efa631 implement xdg-foreign to put capture dialog on top 2026-02-11 17:41:15 +01:00
Ferdinand Schober
c2b68376d3 update ashpd 2026-02-11 17:06:09 +01:00
6 changed files with 114 additions and 86 deletions

150
Cargo.lock generated
View File

@@ -140,15 +140,34 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]]
name = "ashpd"
version = "0.13.0-alpha"
source = "git+https://github.com/bilelmoussaoui/ashpd#76d565f62b848554ed098da90d0f8dccac6569fd"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6cbdf310d77fd3aaee6ea2093db7011dc2d35d2eb3481e5607f1f8d942ed99df"
dependencies = [
"enumflags2",
"futures-channel",
"futures-util",
"getrandom 0.3.3",
"rand 0.9.2",
"serde",
"serde_repr",
"tokio",
"url",
"zbus",
]
[[package]]
name = "ashpd"
version = "0.13.0"
source = "git+https://github.com/feschber/ashpd#f5f407e1834501579c49e7104bcaf26d5e0e52e6"
dependencies = [
"enumflags2",
"fastrand",
"futures-channel",
"futures-util",
"serde",
"serde_repr",
"tokio",
"url",
"zbus",
]
@@ -453,6 +472,12 @@ 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"
@@ -1523,7 +1548,7 @@ checksum = "a56f203cd1c76362b69e3863fd987520ac36cf70a8c92627449b2f64a8cf7d65"
dependencies = [
"cfg-if",
"libc",
"windows-link 0.1.3",
"windows-link",
]
[[package]]
@@ -1681,7 +1706,7 @@ dependencies = [
name = "input-capture"
version = "0.3.0"
dependencies = [
"ashpd",
"ashpd 0.13.0",
"async-trait",
"bitflags 2.9.1",
"core-foundation",
@@ -1711,7 +1736,7 @@ dependencies = [
name = "input-emulation"
version = "0.3.0"
dependencies = [
"ashpd",
"ashpd 0.11.0",
"async-trait",
"bitflags 2.9.1",
"core-graphics",
@@ -1981,9 +2006,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.182"
version = "0.2.174"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
[[package]]
name = "libgit2-sys"
@@ -2017,9 +2042,9 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
[[package]]
name = "linux-raw-sys"
version = "0.11.0"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
[[package]]
name = "litemap"
@@ -2174,6 +2199,19 @@ 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"
@@ -2767,14 +2805,14 @@ dependencies = [
[[package]]
name = "rustix"
version = "1.1.3"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34"
checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8"
dependencies = [
"bitflags 2.9.1",
"errno",
"libc",
"linux-raw-sys 0.11.0",
"linux-raw-sys 0.9.4",
"windows-sys 0.60.2",
]
@@ -3051,6 +3089,12 @@ 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"
@@ -3112,15 +3156,15 @@ checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
[[package]]
name = "tempfile"
version = "3.25.0"
version = "3.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0136791f7c95b1f6dd99f9cc786b91bb81c3800b639b3478e561ddb7be95e5f1"
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
dependencies = [
"fastrand",
"getrandom 0.3.3",
"once_cell",
"rustix 1.1.3",
"windows-sys 0.60.2",
"rustix 1.0.8",
"windows-sys 0.59.0",
]
[[package]]
@@ -3474,6 +3518,7 @@ dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
"serde",
]
[[package]]
@@ -3496,7 +3541,6 @@ checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d"
dependencies = [
"getrandom 0.3.3",
"js-sys",
"serde",
"wasm-bindgen",
]
@@ -3605,7 +3649,7 @@ checksum = "fee64194ccd96bf648f42a65a7e589547096dfa702f7cadef84347b66ad164f9"
dependencies = [
"cc",
"downcast-rs",
"rustix 1.1.3",
"rustix 1.0.8",
"smallvec",
"wayland-sys",
]
@@ -3617,7 +3661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8e6faa537fbb6c186cb9f1d41f2f811a4120d1b57ec61f50da451a0c5122bec"
dependencies = [
"bitflags 2.9.1",
"rustix 1.1.3",
"rustix 1.0.8",
"wayland-backend",
"wayland-scanner",
]
@@ -3731,7 +3775,7 @@ dependencies = [
"lazy_static",
"libc",
"log",
"nix",
"nix 0.26.4",
"portable-atomic",
"rand 0.8.5",
"thiserror 1.0.69",
@@ -3776,7 +3820,7 @@ dependencies = [
"windows-collections",
"windows-core",
"windows-future",
"windows-link 0.1.3",
"windows-link",
"windows-numerics",
]
@@ -3797,7 +3841,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
dependencies = [
"windows-implement",
"windows-interface",
"windows-link 0.1.3",
"windows-link",
"windows-result",
"windows-strings",
]
@@ -3809,7 +3853,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
dependencies = [
"windows-core",
"windows-link 0.1.3",
"windows-link",
"windows-threading",
]
@@ -3841,12 +3885,6 @@ 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"
@@ -3854,7 +3892,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
dependencies = [
"windows-core",
"windows-link 0.1.3",
"windows-link",
]
[[package]]
@@ -3863,7 +3901,7 @@ version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"
dependencies = [
"windows-link 0.1.3",
"windows-link",
]
[[package]]
@@ -3872,7 +3910,7 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"
dependencies = [
"windows-link 0.1.3",
"windows-link",
]
[[package]]
@@ -3911,15 +3949,6 @@ 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"
@@ -3957,7 +3986,7 @@ version = "0.53.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
dependencies = [
"windows-link 0.1.3",
"windows-link",
"windows_aarch64_gnullvm 0.53.0",
"windows_aarch64_msvc 0.53.0",
"windows_i686_gnu 0.53.0",
@@ -3974,7 +4003,7 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6"
dependencies = [
"windows-link 0.1.3",
"windows-link",
]
[[package]]
@@ -4223,9 +4252,9 @@ dependencies = [
[[package]]
name = "zbus"
version = "5.13.2"
version = "5.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bfeff997a0aaa3eb20c4652baf788d2dfa6d2839a0ead0b3ff69ce2f9c4bdd1"
checksum = "4bb4f9a464286d42851d18a605f7193b8febaf5b0919d71c6399b7b26e5b0aad"
dependencies = [
"async-broadcast",
"async-recursion",
@@ -4235,16 +4264,14 @@ dependencies = [
"futures-core",
"futures-lite",
"hex",
"libc",
"nix 0.30.1",
"ordered-stream",
"rustix 1.1.3",
"serde",
"serde_repr",
"tokio",
"tracing",
"uds_windows",
"uuid",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
"winnow",
"zbus_macros",
"zbus_names",
@@ -4253,9 +4280,9 @@ dependencies = [
[[package]]
name = "zbus_macros"
version = "5.13.2"
version = "5.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bbd5a90dbe8feee5b13def448427ae314ccd26a49cac47905cafefb9ff846f1"
checksum = "ef9859f68ee0c4ee2e8cde84737c78e3f4c54f946f2a38645d0d4c7a95327659"
dependencies = [
"proc-macro-crate",
"proc-macro2",
@@ -4268,11 +4295,12 @@ dependencies = [
[[package]]
name = "zbus_names"
version = "4.3.1"
version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffd8af6d5b78619bab301ff3c560a5bd22426150253db278f164d6cf3b72c50f"
checksum = "7be68e64bf6ce8db94f63e72f0c7eb9a60d733f7e0499e628dfab0f84d6bcb97"
dependencies = [
"serde",
"static_assertions",
"winnow",
"zvariant",
]
@@ -4373,13 +4401,14 @@ dependencies = [
[[package]]
name = "zvariant"
version = "5.9.2"
version = "5.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68b64ef4f40c7951337ddc7023dd03528a57a3ce3408ee9da5e948bd29b232c4"
checksum = "d91b3680bb339216abd84714172b5138a4edac677e641ef17e1d8cb1b3ca6e6f"
dependencies = [
"endi",
"enumflags2",
"serde",
"url",
"winnow",
"zvariant_derive",
"zvariant_utils",
@@ -4387,9 +4416,9 @@ dependencies = [
[[package]]
name = "zvariant_derive"
version = "5.9.2"
version = "5.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "484d5d975eb7afb52cc6b929c13d3719a20ad650fea4120e6310de3fc55e415c"
checksum = "3a8c68501be459a8dbfffbe5d792acdd23b4959940fc87785fb013b32edbc208"
dependencies = [
"proc-macro-crate",
"proc-macro2",
@@ -4400,13 +4429,14 @@ dependencies = [
[[package]]
name = "zvariant_utils"
version = "3.3.0"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f75c23a64ef8f40f13a6989991e643554d9bef1d682a281160cf0c1bc389c5e9"
checksum = "e16edfee43e5d7b553b77872d99bc36afdda75c223ca7ad5e3fbecd82ca5fc34"
dependencies = [
"proc-macro2",
"quote",
"serde",
"static_assertions",
"syn",
"winnow",
]

12
flake.lock generated
View File

@@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1770841267,
"narHash": "sha256-9xejG0KoqsoKEGp2kVbXRlEYtFFcDTHjidiuX8hGO44=",
"lastModified": 1752687322,
"narHash": "sha256-RKwfXA4OZROjBTQAl9WOZQFm7L8Bo93FQwSJpAiSRvo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ec7c70d12ce2fc37cb92aff673dcdca89d187bae",
"rev": "6e987485eb2c77e5dcc5af4e3c70843711ef9251",
"type": "github"
},
"original": {
@@ -29,11 +29,11 @@
]
},
"locked": {
"lastModified": 1770952264,
"narHash": "sha256-CjymNrJZWBtpavyuTkfPVPaZkwzIzGaf0E/3WgcwM14=",
"lastModified": 1752806774,
"narHash": "sha256-4cHeoR2roN7d/3J6gT+l6o7J2hTrBIUiCwVdDNMeXzE=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "ec6a3d5cdf14bb5a1dd03652bd3f6351004d2188",
"rev": "3c90219b3ba1c9790c45a078eae121de48a39c55",
"type": "github"
},
"original": {

View File

@@ -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.25.0"
tempfile = "3.8"
thiserror = "2.0.0"
tokio = { version = "1.32.0", features = [
"io-util",
@@ -41,8 +41,7 @@ wayland-protocols-wlr = { version = "0.3.1", features = [
"client",
], optional = true }
x11 = { version = "2.21.0", features = ["xlib", "xtest"], optional = true }
ashpd = { git = "https://github.com/bilelmoussaoui/ashpd", default-features = false, features = [
"input_capture",
ashpd = { git = "https://github.com/feschber/ashpd", default-features = false, features = [
"tokio",
], optional = true }
reis = { version = "0.5.0", features = ["tokio"], optional = true }

View File

@@ -40,9 +40,7 @@ wayland-protocols-misc = { version = "0.3.1", features = [
"client",
], optional = true }
x11 = { version = "2.21.0", features = ["xlib", "xtest"], optional = true }
ashpd = { git = "https://github.com/bilelmoussaoui/ashpd", default-features = false, features = [
"remote_desktop",
"screencast",
ashpd = { version = "0.11.0", default-features = false, features = [
"tokio",
], optional = true }
reis = { version = "0.5.0", features = ["tokio"], optional = true }

View File

@@ -40,15 +40,15 @@ struct Devices {
keyboard: Arc<RwLock<Option<(ei::Device, ei::Keyboard)>>>,
}
pub(crate) struct LibeiEmulation {
pub(crate) struct LibeiEmulation<'a> {
context: ei::Context,
conn: event::Connection,
devices: Devices,
ei_task: JoinHandle<()>,
error: Arc<Mutex<Option<EmulationError>>>,
libei_error: Arc<AtomicBool>,
_remote_desktop: RemoteDesktop,
session: Session<RemoteDesktop>,
_remote_desktop: RemoteDesktop<'a>,
session: Session<'a, RemoteDesktop<'a>>,
}
/// Get the path to the RemoteDesktop token file
@@ -84,7 +84,8 @@ fn write_token(token: &str) -> io::Result<()> {
Ok(())
}
async fn get_ei_fd() -> Result<(RemoteDesktop, Session<RemoteDesktop>, OwnedFd), ashpd::Error> {
async fn get_ei_fd<'a>()
-> Result<(RemoteDesktop<'a>, Session<'a, RemoteDesktop<'a>>, OwnedFd), ashpd::Error> {
let remote_desktop = RemoteDesktop::new().await?;
let restore_token = read_token();
@@ -116,7 +117,7 @@ async fn get_ei_fd() -> Result<(RemoteDesktop, Session<RemoteDesktop>, OwnedFd),
Ok((remote_desktop, session, fd))
}
impl LibeiEmulation {
impl LibeiEmulation<'_> {
pub(crate) async fn new() -> Result<Self, LibeiEmulationCreationError> {
let (_remote_desktop, session, eifd) = get_ei_fd().await?;
let stream = UnixStream::from(eifd);
@@ -151,14 +152,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,

View File

@@ -17,13 +17,13 @@ use crate::error::EmulationError;
use super::{Emulation, EmulationHandle, error::XdpEmulationCreationError};
pub(crate) struct DesktopPortalEmulation {
proxy: RemoteDesktop,
session: Session<RemoteDesktop>,
pub(crate) struct DesktopPortalEmulation<'a> {
proxy: RemoteDesktop<'a>,
session: Session<'a, RemoteDesktop<'a>>,
}
impl DesktopPortalEmulation {
pub(crate) async fn new() -> Result<DesktopPortalEmulation, XdpEmulationCreationError> {
impl<'a> DesktopPortalEmulation<'a> {
pub(crate) async fn new() -> Result<DesktopPortalEmulation<'a>, XdpEmulationCreationError> {
log::debug!("connecting to org.freedesktop.portal.RemoteDesktop portal ...");
let proxy = RemoteDesktop::new().await?;
@@ -52,7 +52,7 @@ impl DesktopPortalEmulation {
}
#[async_trait]
impl Emulation for DesktopPortalEmulation {
impl Emulation for DesktopPortalEmulation<'_> {
async fn consume(
&mut self,
event: input_event::Event,
@@ -141,7 +141,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>(