allow deny capture / emulation

This commit is contained in:
Ferdinand Schober
2024-07-12 12:46:57 +02:00
parent fa57b4ea34
commit d84c572a4e
6 changed files with 54 additions and 44 deletions

View File

@@ -1,3 +1,4 @@
use ashpd::{desktop::ResponseError, Error::Response};
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
use reis::tokio::EiConvertEventStreamError;
use std::io;
@@ -75,6 +76,21 @@ pub enum EmulationCreationError {
NoAvailableBackend,
}
impl EmulationCreationError {
/// request was intentionally denied by the user
pub(crate) fn cancelled_by_user(&self) -> bool {
match self {
EmulationCreationError::Libei(LibeiEmulationCreationError::Ashpd(Response(
ResponseError::Cancelled,
)))
| EmulationCreationError::Xdp(XdpEmulationCreationError::Ashpd(Response(
ResponseError::Cancelled,
))) => true,
_ => false,
}
}
}
#[cfg(all(unix, feature = "wayland", not(target_os = "macos")))]
#[derive(Debug, Error)]
pub enum WlrootsEmulationCreationError {