update ashpd

This commit is contained in:
Ferdinand Schober
2026-02-11 17:06:09 +01:00
committed by Ferdinand Schober
parent ad63b6ba20
commit be27e337f4
7 changed files with 106 additions and 118 deletions

View File

@@ -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 = { git = "https://github.com/bilelmoussaoui/ashpd", default-features = false, features = [
"remote_desktop",
"screencast",
"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<'a> {
pub(crate) struct LibeiEmulation {
context: ei::Context,
conn: event::Connection,
devices: Devices,
ei_task: JoinHandle<()>,
error: Arc<Mutex<Option<EmulationError>>>,
libei_error: Arc<AtomicBool>,
_remote_desktop: RemoteDesktop<'a>,
session: Session<'a, RemoteDesktop<'a>>,
_remote_desktop: RemoteDesktop,
session: Session<RemoteDesktop>,
}
/// Get the path to the RemoteDesktop token file
@@ -84,8 +84,7 @@ 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<RemoteDesktop>, OwnedFd), ashpd::Error> {
let remote_desktop = RemoteDesktop::new().await?;
let restore_token = read_token();
@@ -117,7 +116,7 @@ async fn get_ei_fd<'a>()
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);
@@ -152,14 +151,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<'a> {
proxy: RemoteDesktop<'a>,
session: Session<'a, RemoteDesktop<'a>>,
pub(crate) struct DesktopPortalEmulation {
proxy: RemoteDesktop,
session: Session<RemoteDesktop>,
}
impl<'a> DesktopPortalEmulation<'a> {
pub(crate) async fn new() -> Result<DesktopPortalEmulation<'a>, XdpEmulationCreationError> {
impl DesktopPortalEmulation {
pub(crate) async fn new() -> Result<DesktopPortalEmulation, XdpEmulationCreationError> {
log::debug!("connecting to org.freedesktop.portal.RemoteDesktop portal ...");
let proxy = RemoteDesktop::new().await?;
@@ -52,7 +52,7 @@ impl<'a> DesktopPortalEmulation<'a> {
}
#[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>(